big refactor for test and admin namespace

This commit is contained in:
2012-12-04 18:45:18 +01:00
parent 7d64ab2022
commit d8eef4a047
85 changed files with 1403 additions and 1272 deletions
+14
View File
@@ -0,0 +1,14 @@
= simple_form_for [:admin, @order], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @order
.control-group class=(@order.errors[:state].any? ? 'error' : nil)
= f.label :state, class: 'control-label'
.controls
= f.text_field :state, class: 'text_field'
.control-group class=(@order.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_orders_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Order
.page-header
= title :edit, model_class
= render 'form'
+24
View File
@@ -0,0 +1,24 @@
- model_class = Order
div.page-header= title :index, model_class
- if @orders.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:state)
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @orders.each do |order|
tr
td= link_to order.state, [:admin, order]
td= link_to_if order.supplier.present?, order.supplier.try(:name), [:admin, order.supplier]
td=l order.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, :admin, order], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, order], 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_order_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Order
.page-header
= title :new, model_class
= render 'form'
+16
View File
@@ -0,0 +1,16 @@
- model_class = Order
.page-header= title :show, @order
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:state)
dd= @order.state
- if @order.supplier.present?
dt= Supplier.model_name.human
dd= link_to @order.supplier.name, [:admin, @order.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_orders_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @order], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @order], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'