Commit fecb92d5a3839232e367c6195b64ef9334cc294a
1 parent
3c2de986
Exists in
master
and in
29 other branches
Fix type and parent_id selection for suggest article view
Showing
2 changed files
with
26 additions
and
1 deletions
Show diff stats
app/views/tasks/_suggest_article_accept_details.html.erb
| ... | ... | @@ -10,8 +10,10 @@ |
| 10 | 10 | <%= labelled_form_field(_('Source'), a.text_field(:source_name)) %> |
| 11 | 11 | <%= labelled_form_field(_("Source URL"), a.text_field(:source)) %> |
| 12 | 12 | |
| 13 | - <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article][parent_id]", task.target) %> | |
| 13 | + <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article][parent_id]", task.target, task.article[:parent_id]) %> | |
| 14 | 14 | <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> |
| 15 | 15 | |
| 16 | + <%= a.hidden_field(:type) %> | |
| 17 | + | |
| 16 | 18 | <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :f => a, :lead_id => task.id} %> |
| 17 | 19 | <% end %> | ... | ... |
test/functional/tasks_controller_test.rb
| ... | ... | @@ -313,6 +313,29 @@ class TasksControllerTest < ActionController::TestCase |
| 313 | 313 | assert_select "#tasks_#{t.id}_task_name" |
| 314 | 314 | end |
| 315 | 315 | |
| 316 | + should "append hidden tag with type value from article suggestion" do | |
| 317 | + Task.destroy_all | |
| 318 | + c = fast_create(Community) | |
| 319 | + c.add_admin profile | |
| 320 | + @controller.stubs(:profile).returns(c) | |
| 321 | + t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body', :type => 'TextArticle'}, :name => 'some name', :email => 'test@localhost.com', :target => c) | |
| 322 | + | |
| 323 | + get :index | |
| 324 | + assert_select "#tasks_#{t.id}_task_article_type[value=TextArticle]" | |
| 325 | + end | |
| 326 | + | |
| 327 | + should "display parent_id selection from article suggestion with predefined value" do | |
| 328 | + Task.destroy_all | |
| 329 | + c = fast_create(Community) | |
| 330 | + c.add_admin profile | |
| 331 | + @controller.stubs(:profile).returns(c) | |
| 332 | + parent = fast_create(Folder, :profile_id => c.id) | |
| 333 | + t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body', :parent_id => parent.id}, :name => 'some name', :email => 'test@localhost.com', :target => c) | |
| 334 | + | |
| 335 | + get :index | |
| 336 | + assert_select "#tasks_#{t.id}_task_article_parent_id option[value=#{parent.id}]" | |
| 337 | + end | |
| 338 | + | |
| 316 | 339 | should "not display name from article suggestion when requestor was setted" do |
| 317 | 340 | Task.destroy_all |
| 318 | 341 | c = fast_create(Community) | ... | ... |