This commit is contained in:
Bertocq
2017-06-27 17:57:35 +02:00
committed by Senén Rodero Rodríguez
parent 886431b43d
commit 614ff79ba1
15 changed files with 135 additions and 68 deletions

View File

@@ -53,26 +53,28 @@
data: {js_url: suggest_tags_path} %>
</div>
<div class="small-12 column">
<div class="image-upload">
<%= f.file_field :image, accept: 'image/jpeg', label: false, class:'show-for-sr' %>
<br>
<%= f.label :image, t("budgets.investments.form.image_label"), class:'button' %>
<p><%= investment_image_file_name(@investment) %></p>
</div>
</div>
<%= f.fields_for :image do |builder| %>
<% if @investment.errors.has_key?(:image) %>
<div class="small-12 column">
<div class="image-errors">
<small class="error"><%= errors_on_image(@investment)%></small>
<div class="image-upload">
<%= f.file_field :attachment, accept: 'image/jpg,image/jpeg', label: false, class:'show-for-sr' %>
<br>
<%= f.label :attachment, t("budgets.investments.form.image_label"), class:'button' %>
</div>
</div>
<% end %>
<div class="small-12 column">
<%= f.text_field :image_title %>
</div>
<% if @investment.errors.has_key?(:attachment) %>
<div class="small-12 column">
<div class="image-errors">
<small class="error"><%= errors_on_image(@investment)%></small>
</div>
</div>
<% end %>
<div class="small-12 column">
<%= f.text_field :title %>
</div>
<% end %>
<% unless current_user.manager? %>

View File

@@ -10,16 +10,15 @@
<% if @investment.image.exists? %>
<div class="small-12 column">
<%= image_tag @investment.image.url(:large) %>
<%= image_tag @investment.image_url(:large) %>
</div>
<% end %>
<div class="small-12 column">
<div class="image-upload">
<%= f.file_field :image, accept: 'image/jpeg', label: false, class:'show-for-sr' %>
<%= f.file_field :attachment, accept: 'image/jpg,image/jpeg', label: false, class:'show-for-sr' %>
<br>
<%= f.label :image, t("budgets.investments.edit_image.form.image_label"), class:'button' %>
<p><%= investment_image_file_name(@investment) %></p>
<%= f.label :attachment, t("budgets.investments.edit_image.form.image_label"), class:'button' %>
</div>
</div>
@@ -32,18 +31,21 @@
<% end %>
<div class="small-12 column">
<%= f.label :image_title, t("budgets.investments.edit_image.form.image_title") %>
<%= f.text_field :image_title, placeholder: t("budgets.investments.edit_image.form.image_title"), label: false %>
<%= f.label :title, t("budgets.investments.edit_image.form.image_title") %>
<%= f.text_field :title, placeholder: t("budgets.investments.edit_image.form.image_title"), label: false %>
</div>
<div class="actions small-12 column">
<%= f.submit(class: "button", value: t("budgets.investments.edit_image.form.submit_button")) %>
<% if @investment.image.exists? %>
<%= link_to t("budgets.investments.edit_image.form.remove_button"),
remove_image_budget_investment_path(@investment.budget, @investment),
class: "button hollow alert",
method: :delete,
data: { confirm: t("budgets.investments.edit_image.form.remove_alert") } %>
<div class="float-right">
<%= link_to t("budgets.investments.edit_image.form.remove_button"),
remove_image_budget_investment_path(@investment.budget, @investment),
class: "button hollow alert",
method: :delete,
data: { confirm: t("budgets.investments.edit_image.form.remove_alert") } %>
</div>
<% end %>
</div>

View File

@@ -4,15 +4,10 @@
<div class="small-12 medium-3 large-2 column">
<% if investment.image.exists? %>
<picture>
<source srcset="<%= investment.image.url(:medium) %>"
alt="<%= investment.image_title %>"
title= "<%= investment.image_title %>"
media="(max-width: 640px)">
<img srcset="<%= investment.image.url(:thumb) %>"
alt="<%= investment.image_title %>"
title="<%= investment.image_title %>">
</picture>
<figure>
<%= image_tag investment.image_url(:thumb), alt: investment.image.title %>
<figcaption><%= investment.image.title %></figcaption>
</figure>
<% else %>
<div class="no-image"></div>
<% end %>

View File

@@ -32,11 +32,10 @@
<div class="row">
<div class="small-12 column text-center">
<figure>
<%= image_tag investment.image.url(:large),
title: investment.image_title,
alt: investment.image_title %>
<%= image_tag investment.image_url(:large),
alt: investment.image.title %>
<figcaption class="text-right">
<em><%= investment.image_title %></em>
<em><%= investment.image.title %></em>
</figcaption>
</figure>
<hr>