New summary for recommended actions section on progress page
- Divide recommended actions into actions done and actions pending. - Display recomended actions as goals (diplay four by defalut) without toggle but with link to new recommended actions page. - Display description over short_description
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
class DashboardController < Dashboard::BaseController
|
class DashboardController < Dashboard::BaseController
|
||||||
helper_method :dashboard_action, :active_resources, :course
|
helper_method :dashboard_action, :active_resources, :course
|
||||||
|
before_action :set_done_and_pending_actions, only: [:recommended_actions, :progress]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
authorize! :dashboard, proposal
|
authorize! :dashboard, proposal
|
||||||
@@ -29,4 +30,9 @@ class DashboardController < Dashboard::BaseController
|
|||||||
def course
|
def course
|
||||||
@course ||= Dashboard::Action.course_for(proposal)
|
@course ||= Dashboard::Action.course_for(proposal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_done_and_pending_actions
|
||||||
|
@done_actions = proposed_actions.joins(:proposals).where("proposals.id = ?", proposal.id)
|
||||||
|
@pending_actions = proposed_actions - @done_actions
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
<% if proposed_action.proposals.where(id: proposal.id).any? %>
|
<% if proposed_action.proposals.where(id: proposal.id).any? %>
|
||||||
<p><%= l(proposed_action.executed_actions.find_by(proposal: proposal).executed_at.to_date) %></p>
|
<p><%= l(proposed_action.executed_actions.find_by(proposal: proposal).executed_at.to_date) %></p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if proposed_action.short_description.present? %>
|
<% if proposed_action.description.present? %>
|
||||||
<p><%= proposed_action.short_description %></p>
|
<p><%= proposed_action.description.html_safe %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% proposed_action.links.each do |link| %>
|
<% proposed_action.links.each do |link| %>
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<% if proposed_actions.any? %>
|
|
||||||
<h3 class="title"><%= t("dashboard.recommended_actions.title") %></h3>
|
|
||||||
|
|
||||||
<%= render partial: 'proposed_action', collection: proposed_actions %>
|
|
||||||
<% end %>
|
|
||||||
17
app/views/dashboard/_recommended_actions_by_status.html.erb
Normal file
17
app/views/dashboard/_recommended_actions_by_status.html.erb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<h2 class="title"><%= t("dashboard.recommended_actions.#{status}_title") %></h2>
|
||||||
|
<% if actions.any? %>
|
||||||
|
<div id="proposed_actions" data-toggler=".hide">
|
||||||
|
<% actions.first(4).each do |proposed_action| %>
|
||||||
|
<%= render 'proposed_action', proposed_action: proposed_action %>
|
||||||
|
<% end %>
|
||||||
|
<% if actions.count > 4 %>
|
||||||
|
<div class="margin small">
|
||||||
|
<%= link_to recommended_actions_proposal_dashboard_path(proposal.to_param) do %>
|
||||||
|
<strong><%= t("dashboard.recommended_actions.see_proposed_actions") %></strong>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<%= t("dashboard.recommended_actions.without_#{status}_actions") %>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<h3 class="title"><%= t("dashboard.recommended_actions.title") %></h3>
|
||||||
|
|
||||||
|
<%= render 'recommended_actions_by_status', status: 'pending', actions: @pending_actions, toggle: false %>
|
||||||
|
<%= render 'recommended_actions_by_status', status: 'done', actions: @done_actions, toggle: false %>
|
||||||
@@ -33,5 +33,5 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render 'next_goal' %>
|
<%= render 'next_goal' %>
|
||||||
<%= render 'recommended_actions' %>
|
<%= render 'summary_recommended_actions' %>
|
||||||
<%= render 'resources' %>
|
<%= render 'resources' %>
|
||||||
|
|||||||
@@ -515,6 +515,10 @@ en:
|
|||||||
resource_locked: Resource locked
|
resource_locked: Resource locked
|
||||||
recommended_actions:
|
recommended_actions:
|
||||||
title: Recommended actions
|
title: Recommended actions
|
||||||
|
see_proposed_actions: Check out recommended actions
|
||||||
|
hide_proposed_actions: Hide recommended actions
|
||||||
|
pending_title: Recommended actions pending
|
||||||
|
done_title: Recommended actions done
|
||||||
next_goal:
|
next_goal:
|
||||||
title: Goal
|
title: Goal
|
||||||
see_complete_course: Check out the complete course
|
see_complete_course: Check out the complete course
|
||||||
|
|||||||
@@ -515,6 +515,10 @@ es:
|
|||||||
resource_locked: Recurso bloqueado
|
resource_locked: Recurso bloqueado
|
||||||
recommended_actions:
|
recommended_actions:
|
||||||
title: Acciones recomendadas
|
title: Acciones recomendadas
|
||||||
|
see_proposed_actions: Ver todas las acciones recomendadas
|
||||||
|
hide_proposed_actions: Ocultar acciones recomendadas
|
||||||
|
pending_title: Acciones recomendadas pendientes
|
||||||
|
done_title: Acciones recomendadas realizadas
|
||||||
next_goal:
|
next_goal:
|
||||||
title: Meta
|
title: Meta
|
||||||
see_complete_course: Ver ruta completa
|
see_complete_course: Ver ruta completa
|
||||||
|
|||||||
@@ -49,6 +49,73 @@ feature "Proposal's dashboard" do
|
|||||||
scenario 'Dashboard progress show proposed actions' do
|
scenario 'Dashboard progress show proposed actions' do
|
||||||
action = create(:dashboard_action, :proposed_action, :active)
|
action = create(:dashboard_action, :proposed_action, :active)
|
||||||
|
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
|
||||||
|
expect(page).to have_content(action.title)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress do not display from the fourth proposed actions", js: true do
|
||||||
|
create_list(:dashboard_action, 4, :proposed_action, :active)
|
||||||
|
action_5 = create(:dashboard_action, :proposed_action, :active)
|
||||||
|
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
|
||||||
|
expect(page).not_to have_content(action_5.title)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress display link to new page for proposed actions when there are more than four proposed actions", js: true do
|
||||||
|
create_list(:dashboard_action, 4, :proposed_action, :active)
|
||||||
|
action_5 = create(:dashboard_action, :proposed_action, :active)
|
||||||
|
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
|
||||||
|
expect(page).to have_link("Check out recommended actions")
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress do not display link to new page for proposed actions when there are less than five proposed actions", js: true do
|
||||||
|
create_list(:dashboard_action, 4, :proposed_action, :active)
|
||||||
|
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
|
||||||
|
expect(page).not_to have_link("Check out recommended actions")
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress display proposed_action pending on his section" do
|
||||||
|
action = create(:dashboard_action, :proposed_action, :active)
|
||||||
|
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
|
||||||
|
within "#proposed_actions_pending" do
|
||||||
|
expect(page).to have_content(action.title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress display no results text when there are not proposed_actions pending" do
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
|
||||||
|
expect(page).to have_content("No recommended actions pending")
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress display proposed_action done on his section" do
|
||||||
|
action = create(:dashboard_action, :proposed_action, :active)
|
||||||
|
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
find(:css, "#dashboard_action_#{action.id}_execute").click
|
||||||
|
|
||||||
|
within "#proposed_actions_done" do
|
||||||
|
expect(page).to have_content(action.title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress display no results text when there are not proposed_actions pending" do
|
||||||
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
|
|
||||||
|
expect(page).to have_content("No recommended actions done")
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Dashboard progress can execute proposed action" do
|
||||||
|
action = create(:dashboard_action, :proposed_action, :active)
|
||||||
|
|
||||||
visit progress_proposal_dashboard_path(proposal)
|
visit progress_proposal_dashboard_path(proposal)
|
||||||
expect(page).to have_content(action.title)
|
expect(page).to have_content(action.title)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user