Some fixes and refactor

This commit is contained in:
Senén Rodero Rodríguez
2017-09-25 11:02:42 +02:00
parent 92f66a6db9
commit 2854c0b683
7 changed files with 23 additions and 19 deletions

View File

@@ -4,21 +4,21 @@
<div class="small-12 medium-9 column">
<%= back_link_to budget_investments_path(investment.budget, heading_id: investment.heading) %>
<% if can?(:create, @document) && investment.documents.size < Budget::Investment.max_documents_allowed %>
<% if can_create_document?(investment) %>
<%= link_to t("documents.upload_document"),
new_document_path(documentable_id:investment, documentable_type: investment.class.name, from: request.url),
class: 'button hollow float-right' %>
<% end %>
<% if can?(:create, @image) %>
<% if can_create_image?(investment) %>
<%= link_to t("images.upload_image"),
new_image_path(imageable_id:investment, imageable_type: investment.class.name, from: request.url),
class: 'button hollow float-right' %>
<% end %>
<% if @investment.image.present? && can?(:destroy, @investment.image) %>
<% if can_destroy_image?(investment) %>
<%= link_to t("images.remove_image"),
image_path(@investment.image, from: request.url),
image_path(investment.image, from: request.url),
method: :delete,
class: 'button hollow float-right' %>
<% end %>

View File

@@ -108,12 +108,12 @@
</div>
<aside class="small-12 medium-3 column">
<% if can_create_document?(@document, @proposal) || author_of_proposal?(@proposal) || current_editable?(@proposal) ||
can?(:create, @image) || can_destroy_image?(@proposal.image, @proposal) %>
<% if can_create_document?(@proposal) || author_of_proposal?(@proposal) || current_editable?(@proposal) ||
can_create_image?(@proposal) || can_destroy_image?(@proposal) %>
<div class="sidebar-divider"></div>
<h2><%= t("proposals.show.author") %></h2>
<div class="show-actions-menu">
<% if can_create_document?(@document, @proposal) %>
<% if can_create_document?(@proposal) %>
<%= link_to new_document_path(documentable_id: @proposal, documentable_type: @proposal.class.name, from: request.url),
class: 'button hollow expanded' do %>
<span class="icon-document"></span>
@@ -129,7 +129,7 @@
<% end %>
<% end %>
<% if can?(:create, @image) %>
<% if can_create_image?(@proposal) %>
<%= link_to new_image_path(imageable_id: @proposal, imageable_type: @proposal.class.name, from: request.url),
class: 'button hollow expanded' do %>
<span class="icon-document"></span>
@@ -137,7 +137,7 @@
<% end %>
<% end %>
<% if can_destroy_image?(@proposal.image, @proposal) %>
<% if can_destroy_image?(@proposal) %>
<%= link_to image_path(@proposal.image, from: request.url),
method: :delete,
class: 'button hollow expanded',