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
@@ -1,4 +1,4 @@
= form_for @order, html: {class: 'form-horizontal' } do |f|
= 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'
@@ -11,4 +11,4 @@
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), orders_path, class: 'btn'
= link_to t("helpers.links.cancel"), admin_orders_path, class: 'btn'
@@ -11,14 +11,14 @@ div.page-header= title :index, model_class
tbody
- @orders.each do |order|
tr
td= link_to order.state, order
td= link_to_if order.supplier.present?, order.supplier.try(:name), order.supplier
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, order], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, order], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), order, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= 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_order_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_order_path, class: 'btn btn-primary'
+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'
@@ -7,24 +7,22 @@
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:code)
th= model_class.human_attribute_name(:price)
th= ProductCategory.model_name.human
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, product
td.link= link_to product.name, [:admin, product]
td= product.code
td= product.price
td.link= link_to_if product.product_category.present?, product.product_category.try(:name), product.product_category
td.link= link_to_if product.supplier.present?, product.supplier.try(:name), product.supplier
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, product], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, product], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), product, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= 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_product_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_product_path, class: 'btn btn-primary'
+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'
+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'
@@ -2,6 +2,8 @@
.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)
@@ -22,12 +24,10 @@ dl.dl-horizontal.show-list
dd= @supplier.current_sign_in_ip
dt= model_class.human_attribute_name(:last_sign_in_ip)
dd= @supplier.last_sign_in_ip
dt= model_class.human_attribute_name(:name)
dd= @supplier.name
.form-actions
= link_to t("helpers.links.back"), suppliers_path, class: 'btn'
= link_to t("helpers.links.back"), admin_suppliers_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @supplier], class: 'btn'
= link_to t('helpers.links.edit'), [:edit, :admin, @supplier], class: 'btn'
'
= link_to t("helpers.links.destroy"), @supplier, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
= link_to t("helpers.links.destroy"), [:admin, @supplier], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
@@ -1,9 +1,6 @@
= form_for @table, html: {class: 'form-horizontal' } do |f|
= simple_form_for [:admin, @table], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @table
.control-group class=(@table.errors[:number].any? ? 'error' : nil)
= f.label :number, class: 'control-label'
.controls
= f.text_field :number, class: 'text_field'
= 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
@@ -11,4 +8,4 @@
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), tables_path, class: 'btn'
= 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'
@@ -11,14 +11,14 @@ div.page-header= title :index, model_class
tbody
- @tables.each do |table|
tr
td= link_to table.number, table
td= link_to table.supplier.name, table.supplier
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, table], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, table], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), table, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= 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_table_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_table_path, class: 'btn btn-primary'
+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'
@@ -10,13 +10,13 @@
tbody
- @users.each do |user|
tr
td= link_to user.email, user
td= link_to user.email, [:admin, user]
td=l user.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, user], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, user], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), user, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= 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_user_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_user_path, class: 'btn btn-primary'
@@ -24,8 +24,8 @@ dl.dl-horizontal.show-list
dd= @user.last_sign_in_ip
.form-actions
= link_to t("helpers.links.back"), users_path, class: 'btn'
= link_to t("helpers.links.back"), admin_users_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @user], class: 'btn'
= link_to t('helpers.links.edit'), [:edit, :admin, @user], class: 'btn'
'
= link_to t("helpers.links.destroy"), @user, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
= link_to t("helpers.links.destroy"), [:admin, @user], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+23 -10
View File
@@ -10,7 +10,7 @@ html lang="en"
/! Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
= stylesheet_link_tag "application", :media => "all"
= stylesheet_link_tag "admin/application", :media => "all"
link href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144"
link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114"
link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
@@ -25,16 +25,29 @@ html lang="en"
span.icon-bar
span.icon-bar
span.icon-bar
a.brand href=root_path = application_title
a.brand href=admin_root_path = application_title
.container.nav-collapse
ul.nav
li= link_to User.model_name.human_plural, users_path
li= link_to Supplier.model_name.human_plural, suppliers_path
li= link_to Table.model_name.human_plural, tables_path
li= link_to Product.model_name.human_plural, products_path
li= link_to List.model_name.human_plural, lists_path
li= link_to Order.model_name.human_plural, orders_path
li= link_to ProductCategory.model_name.human_plural, product_categories_path
li= link_to User.model_name.human_plural, admin_users_path
li.dropdown
a.dropdown-toggle href="#" data-toggle="dropdown"
span = Supplier.model_name.human_plural
b.caret
ul.child-menu.dropdown-menu
li= link_to Supplier.model_name.human_plural, admin_suppliers_path
li= link_to Table.model_name.human_plural, admin_tables_path
li= link_to Product.model_name.human_plural, admin_products_path
li= link_to List.model_name.human_plural, admin_lists_path
li= link_to Order.model_name.human_plural, admin_orders_path
li= link_to ProductCategory.model_name.human_plural, admin_product_categories_path
- if administrator_signed_in?
.btn-group.pull-right
a.btn.dropdown-toggle[data-toggle="dropdown" href="#"]
i.icon-user
= current_administrator.email
span.caret
ul.dropdown-menu
li.log-out= link_to t('helpers.links.logout'), destroy_administrator_session_path
.container
@@ -55,7 +68,7 @@ html lang="en"
h3= application_title
ul.nav.nav-list
li.nav-header Links
li= link_to "Home", root_path
li= link_to "Qwaiter website", root_path
li= link_to "Companytools", 'http://www.companytools.nl/'
= yield :sidebar
-16
View File
@@ -1,16 +0,0 @@
- 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, @order.supplier
.form-actions
= link_to t("helpers.links.back"), orders_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @order], class: 'btn'
'
= link_to t("helpers.links.destroy"), @order, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
-26
View File
@@ -1,26 +0,0 @@
= form_for @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'
.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'
/.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, @product_categories, :id, :name, include_blank: ''
.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"), products_path, class: 'btn'
-4
View File
@@ -1,4 +0,0 @@
- model_class = Product
.page-header
= title :edit, model_class
= render 'form'
-23
View File
@@ -1,23 +0,0 @@
- 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.product_category.present?
dt= ProductCategory.model_name.human
dd= link_to @product.product_category.name, @product.product_category
- if @product.supplier.present?
dt= Supplier.model_name.human
dd= link_to @product.supplier.name, @product.supplier
.form-actions
= link_to t("helpers.links.back"), products_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @product], class: 'btn'
'
= link_to t("helpers.links.destroy"), @product, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+1 -2
View File
@@ -10,5 +10,4 @@
th.currency= t('supplier.active_lists.price')
th.actions
tbody
script#active-list-template[type="text/html"]= render 'active_list.mustache'
script#active-list-template[type="text/html"]= mustache_template 'active_list'
+1 -1
View File
@@ -10,4 +10,4 @@
th.currency= t('supplier.active_orders.price')
th.actions
tbody
script#active-order-template[type="text/html"]= render 'active_order.mustache'
script#active-order-template[type="text/html"]= mustache_template 'active_order'
-42
View File
@@ -1,42 +0,0 @@
- model_class = Supplier
div.page-header= title :index, model_class
- if @suppliers.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:email)
th= model_class.human_attribute_name(:encrypted_password)
th= model_class.human_attribute_name(:remember_created_at)
th= model_class.human_attribute_name(:reset_password_token)
th= model_class.human_attribute_name(:reset_password_sent_at)
th= model_class.human_attribute_name(:sign_in_count)
th= model_class.human_attribute_name(:current_sign_in_at)
th= model_class.human_attribute_name(:last_sign_in_at)
th= model_class.human_attribute_name(:current_sign_in_ip)
th= model_class.human_attribute_name(:last_sign_in_ip)
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, supplier
td= supplier.encrypted_password
td= supplier.remember_created_at
td= supplier.reset_password_token
td= supplier.reset_password_sent_at
td= supplier.sign_in_count
td= supplier.current_sign_in_at
td= supplier.last_sign_in_at
td= supplier.current_sign_in_ip
td= supplier.last_sign_in_ip
td= supplier.name
td=l supplier.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, supplier], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), 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_supplier_path, class: 'btn btn-primary'
-4
View File
@@ -1,4 +0,0 @@
- model_class = Table
.page-header
= title :edit, model_class
= render 'form'
-16
View File
@@ -1,16 +0,0 @@
- 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, @table.supplier
.form-actions
= link_to t("helpers.links.back"), tables_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @table], class: 'btn'
'
= link_to t("helpers.links.destroy"), @table, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
-46
View File
@@ -1,46 +0,0 @@
= form_for @user, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @user
.control-group class=(@user.errors[:email].any? ? 'error' : nil)
= f.label :email, class: 'control-label'
.controls
= f.text_field :email, class: 'text_field'
.control-group class=(@user.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=(@user.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=(@user.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=(@user.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=(@user.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=(@user.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=(@user.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=(@user.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=(@user.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'
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), users_path, class: 'btn'
-4
View File
@@ -1,4 +0,0 @@
- model_class = User
.page-header
= title :edit, model_class
= render 'form'