Enables flagging proposals
This commit is contained in:
@@ -57,6 +57,16 @@ class ProposalsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def flag
|
||||
Flag.flag(current_user, @proposal)
|
||||
respond_with @proposal, template: 'proposals/_refresh_flag_actions'
|
||||
end
|
||||
|
||||
def unflag
|
||||
Flag.unflag(current_user, @proposal)
|
||||
respond_with @proposal, template: 'proposals/_refresh_flag_actions'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def proposal_params
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<span class="flag-content">
|
||||
<% if show_flag_action? proposal %>
|
||||
<a id="flag-expand-proposal-<%= proposal.id %>" data-dropdown="flag-drop-proposal-<%= proposal.id %>" aria-controls="flag-drop-proposal-<%= proposal.id %>" aria-expanded="false" title="<%= t('shared.flag') %>">
|
||||
<i class="icon-flag flag-disable"></i>
|
||||
@@ -19,3 +20,4 @@
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
1
app/views/proposals/_refresh_flag_actions.js.erb
Normal file
1
app/views/proposals/_refresh_flag_actions.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#<%= dom_id(@proposal) %> .js-flag-actions").html('<%= j render("proposals/flag_actions", proposal: @proposal) %>');
|
||||
Reference in New Issue
Block a user