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
@@ -1,14 +1,15 @@
= form_for [:suppliers, @product_category], html: {class: 'form-horizontal' } do |f|
= simple_form_for [:suppliers, @product_category], html: {class: 'form-horizontal'} do |f|
= render 'error_messages', target: @product_category
.control-group class=(@product_category.errors[:name].any? ? 'error' : nil)
= f.label :name, class: 'control-label'
= f.input :name
.control-group
= hidden_field_tag 'product_category[product_ids][]', ''
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.control-group class=(@product_category.errors[:position].any? ? 'error' : nil)
= f.label :position, class: 'control-label'
.controls
= f.text_field :position, class: 'text_field'
- for product in current_supplier.products
= check_box_tag "product_category[product_ids][]", product.id, @product_category.product_ids.to_a.include?(product.id), id: "product-checker-#{product.id}"
= label_tag "product-checker-#{product.id}", product.name
br
.form-actions
= f.submit nil, class: 'btn btn-primary'
= f.button :submit, class: 'btn-primary'
'
= link_to t("helpers.links.cancel"), suppliers_product_categories_path, class: 'btn'
@@ -2,25 +2,16 @@
.page-header= title :index, model_class
.well
- if @product_categories.any?
table.table
thead
tr
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:position)
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @product_categories.each do |product_category|
tr
td.link= link_to product_category.name, [:suppliers, product_category]
td= product_category.position
td.timestamp=l product_category.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
ul#product-category-list data-update-url=sort_suppliers_product_categories_path
- for product_category in @product_categories
= content_tag_for :li, product_category do
span.handle [drag]
span.name= link_to product_category.name, [:suppliers, product_category]
.pull-right.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
.form-actions
= link_to t("helpers.links.new"), new_suppliers_product_category_path, class: 'btn btn-primary'
@@ -14,5 +14,5 @@ dl.dl-horizontal.show-list
'
= link_to t("helpers.links.destroy"), [:suppliers, @product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
- content_for :row do
- @products = @product_category.products
- @products = ProductDecorator.decorate(@product_category.products)
= render template: 'suppliers/products/index'
+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'