refactors proposal helper and use correctly on proposal show view

This commit is contained in:
decabeza
2017-09-18 17:31:37 +02:00
committed by Bertocq
parent b5d0a82534
commit fc3eac7e8e
2 changed files with 4 additions and 8 deletions

View File

@@ -44,8 +44,4 @@ module ProposalsHelper
current_user && @proposal.editable_by?(current_user) current_user && @proposal.editable_by?(current_user)
end end
def show_actions_menu?
can_create_document? || author_of_proposal? || current_editable?
end
end end

View File

@@ -104,11 +104,11 @@
</div> </div>
<aside class="small-12 medium-3 column"> <aside class="small-12 medium-3 column">
<% if show_actions_menu? %> <% if can_create_document? || author_of_proposal? || current_editable? %>
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h2><%= t("proposals.show.author") %></h2> <h2><%= t("proposals.show.author") %></h2>
<div class="show-actions-menu"> <div class="show-actions-menu">
<% if can?(:create, @document) && @proposal.documents.size < Proposal.max_documents_allowed %> <% if can_create_document? %>
<%= link_to new_document_path(documentable_id: @proposal, documentable_type: @proposal.class.name, from: request.url), <%= link_to new_document_path(documentable_id: @proposal, documentable_type: @proposal.class.name, from: request.url),
class: 'button hollow expanded' do %> class: 'button hollow expanded' do %>
<span class="icon-document"></span> <span class="icon-document"></span>
@@ -116,7 +116,7 @@
<% end %> <% end %>
<% end %> <% end %>
<% if author_of?(@proposal, current_user) %> <% if author_of_proposal? %>
<%= link_to new_proposal_notification_path(proposal_id: @proposal.id), <%= link_to new_proposal_notification_path(proposal_id: @proposal.id),
class: 'button hollow expanded' do %> class: 'button hollow expanded' do %>
<span class="icon-no-notification"></span> <span class="icon-no-notification"></span>
@@ -124,7 +124,7 @@
<% end %> <% end %>
<% end %> <% end %>
<% if current_user && @proposal.editable_by?(current_user) %> <% if current_editable? %>
<%= link_to edit_proposal_path(@proposal), class: 'edit-proposal button hollow expanded' do %> <%= link_to edit_proposal_path(@proposal), class: 'edit-proposal button hollow expanded' do %>
<span class="icon-edit"></span> <span class="icon-edit"></span>
<%= t("proposals.show.edit_proposal_link") %> <%= t("proposals.show.edit_proposal_link") %>