Fixes #190
Shows next goal information in progress page. Fixed missing poll feature in features section.
This commit is contained in:
@@ -219,6 +219,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
.next-goal {
|
||||
i {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.skip-icon {
|
||||
padding-left: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.columns {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
37
app/views/proposals_dashboard/_next_goal.html.erb
Normal file
37
app/views/proposals_dashboard/_next_goal.html.erb
Normal file
@@ -0,0 +1,37 @@
|
||||
<% if next_goal.present? %>
|
||||
<br><br>
|
||||
<div class="action-title">
|
||||
<h5><%= t('.title') %></h5>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row next-goal">
|
||||
<div class="column small-12">
|
||||
<i class="fi-flag"></i>
|
||||
<strong>
|
||||
<%= t('.target_supports', count: number_with_precision(next_goal.required_supports, delimiter: '.', precision: 0)) %>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="column small-12"> </div>
|
||||
|
||||
<div class="column small-12">
|
||||
<i class="fi-unlock"></i>
|
||||
<strong><%= next_goal.title %></strong>
|
||||
</div>
|
||||
<div class="column small-12 skip-icon">
|
||||
<p class="help-text"><%= t('.unlocked_resource') %></p>
|
||||
</div>
|
||||
|
||||
<% if next_goal.day_offset.positive? %>
|
||||
<div class="column small-12">
|
||||
<strong><%= t('.days', count: next_goal.day_offset) %></strong>
|
||||
</div>
|
||||
<div class="column small-12">
|
||||
<p class="help-text"><%= t('.ideal_time') %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="column small-12">
|
||||
<%= link_to t('.see_complete_course'), '#' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
20
app/views/proposals_dashboard/_poll_resource.html.erb
Normal file
20
app/views/proposals_dashboard/_poll_resource.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<% if can?(:manage_polls, proposal) %>
|
||||
<div class="column">
|
||||
<div class="card resource-card success">
|
||||
<div class="card-section">
|
||||
<p class="text-right">
|
||||
<i class="fi-check"></i>
|
||||
</p>
|
||||
<h4 class="text-center"><%= t('proposals_dashboard.menu.polls') %></h4>
|
||||
<p class="text-center">
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="card-section text-center bottom-container">
|
||||
<div class="bottom-element text-center">
|
||||
<%= link_to t('proposals_dashboard.resource.view_resource'), proposal_dashboard_polls_path(proposal.to_param), class: 'button success' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,11 +1,10 @@
|
||||
<% if active_resources.any? %>
|
||||
<br><br>
|
||||
<div class="action-title">
|
||||
<h5><%= t('.available_resources') %></h5>
|
||||
<hr>
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="action-title">
|
||||
<h5><%= t('.available_resources') %></h5>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="row small-up-2 medium-up-3 large-up-4">
|
||||
<%= render partial: 'resource', collection: active_resources %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row small-up-2 medium-up-3 large-up-4">
|
||||
<%= render 'poll_resource' %>
|
||||
<%= render partial: 'resource', collection: active_resources %>
|
||||
</div>
|
||||
|
||||
@@ -23,5 +23,6 @@
|
||||
|
||||
<%= javascript_include_tag 'dashboard_graphs', 'data-turbolinks-track' => true %>
|
||||
|
||||
<%= render 'next_goal' %>
|
||||
<%= render 'recommended_actions' %>
|
||||
<%= render 'resources' %>
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user