Commit cee435f612f8f621756408183d031cf14f6963a4
1 parent
58a43daa
Exists in
staging
and in
3 other branches
passing params to task_information helper
Showing
6 changed files
with
15 additions
and
9 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -964,7 +964,7 @@ module ApplicationHelper | @@ -964,7 +964,7 @@ module ApplicationHelper | ||
| 964 | content_tag(:div, _('Source: %s') % source_url, :id => 'article-source') unless source_url.nil? | 964 | content_tag(:div, _('Source: %s') % source_url, :id => 'article-source') unless source_url.nil? |
| 965 | end | 965 | end |
| 966 | 966 | ||
| 967 | - def task_information(task) | 967 | + def task_information(task, params = {}) |
| 968 | values = {} | 968 | values = {} |
| 969 | values.merge!(task.information[:variables]) if task.information[:variables] | 969 | values.merge!(task.information[:variables]) if task.information[:variables] |
| 970 | values.merge!({:requestor => link_to(task.requestor.name, task.requestor.url)}) if task.requestor | 970 | values.merge!({:requestor => link_to(task.requestor.name, task.requestor.url)}) if task.requestor |
app/views/profile_editor/_pending_tasks.html.erb
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | <div class='pending-tasks'> | 4 | <div class='pending-tasks'> |
| 5 | <h2><%= _('You have %s pending requests' % @pending_tasks.count) %></h2> | 5 | <h2><%= _('You have %s pending requests' % @pending_tasks.count) %></h2> |
| 6 | <ul> | 6 | <ul> |
| 7 | - <%= safe_join(@pending_tasks.limit(5).map {|task| content_tag('li', task_information(task).html_safe)}) %> | 7 | + <%= safe_join(@pending_tasks.limit(5).map {|task| content_tag('li', task_information(task, params).html_safe)}) %> |
| 8 | </ul> | 8 | </ul> |
| 9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> | 9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> |
| 10 | </div> | 10 | </div> |
app/views/spam/_task.html.erb
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <%= render :partial => 'tasks/task_icon', :locals => {:task => task} %> | 2 | <%= render :partial => 'tasks/task_icon', :locals => {:task => task} %> |
| 3 | <%= render :partial => 'tasks/task_title', :locals => {:task => task} %> | 3 | <%= render :partial => 'tasks/task_title', :locals => {:task => task} %> |
| 4 | <div class="task-information"> | 4 | <div class="task-information"> |
| 5 | - <%= task_information(task) %> | 5 | + <%= task_information(task, params) %> |
| 6 | </div> | 6 | </div> |
| 7 | 7 | ||
| 8 | <%= yield %> <%# ??? %> | 8 | <%= yield %> <%# ??? %> |
app/views/tasks/_task.html.erb
| @@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | <div class="task_information"> | 49 | <div class="task_information"> |
| 50 | - <%= task_information(task) %> | 50 | + <%= task_information(task, params) %> |
| 51 | </div> | 51 | </div> |
| 52 | 52 | ||
| 53 | <%= fields_for "tasks[#{task.id}][task]", task do |f| %> | 53 | <%= fields_for "tasks[#{task.id}][task]", task do |f| %> |
app/views/tasks/_task_processed.html.erb
test/unit/application_helper_test.rb
| @@ -973,10 +973,16 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -973,10 +973,16 @@ class ApplicationHelperTest < ActionView::TestCase | ||
| 973 | end | 973 | end |
| 974 | 974 | ||
| 975 | should "show task information without target detail information on suggest article tasks if it's in the same profile" do | 975 | should "show task information without target detail information on suggest article tasks if it's in the same profile" do |
| 976 | - person = create_user('usertest').person | ||
| 977 | - task = create(SuggestArticle, :target => person) | ||
| 978 | - self.stubs(:params).returns({:profile => person.identifier}) | ||
| 979 | - assert_no_match /in.*#{person.name}/, task_information(task) | 976 | + profile = fast_create(Community) |
| 977 | + task = create(SuggestArticle, :target => profile) | ||
| 978 | + assert_no_match /in.*#{profile.name}/, task_information(task, {:profile => profile.identifier}) | ||
| 979 | + end | ||
| 980 | + | ||
| 981 | + should "show task information with target detail information on suggest article with profile parameter to another profile" do | ||
| 982 | + profile = fast_create(Community) | ||
| 983 | + another_profile = fast_create(Community) | ||
| 984 | + task = create(SuggestArticle, :target => profile) | ||
| 985 | + assert_match /in.*#{profile.name}/, task_information(task, {:profile => another_profile.identifier}) | ||
| 980 | end | 986 | end |
| 981 | 987 | ||
| 982 | protected | 988 | protected |