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'
+13
View File
@@ -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'
+3
View File
@@ -0,0 +1,3 @@
- model_class = Product
.page-header= title :edit, model_class
= render 'form'
+28
View File
@@ -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'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Product
.page-header
= title :new, model_class
= render 'form'
+20
View File
@@ -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'
+50
View File
@@ -0,0 +1,50 @@
= form_for @supplier, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @supplier
.control-group class=(@supplier.errors[:email].any? ? 'error' : nil)
= f.label :email, class: 'control-label'
.controls
= f.text_field :email, class: 'text_field'
.control-group class=(@supplier.errors[:encrypted_password].any? ? 'error' : nil)
= f.label :encrypted_password, class: 'control-label'
.controls
= f.text_field :encrypted_password, class: 'text_field'
.control-group class=(@supplier.errors[:remember_created_at].any? ? 'error' : nil)
= f.label :remember_created_at, class: 'control-label'
.controls
= f.text_field :remember_created_at, class: 'text_field'
.control-group class=(@supplier.errors[:reset_password_token].any? ? 'error' : nil)
= f.label :reset_password_token, class: 'control-label'
.controls
= f.text_field :reset_password_token, class: 'text_field'
.control-group class=(@supplier.errors[:reset_password_sent_at].any? ? 'error' : nil)
= f.label :reset_password_sent_at, class: 'control-label'
.controls
= f.text_field :reset_password_sent_at, class: 'text_field'
.control-group class=(@supplier.errors[:sign_in_count].any? ? 'error' : nil)
= f.label :sign_in_count, class: 'control-label'
.controls
= f.text_field :sign_in_count, class: 'text_field'
.control-group class=(@supplier.errors[:current_sign_in_at].any? ? 'error' : nil)
= f.label :current_sign_in_at, class: 'control-label'
.controls
= f.text_field :current_sign_in_at, class: 'text_field'
.control-group class=(@supplier.errors[:last_sign_in_at].any? ? 'error' : nil)
= f.label :last_sign_in_at, class: 'control-label'
.controls
= f.text_field :last_sign_in_at, class: 'text_field'
.control-group class=(@supplier.errors[:current_sign_in_ip].any? ? 'error' : nil)
= f.label :current_sign_in_ip, class: 'control-label'
.controls
= f.text_field :current_sign_in_ip, class: 'text_field'
.control-group class=(@supplier.errors[:last_sign_in_ip].any? ? 'error' : nil)
= f.label :last_sign_in_ip, class: 'control-label'
.controls
= f.text_field :last_sign_in_ip, class: 'text_field'
.control-group class=(@supplier.errors[:name].any? ? 'error' : nil)
= f.label :name, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), suppliers_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Supplier
.page-header
= title :edit, model_class
= render 'form'
+24
View File
@@ -0,0 +1,24 @@
- model_class = Supplier
.page-header= title :index, model_class
- if @suppliers.any?
table.table.table-striped.table-hover
thead
tr
th= model_class.human_attribute_name(:email)
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @suppliers.each do |supplier|
tr
td= link_to supplier.email, [:admin, supplier]
td= supplier.name
td=l supplier.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, :admin, supplier], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, supplier], 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_supplier_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Supplier
.page-header
= title :new, model_class
= render 'form'
+33
View File
@@ -0,0 +1,33 @@
- model_class = Supplier
.page-header= title :show, @supplier
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:name)
dd= @supplier.name
dt= model_class.human_attribute_name(:email)
dd= @supplier.email
dt= model_class.human_attribute_name(:encrypted_password)
dd= @supplier.encrypted_password
dt= model_class.human_attribute_name(:remember_created_at)
dd= @supplier.remember_created_at
dt= model_class.human_attribute_name(:reset_password_token)
dd= @supplier.reset_password_token
dt= model_class.human_attribute_name(:reset_password_sent_at)
dd= @supplier.reset_password_sent_at
dt= model_class.human_attribute_name(:sign_in_count)
dd= @supplier.sign_in_count
dt= model_class.human_attribute_name(:current_sign_in_at)
dd= @supplier.current_sign_in_at
dt= model_class.human_attribute_name(:last_sign_in_at)
dd= @supplier.last_sign_in_at
dt= model_class.human_attribute_name(:current_sign_in_ip)
dd= @supplier.current_sign_in_ip
dt= model_class.human_attribute_name(:last_sign_in_ip)
dd= @supplier.last_sign_in_ip
.form-actions
= link_to t("helpers.links.back"), admin_suppliers_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @supplier], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @supplier], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+11
View File
@@ -0,0 +1,11 @@
= simple_form_for [:admin, @table], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @table
= f.input :number
.control-group class=(@table.errors[:supplier_id].any? ? 'error' : nil)
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
.controls
= f.select :supplier_id, options_for_select(@suppliers.map{|a| [a.name, a.id]}), include_blank: nil
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), admin_tables_path, class: 'btn'
+3
View File
@@ -0,0 +1,3 @@
- model_class = Table
.page-header= title :edit, model_class
= render 'form'
+24
View File
@@ -0,0 +1,24 @@
- model_class = Table
div.page-header= title :index, model_class
- if @tables.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:number)
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @tables.each do |table|
tr
td= link_to table.number, [:admin, table]
td= link_to table.supplier.name, [:admin, table.supplier]
td=l table.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, :admin, table], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, table], 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_table_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Table
.page-header
= title :new, model_class
= render 'form'
+16
View File
@@ -0,0 +1,16 @@
- model_class = Table
.page-header= title :show, @table
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:number)
dd= @table.number
- if @table.supplier.present?
dt= Supplier.model_name.human
dd= link_to @table.supplier.name, [:admin, @table.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_tables_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @table], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+7
View File
@@ -0,0 +1,7 @@
= simple_form_for [:admin, @user], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @user
= f.input :email
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), admin_users_path, class: 'btn'
+3
View File
@@ -0,0 +1,3 @@
- model_class = User
.page-header= title :edit, model_class
= render 'form'
+22
View File
@@ -0,0 +1,22 @@
- model_class = User
.page-header= title :index, model_class
- if @users.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:email)
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @users.each do |user|
tr
td= link_to user.email, [:admin, user]
td=l user.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, :admin, user], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, user], 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_user_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = User
.page-header
= title :new, model_class
= render 'form'
+31
View File
@@ -0,0 +1,31 @@
- model_class = User
.page-header= title :show, @user
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:email)
dd= @user.email
dt= model_class.human_attribute_name(:encrypted_password)
dd= @user.encrypted_password
dt= model_class.human_attribute_name(:remember_created_at)
dd= @user.remember_created_at
dt= model_class.human_attribute_name(:reset_password_token)
dd= @user.reset_password_token
dt= model_class.human_attribute_name(:reset_password_sent_at)
dd= @user.reset_password_sent_at
dt= model_class.human_attribute_name(:sign_in_count)
dd= @user.sign_in_count
dt= model_class.human_attribute_name(:current_sign_in_at)
dd= @user.current_sign_in_at
dt= model_class.human_attribute_name(:last_sign_in_at)
dd= @user.last_sign_in_at
dt= model_class.human_attribute_name(:current_sign_in_ip)
dd= @user.current_sign_in_ip
dt= model_class.human_attribute_name(:last_sign_in_ip)
dd= @user.last_sign_in_ip
.form-actions
= link_to t("helpers.links.back"), admin_users_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @user], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @user], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'