Adds progress indicator
This commit is contained in:
@@ -168,11 +168,21 @@
|
||||
}
|
||||
|
||||
.support-indicator {
|
||||
flex-grow: 2;
|
||||
flex-grow: 3;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
|
||||
.progress {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.progress-meter {
|
||||
background-color: #ffac38;
|
||||
}
|
||||
}
|
||||
|
||||
.current-goal {
|
||||
flex-grow: 1;
|
||||
flex-grow: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Dashboard::BaseController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
helper_method :proposal, :proposed_actions, :resources
|
||||
helper_method :proposal, :proposed_actions, :resource, :resources, :next_goal_supports, :next_goal_progress
|
||||
|
||||
respond_to :html
|
||||
layout 'proposals_dashboard'
|
||||
@@ -19,4 +19,12 @@ class Dashboard::BaseController < ApplicationController
|
||||
def resources
|
||||
@resources ||= ProposalDashboardAction.resources.active_for(proposal)
|
||||
end
|
||||
|
||||
def next_goal_supports
|
||||
@next_goal_supports ||= ProposalDashboardAction.next_goal_for(proposal)&.required_supports || Setting["votes_for_proposal_success"]
|
||||
end
|
||||
|
||||
def next_goal_progress
|
||||
@next_goal_progress ||= (proposal.votes_for.size * 100) / next_goal_supports.to_i
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ProposalsDashboardController < Dashboard::BaseController
|
||||
helper_method :proposal_dashboard_action, :next_goal_supports
|
||||
helper_method :proposal_dashboard_action
|
||||
|
||||
def index
|
||||
authorize! :dashboard, proposal
|
||||
@@ -61,8 +61,4 @@ class ProposalsDashboardController < Dashboard::BaseController
|
||||
def proposal_dashboard_action
|
||||
@proposal_dashboard_action ||= ProposalDashboardAction.find(params[:id])
|
||||
end
|
||||
|
||||
def next_goal_supports
|
||||
ProposalDashboardAction.next_goal_for(proposal)&.required_supports || Setting["votes_for_proposal_success"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,6 +30,13 @@
|
||||
</div>
|
||||
|
||||
<div class="support-indicator">
|
||||
<div class="text-right">
|
||||
<%= next_goal_progress %>%
|
||||
</div>
|
||||
<div class="progress" role="progressbar" tabindex="0" aria-valuenow="50" aria-valuemin="0"
|
||||
aria-valuetext="<%= "#{next_goal_progress}%" %>" aria-valuemax="100">
|
||||
<div class="progress-meter" style="width: <%= next_goal_progress %>%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="proposal-link">
|
||||
|
||||
Reference in New Issue
Block a user