Add image to product

This commit is contained in:
2014-08-27 17:14:56 +02:00
parent 22ebf9e376
commit 2ed16351da
15 changed files with 55 additions and 23 deletions
+11 -16
View File
@@ -1,25 +1,20 @@
= form_for [:suppliers, @product] do |f|
= render 'error_messages', target: @product
.form-row class=(f.object.errors[:name].any? ? 'error' : nil)
.form-label
= f.label :name, data: {t: 'attributes.product.name'}
.form-field
= f.text_field :name
.form-label= f.label :name, data: {t: 'attributes.product.name'}
.form-field= f.text_field :name
.form-row class=(f.object.errors[:code].any? ? 'error' : nil)
.form-label
= f.label :code, data: {t: 'attributes.product.code'}
.form-field
= f.text_field :code
.form-label= f.label :code, data: {t: 'attributes.product.code'}
.form-field= f.text_field :code
.form-row class=(f.object.errors[:price].any? ? 'error' : nil)
.form-label
= f.label :price, data: {t: 'attributes.product.price'}
.form-field
= f.text_field :price
.form-label= f.label :price, data: {t: 'attributes.product.price'}
.form-field= f.text_field :price
.form-row class=(f.object.errors[:image].any? ? 'error' : nil)
.form-label= f.label :image, data: {t: 'attributes.product.image'}
.form-field= f.file_field :image
.form-row class=(f.object.errors[:description].any? ? 'error' : nil)
.form-label
= f.label :description, data: {t: 'attributes.product.description'}
.form-field
= f.text_area :description
.form-label= f.label :description, data: {t: 'attributes.product.description'}
.form-field= f.text_area :description
/= f.input :name
/= f.input :code
/= f.input :price
@@ -1,6 +1,8 @@
- model_class = Product
.page-header= title :show, @product
- if @product.image.present?
.display-panel= image_tag @product.image.url(:medium)
.display-row
.display-label
span data-t='attributes.product.name'