Commit ee621004cad17d94c67729bbc06b7c62ed2d9547
1 parent
802fc44c
Exists in
master
and in
22 other branches
ActionItem1082: fixing highlight checkbox when approving article
Showing
3 changed files
with
24 additions
and
2 deletions
Show diff stats
app/models/approve_article.rb
| @@ -51,8 +51,16 @@ class ApproveArticle < Task | @@ -51,8 +51,16 @@ class ApproveArticle < Task | ||
| 51 | article_parent_id = value.id | 51 | article_parent_id = value.id |
| 52 | end | 52 | end |
| 53 | 53 | ||
| 54 | + def highlighted= value | ||
| 55 | + data[:highlighted] = value | ||
| 56 | + end | ||
| 57 | + | ||
| 58 | + def highlighted | ||
| 59 | + data[:highlighted] | ||
| 60 | + end | ||
| 61 | + | ||
| 54 | def perform | 62 | def perform |
| 55 | - PublishedArticle.create(:name => name, :profile => target, :reference_article => article, :parent => article_parent) | 63 | + PublishedArticle.create(:name => name, :profile => target, :reference_article => article, :parent => article_parent, :highlighted => highlighted) |
| 56 | end | 64 | end |
| 57 | 65 | ||
| 58 | def target_notification_message | 66 | def target_notification_message |
app/views/tasks/_approve_article.rhtml
| @@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
| 22 | <%= labelled_form_field _('Name for publishing'), f.text_field(:name, :style => 'width:80%;') %> | 22 | <%= labelled_form_field _('Name for publishing'), f.text_field(:name, :style => 'width:80%;') %> |
| 23 | 23 | ||
| 24 | <%= select_folder(_('Select the folder where the article must be published'), 'task', 'article_parent_id', task.target.folders) %> | 24 | <%= select_folder(_('Select the folder where the article must be published'), 'task', 'article_parent_id', task.target.folders) %> |
| 25 | - <%= labelled_form_field( _('Highlight'), check_box_tag(:highlighted, true)) %> | 25 | + <%= labelled_form_field( _('Highlight this article'), f.check_box(:highlighted)) %> |
| 26 | <%= labelled_form_field _('Comment for author'), f.text_area(:closing_statment, :style => 'height:200px; width:80%;') %> | 26 | <%= labelled_form_field _('Comment for author'), f.text_area(:closing_statment, :style => 'height:200px; width:80%;') %> |
| 27 | 27 | ||
| 28 | </div> | 28 | </div> |
test/functional/tasks_controller_test.rb
| @@ -177,4 +177,18 @@ class TasksControllerTest < Test::Unit::TestCase | @@ -177,4 +177,18 @@ class TasksControllerTest < Test::Unit::TestCase | ||
| 177 | post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new_name', :article_parent_id => folder.id} | 177 | post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new_name', :article_parent_id => folder.id} |
| 178 | assert_equal folder, PublishedArticle.find(:first).parent | 178 | assert_equal folder, PublishedArticle.find(:first).parent |
| 179 | end | 179 | end |
| 180 | + | ||
| 181 | + should 'be highlighted if asked when approving a published article' do | ||
| 182 | + PublishedArticle.destroy_all | ||
| 183 | + c = Community.create!(:name => 'test comm', :moderated_articles => false) | ||
| 184 | + @controller.stubs(:profile).returns(c) | ||
| 185 | + folder = c.articles.create!(:name => 'test folder', :type => 'Folder') | ||
| 186 | + c.affiliate(profile, Profile::Roles.all_roles) | ||
| 187 | + article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails') | ||
| 188 | + t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => profile) | ||
| 189 | + | ||
| 190 | + post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new_name', :article_parent_id => folder.id, :highlighted => true} | ||
| 191 | + assert_equal true, PublishedArticle.find(:first).highlighted | ||
| 192 | + end | ||
| 193 | + | ||
| 180 | end | 194 | end |