diff --git a/app/views/tasks/_suggest_article_accept_details.html.erb b/app/views/tasks/_suggest_article_accept_details.html.erb index 3c2429e..4521e47 100644 --- a/app/views/tasks/_suggest_article_accept_details.html.erb +++ b/app/views/tasks/_suggest_article_accept_details.html.erb @@ -10,8 +10,10 @@ <%= labelled_form_field(_('Source'), a.text_field(:source_name)) %> <%= labelled_form_field(_("Source URL"), a.text_field(:source)) %> - <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article][parent_id]", task.target) %> + <%= 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]) %> <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> + <%= a.hidden_field(:type) %> + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :f => a, :lead_id => task.id} %> <% end %> diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 4938c24..f510516 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -313,6 +313,29 @@ class TasksControllerTest < ActionController::TestCase assert_select "#tasks_#{t.id}_task_name" end + should "append hidden tag with type value from article suggestion" do + Task.destroy_all + c = fast_create(Community) + c.add_admin profile + @controller.stubs(:profile).returns(c) + t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body', :type => 'TextArticle'}, :name => 'some name', :email => 'test@localhost.com', :target => c) + + get :index + assert_select "#tasks_#{t.id}_task_article_type[value=TextArticle]" + end + + should "display parent_id selection from article suggestion with predefined value" do + Task.destroy_all + c = fast_create(Community) + c.add_admin profile + @controller.stubs(:profile).returns(c) + parent = fast_create(Folder, :profile_id => c.id) + 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) + + get :index + assert_select "#tasks_#{t.id}_task_article_parent_id option[value=#{parent.id}]" + end + should "not display name from article suggestion when requestor was setted" do Task.destroy_all c = fast_create(Community) -- libgit2 0.21.2