many changes

This commit is contained in:
2012-12-03 18:39:36 +01:00
parent e3dc6a7c68
commit 7d64ab2022
37 changed files with 540 additions and 101 deletions
+13 -17
View File
@@ -1,22 +1,18 @@
= form_for [:suppliers, @product], html: {class: 'form-horizontal' } do |f|
= simple_form_for [:suppliers, @product], html: {class: 'form-horizontal'} do |f|
= render 'error_messages', target: @product
.control-group class=(@product.errors[:name].any? ? 'error' : nil)
= f.label :name, class: 'control-label'
= f.input :name
= f.input :code
= f.input :price
.control-group
= hidden_field_tag 'product[product_category_ids][]', []
= label_tag nil, ProductCategory.model_name.human_plural, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.control-group class=(@product.errors[:code].any? ? 'error' : nil)
= f.label :code, class: 'control-label'
.controls
= f.text_field :code, class: 'text_field'
.control-group class=(@product.errors[:price].any? ? 'error' : nil)
= f.label :price, class: 'control-label'
.controls
= f.text_field :price, class: ['text_field', :currency]
.control-group class=(@product.errors[:product_category_id].any? ? 'error' : nil)
= f.label :product_category_id, ProductCategory.model_name.human, class: 'control-label'
.controls
= f.collection_select :product_category_id, current_supplier.product_categories, :id, :name, include_blank: ''
- for product_category in current_supplier.product_categories
= check_box_tag "product[product_category_ids][]", product_category.id, @product.product_categories.to_a.include?(product_category), id: "product-category-checker-#{product_category.id}"
= label_tag "product-category-checker-#{product_category.id}", product_category.name
br
.form-actions
= f.submit nil, class: 'btn btn-primary'
= f.button :submit, class: 'btn-primary'
'
= link_to t("helpers.links.cancel"), suppliers_products_path, class: 'btn'
+2 -2
View File
@@ -8,7 +8,7 @@
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:code)
th.currency= model_class.human_attribute_name(:price)
th= ProductCategory.model_name.human
th= ProductCategory.model_name.human_plural
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
@@ -17,7 +17,7 @@
td.link= link_to product.name, [:suppliers, product]
td= product.code
td.currency=currency product.price
td.link= link_to_if product.product_category.present?, product.product_category.try(:name), [:suppliers, product.product_category]
td.link= product.category_links namespace: :suppliers
td.timestamp=l product.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, product], class: 'btn btn-mini'
+2 -3
View File
@@ -8,9 +8,8 @@ dl.dl-horizontal.show-list
dd= @product.code
dt= model_class.human_attribute_name(:price)
dd=currency @product.price
- if @product.product_category.present?
dt= ProductCategory.model_name.human
dd= link_to @product.product_category.name, @product.product_category
dt= ProductCategory.model_name.human_plural
dd= @product.category_links(namespace: :suppliers)
.form-actions
= link_to t("helpers.links.back"), suppliers_products_path, class: 'btn'