Commit f426c3045bb396f27d6b87ed17098594e77ca713
1 parent
0aa106df
Exists in
master
and in
28 other branches
ActionItem280: adapting new to cope with new interface required by
edit template git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1689 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -41,9 +41,11 @@ class CmsController < MyProfileController | @@ -41,9 +41,11 @@ class CmsController < MyProfileController | ||
41 | end | 41 | end |
42 | 42 | ||
43 | def new | 43 | def new |
44 | + # FIXME this method should share some logic wirh edit !!! | ||
45 | + | ||
44 | # user must choose an article type first | 46 | # user must choose an article type first |
45 | - type = params[:type] | ||
46 | - if type.blank? | 47 | + @type = params[:type] |
48 | + if @type.blank? | ||
47 | @article_types = [] | 49 | @article_types = [] |
48 | ARTICLE_TYPES.each do |type| | 50 | ARTICLE_TYPES.each do |type| |
49 | @article_types.push({ | 51 | @article_types.push({ |
@@ -57,8 +59,8 @@ class CmsController < MyProfileController | @@ -57,8 +59,8 @@ class CmsController < MyProfileController | ||
57 | return | 59 | return |
58 | end | 60 | end |
59 | 61 | ||
60 | - raise "Invalid article type #{type}" unless ARTICLE_TYPES.map {|item| item.name}.include?(type) | ||
61 | - klass = type.constantize | 62 | + raise "Invalid article type #{@type}" unless ARTICLE_TYPES.map {|item| item.name}.include?(@type) |
63 | + klass = @type.constantize | ||
62 | @article = klass.new(params[:article]) | 64 | @article = klass.new(params[:article]) |
63 | 65 | ||
64 | 66 |