diff --git a/app/assets/stylesheets/proposal.scss b/app/assets/stylesheets/proposal.scss
index 5d4f52819..c755be9f0 100644
--- a/app/assets/stylesheets/proposal.scss
+++ b/app/assets/stylesheets/proposal.scss
@@ -219,6 +219,16 @@
}
}
+ .next-goal {
+ i {
+ margin-right: 10px;
+ }
+
+ .skip-icon {
+ padding-left: 40px;
+ }
+ }
+
.columns {
padding: 0;
}
diff --git a/app/controllers/dashboard/base_controller.rb b/app/controllers/dashboard/base_controller.rb
index a123863b4..f2db2ba33 100644
--- a/app/controllers/dashboard/base_controller.rb
+++ b/app/controllers/dashboard/base_controller.rb
@@ -1,7 +1,7 @@
class Dashboard::BaseController < ApplicationController
before_action :authenticate_user!
- helper_method :proposal, :proposed_actions, :resource, :resources, :next_goal_supports, :next_goal_progress, :community_members_count
+ helper_method :proposal, :proposed_actions, :resource, :resources, :next_goal, :next_goal_supports, :next_goal_progress, :community_members_count
respond_to :html
layout 'proposals_dashboard'
@@ -21,7 +21,7 @@ class Dashboard::BaseController < ApplicationController
end
def next_goal_supports
- @next_goal_supports ||= ProposalDashboardAction.next_goal_for(proposal)&.required_supports || Setting["votes_for_proposal_success"]
+ @next_goal_supports ||= next_goal&.required_supports || Setting["votes_for_proposal_success"]
end
def next_goal_progress
@@ -33,4 +33,8 @@ class Dashboard::BaseController < ApplicationController
proposal.community.participants.count
end
end
+
+ def next_goal
+ @next_goal ||= ProposalDashboardAction.next_goal_for(proposal)
+ end
end
diff --git a/app/views/proposals_dashboard/_next_goal.html.erb b/app/views/proposals_dashboard/_next_goal.html.erb
new file mode 100644
index 000000000..dcb425125
--- /dev/null
+++ b/app/views/proposals_dashboard/_next_goal.html.erb
@@ -0,0 +1,37 @@
+<% if next_goal.present? %>
+
+
+
<%= t('.title') %>
+
+
+
+
+
+
+ <%= t('.target_supports', count: number_with_precision(next_goal.required_supports, delimiter: '.', precision: 0)) %>
+
+
+
+
+
+
+ <%= next_goal.title %>
+
+
+
<%= t('.unlocked_resource') %>
+
+
+ <% if next_goal.day_offset.positive? %>
+
+ <%= t('.days', count: next_goal.day_offset) %>
+
+
+
<%= t('.ideal_time') %>
+
+ <% end %>
+
+
+ <%= link_to t('.see_complete_course'), '#' %>
+
+
+<% end %>
diff --git a/app/views/proposals_dashboard/_poll_resource.html.erb b/app/views/proposals_dashboard/_poll_resource.html.erb
new file mode 100644
index 000000000..23cb42acc
--- /dev/null
+++ b/app/views/proposals_dashboard/_poll_resource.html.erb
@@ -0,0 +1,20 @@
+<% if can?(:manage_polls, proposal) %>
+
+
+
+
+
+
+
<%= t('proposals_dashboard.menu.polls') %>
+
+
+
+
+
+
+ <%= link_to t('proposals_dashboard.resource.view_resource'), proposal_dashboard_polls_path(proposal.to_param), class: 'button success' %>
+
+
+
+
+<% end %>
diff --git a/app/views/proposals_dashboard/_resources.html.erb b/app/views/proposals_dashboard/_resources.html.erb
index e3dc8d456..765ba8aeb 100644
--- a/app/views/proposals_dashboard/_resources.html.erb
+++ b/app/views/proposals_dashboard/_resources.html.erb
@@ -1,11 +1,10 @@
-<% if active_resources.any? %>
-
-
-
<%= t('.available_resources') %>
-
-
+
+
+
<%= t('.available_resources') %>
+
+
-
- <%= render partial: 'resource', collection: active_resources %>
-
-<% end %>
+
+ <%= render 'poll_resource' %>
+ <%= render partial: 'resource', collection: active_resources %>
+
diff --git a/app/views/proposals_dashboard/progress.html.erb b/app/views/proposals_dashboard/progress.html.erb
index 083027c40..f65da52a5 100644
--- a/app/views/proposals_dashboard/progress.html.erb
+++ b/app/views/proposals_dashboard/progress.html.erb
@@ -23,5 +23,6 @@
<%= javascript_include_tag 'dashboard_graphs', 'data-turbolinks-track' => true %>
+<%= render 'next_goal' %>
<%= render 'recommended_actions' %>
<%= render 'resources' %>
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml
index b4e351b78..aa41b8f7f 100644
--- a/config/locales/en/general.yml
+++ b/config/locales/en/general.yml
@@ -537,6 +537,17 @@ en:
view_resource: See resource
recommended_actions:
title: Recommended actions
+ next_goal:
+ title: Goal
+ target_supports:
+ one: Get %{count} support for your proposal
+ other: Get %{count} supports for your proposal
+ days:
+ one: "%{count} day"
+ other: "%{count} days"
+ unlocked_resource: Resource unlocked
+ ideal_time: Ideal time
+ see_complete_course: Check out the complete course
dashboard:
polls:
index:
diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml
index 36bc8d6de..9c1c3f112 100644
--- a/config/locales/es/general.yml
+++ b/config/locales/es/general.yml
@@ -537,6 +537,17 @@ es:
view_resource: Ver recurso
recommended_actions:
title: Acciones recomendadas
+ next_goal:
+ title: Meta
+ target_supports:
+ one: Consigue %{count} apoyo para tu propuesta
+ other: Consigue %{count} apoyos para tu propuesta
+ days:
+ one: "%{count} día"
+ other: "%{count} días"
+ unlocked_resource: Recurso desbloqueado
+ ideal_time: Tiempo ideal
+ see_complete_course: Ver ruta completa
dashboard:
polls:
index: