Added upload image button. Created function to show file upload name. Added translation.

This commit is contained in:
Alessandro Cuoghi
2017-06-22 19:39:43 +02:00
committed by Senén Rodero Rodríguez
parent 4ce8e14f86
commit 6cde1c1c10
6 changed files with 20 additions and 11 deletions

View File

@@ -942,6 +942,15 @@
.note-marked p{
margin-bottom:0;
}
.image-upload{
.button, p{
float: left;
}
p{
margin-left:1rem;
margin-top: 0.8rem;
}
}
}
.investment-project-show .supports,

View File

@@ -1,30 +1,29 @@
<%= form_for([@investment.budget, @investment], url: update_image_budget_investment_path(@investment.budget, @investment), multipart: true, method: :put) do |f| %>
<%= render 'shared/errors', resource: @investment %>
<div class="row">
<div class="small-12 column">
<span class="note-marked">
<% note_key = @investment.image.exists? ? "edit_note" : "add_note" %>
<%= t("budgets.investments.edit_image.#{note_key}", title: @investment.title) %></p>
</span>
</div>
<% if @investment.image.exists? %>
<div class="small-12 column">
<%= image_tag @investment.image.url(:large) %>
</div>
<% end %>
<div class="small-12 column">
<%= f.file_field :image, accept: 'image/jpeg' %>
<div class="image-upload">
<%= f.file_field :image, accept: 'image/jpeg', label: false, class:'show-for-sr' %>
<br>
<%= f.label :image, t("images.upload_image"), class:'button' %>
<p><%= @investment.image.url.split('/').last.split("?")[0] %></p>
</div>
</div>
<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 %>
</div>
<div class="actions small-12 column">
<%= f.submit(class: "button", value: t("budgets.investments.edit_image.form.submit_button")) %>
</div>

View File

@@ -27,7 +27,6 @@
<%= investment.heading.name %>
</div>
<br>
<!-- TODO: ROCK&ROR: Markup rework accordingly to mockup definition -->
<% if investment.image.exists? %>
<div class="row">
@@ -43,8 +42,6 @@
<hr>
</div>
</div>
<% end %>
<p id="investment_code">
<%= t("budgets.investments.show.code_html", code: investment.id) %>

View File

@@ -184,6 +184,8 @@ en:
geozones:
none: All city
all: All scopes
images:
upload_image: Upload Image
layouts:
application:
chrome: Google Chrome

View File

@@ -99,7 +99,7 @@ es:
title: "Título"
location: "Ubicación"
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, escribe su nombre"
image: "Imagen descriptiva de la propueta"
image: "Imagen descriptiva de la propuesta"
image_title: "Título de la imagen"
comment:
body: "Comentario"

View File

@@ -184,6 +184,8 @@ es:
geozones:
none: Toda la ciudad
all: Todos los ámbitos de actuación
images:
upload_image: Subir una imagen
layouts:
application:
chrome: Google Chrome