continuing the refactor of the admin section

This commit is contained in:
2012-12-05 01:14:13 +01:00
parent d8eef4a047
commit fe7c061d37
47 changed files with 752 additions and 123 deletions
+30
View File
@@ -0,0 +1,30 @@
= form_for [:admin, @list], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @list
.control-group class=(@list.errors[:state].any? ? 'error' : nil)
= f.label :state, class: 'control-label'
.controls
= f.text_field :state, class: 'text_field'
.control-group class=(@list.errors[:needs_help].any? ? 'error' : nil)
= f.label :needs_help, class: 'control-label'
.controls
= f.check_box :needs_help, class: 'check_box'
.control-group class=(@list.errors[:needs_payment].any? ? 'error' : nil)
= f.label :needs_payment, class: 'control-label'
.controls
= f.check_box :needs_payment, class: 'check_box'
.control-group class=(@list.errors[:closed_at].any? ? 'error' : nil)
= f.label :closed_at, class: 'control-label'
.controls
= f.text_field :closed_at, class: 'text_field'
.control-group class=(@list.errors[:table_id].any? ? 'error' : nil)
= f.label :table_id, Table.model_name.human, class: 'control-label'
.controls
= f.collection_select :table_id, @tables, :id, :number, include_blank: nil
.control-group class=(@list.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_lists_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = List
.page-header
= title :edit, model_class
= render 'form'
+32
View File
@@ -0,0 +1,32 @@
- model_class = List
div.page-header= title :index, model_class
- if @lists.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:state)
th= model_class.human_attribute_name(:needs_help)
th= model_class.human_attribute_name(:needs_payment)
th= model_class.human_attribute_name(:closed_at)
th= Table.model_name.human
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @lists.each do |list|
tr
td= link_to list.state, [:admin, list]
td= show_boolean list.needs_help
td= show_boolean list.needs_payment
td= list.closed_at
td= link_to_if list.table.present?, list.table.try(:number), [:admin, list.table]
td= link_to list.supplier.name, [:admin, list.supplier]
td=l list.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, :admin, list], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, list], 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_list_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = List
.page-header
= title :new, model_class
= render 'form'
+24
View File
@@ -0,0 +1,24 @@
- model_class = List
.page-header= title :show, @list
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:state)
dd= @list.state
dt= model_class.human_attribute_name(:needs_help)
dd= @list.needs_help
dt= model_class.human_attribute_name(:needs_payment)
dd= @list.needs_payment
dt= model_class.human_attribute_name(:closed_at)
dd= @list.closed_at
- if @list.table.present?
dt= Table.model_name.human
dd= link_to @list.table.number, [:admin, @list.table]
dt= Supplier.model_name.human
dd= link_to @list.supplier.name, [:admin, @list.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_lists_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @list], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @list], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
@@ -0,0 +1,12 @@
= simple_form_for [:admin, @product_category], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @product_category
= f.input :name
= f.input :position
.control-group class=(@product_category.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_product_categories_path, class: 'btn'
@@ -0,0 +1,3 @@
- model_class = ProductCategory
.page-header= title :edit, model_class
= render 'form'
@@ -0,0 +1,26 @@
- model_class = ProductCategory
.page-header= title :index, model_class
- if @product_categories.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:position)
th= Supplier.model_name.human
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, [:admin, product_category]
td= product_category.position
td.link= link_to product_category.supplier.name, [:admin, product_category.supplier]
td.timestamp=l product_category.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :admin, product_category], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, product_category], 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_category_path, class: 'btn btn-primary'
@@ -0,0 +1,3 @@
- model_class = ProductCategory
.page-header= title :new, model_class
= render 'form'
@@ -0,0 +1,17 @@
- model_class = ProductCategory
.page-header= title :show, @product_category
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:name)
dd= @product_category.name
dt= model_class.human_attribute_name(:position)
dd= @product_category.position
dt= Supplier.model_name.human
dd= link_to @product_category.supplier.name, [:admin, @product_category.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_product_categories_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @product_category], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+11
View File
@@ -0,0 +1,11 @@
= simple_form_for [:admin, @section], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @section
= f.input :title
.control-group class=(@section.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_sections_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Section
.page-header
= title :edit, model_class
= render 'form'
+24
View File
@@ -0,0 +1,24 @@
- model_class = Section
.page-header= title :index, model_class
- if @sections.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:title)
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @sections.each do |section|
tr
td= link_to section.title, [:admin, section]
td= link_to_if section.supplier.present?, section.supplier.try(:name), [:admin, section.supplier]
td=l section.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, :admin, section], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, section], 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_section_path, class: 'btn btn-primary'
+3
View File
@@ -0,0 +1,3 @@
- model_class = Section
.page-header= title :new, model_class
= render 'form'
+17
View File
@@ -0,0 +1,17 @@
- model_class = Section
.page-header= title :show, @section
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:title)
dd= @section.title
dt= model_class.human_attribute_name(:path)
dd= @section.path.to_json
dt= Supplier.model_name.human
dd= link_to @section.supplier.name, [:admin, @section.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_sections_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @section], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'