big refactor for test and admin namespace
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
= simple_form_for [:admin, @product], html: {class: 'form-horizontal' } do |f|
|
||||
= render 'error_messages', target: @product
|
||||
= f.input :name
|
||||
= f.input :code
|
||||
= f.input :price
|
||||
.control-group class=(@product.errors[:supplier_id].any? ? 'error' : nil)
|
||||
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
|
||||
.controls
|
||||
= f.collection_select :supplier_id, @suppliers, :id, :name, include_blank: nil
|
||||
.form-actions
|
||||
= f.submit nil, class: 'btn btn-primary'
|
||||
'
|
||||
= link_to t("helpers.links.cancel"), admin_products_path, class: 'btn'
|
||||
@@ -0,0 +1,3 @@
|
||||
- model_class = Product
|
||||
.page-header= title :edit, model_class
|
||||
= render 'form'
|
||||
@@ -0,0 +1,28 @@
|
||||
- model_class = Product
|
||||
.page-header= title :index, model_class
|
||||
- if @products.any?
|
||||
table.table.table-striped
|
||||
thead
|
||||
tr
|
||||
th= model_class.human_attribute_name(:name)
|
||||
th= model_class.human_attribute_name(:code)
|
||||
th= model_class.human_attribute_name(:price)
|
||||
th= Supplier.model_name.human
|
||||
th.timestamp= model_class.human_attribute_name(:created_at)
|
||||
th.actions=t 'helpers.actions'
|
||||
tbody
|
||||
- @products.each do |product|
|
||||
tr
|
||||
td.link= link_to product.name, [:admin, product]
|
||||
td= product.code
|
||||
td= product.price
|
||||
td.link= link_to_if product.supplier.present?, product.supplier.try(:name), [:admin, product.supplier]
|
||||
td.timestamp=l product.created_at, format: :short
|
||||
td.actions
|
||||
= link_to t('helpers.links.edit'), [:edit, :admin, product], class: 'btn btn-mini'
|
||||
'
|
||||
= link_to t("helpers.links.destroy"), [:admin, product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
|
||||
- else
|
||||
= no_content_given model_class
|
||||
= link_to t("helpers.links.new"), new_admin_product_path, class: 'btn btn-primary'
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
- model_class = Product
|
||||
.page-header
|
||||
= title :new, model_class
|
||||
= render 'form'
|
||||
@@ -0,0 +1,20 @@
|
||||
- model_class = Product
|
||||
.page-header= title :show, @product
|
||||
|
||||
dl.dl-horizontal.show-list
|
||||
dt= model_class.human_attribute_name(:name)
|
||||
dd= @product.name
|
||||
dt= model_class.human_attribute_name(:code)
|
||||
dd= @product.code
|
||||
dt= model_class.human_attribute_name(:price)
|
||||
dd= @product.price
|
||||
- if @product.supplier.present?
|
||||
dt= Supplier.model_name.human
|
||||
dd= link_to @product.supplier.name, [:admin, @product.supplier]
|
||||
|
||||
.form-actions
|
||||
= link_to t("helpers.links.back"), admin_products_path, class: 'btn'
|
||||
'
|
||||
= link_to t('helpers.links.edit'), [:edit, :admin, @product], class: 'btn'
|
||||
'
|
||||
= link_to t("helpers.links.destroy"), [:admin, @product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
|
||||
Reference in New Issue
Block a user