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
@@ -1,4 +1,4 @@
= form_for @list, html: {class: 'form-horizontal' } do |f|
= 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'
@@ -27,4 +27,4 @@
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), lists_path, class: 'btn'
= link_to t("helpers.links.cancel"), admin_lists_path, class: 'btn'
@@ -15,18 +15,18 @@ div.page-header= title :index, model_class
tbody
- @lists.each do |list|
tr
td= link_to list.state, list
td= list.needs_help
td= list.needs_payment
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), list.table
td= link_to_if list.supplier.present?, list.supplier.try(:name), list.supplier
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, list], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, list], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), list, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= 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_list_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_list_path, class: 'btn btn-primary'
@@ -12,14 +12,13 @@ dl.dl-horizontal.show-list
dd= @list.closed_at
- if @list.table.present?
dt= Table.model_name.human
dd= link_to @list.table.number, @list.table
- if @list.supplier.present?
dt= Supplier.model_name.human
dd= link_to @list.supplier.name, @list.supplier
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"), lists_path, class: 'btn'
= link_to t("helpers.links.back"), admin_lists_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @list], class: 'btn'
= link_to t('helpers.links.edit'), [:edit, :admin, @list], class: 'btn'
'
= link_to t("helpers.links.destroy"), @list, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
= 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'
@@ -1,4 +1,3 @@
- model_class = ProductCategory
.page-header
= title :edit, model_class
.page-header= title :edit, model_class
= render 'form'
@@ -12,15 +12,15 @@
tbody
- @product_categories.each do |product_category|
tr
td.link= link_to product_category.name, product_category
td.link= link_to product_category.name, [:admin, product_category]
td= product_category.position
td.link= link_to_if product_category.supplier.present?, product_category.supplier.try(:name), product_category.supplier
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, product_category], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, product_category], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), product_category, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= 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_product_category_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_product_category_path, class: 'btn btn-primary'
@@ -1,4 +1,3 @@
- model_class = ProductCategory
.page-header
= title :new, model_class
.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'
@@ -5,22 +5,20 @@
thead
tr
th= model_class.human_attribute_name(:title)
th= model_class.human_attribute_name(:path)
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, section
td= section.path
td= link_to_if section.supplier.present?, section.supplier.try(:name), section.supplier
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, section], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, section], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), section, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= 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_section_path, class: 'btn btn-primary'
= 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'
@@ -35,6 +35,7 @@ html lang="en"
b.caret
ul.child-menu.dropdown-menu
li= link_to Supplier.model_name.human_plural, admin_suppliers_path
li= link_to Section.model_name.human_plural, admin_sections_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
@@ -1,18 +0,0 @@
= form_for @product_category, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @product_category
.control-group class=(@product_category.errors[:name].any? ? 'error' : nil)
= f.label :name, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.control-group class=(@product_category.errors[:position].any? ? 'error' : nil)
= f.label :position, class: 'control-label'
.controls
= f.text_field :position, class: 'text_field'
.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"), product_categories_path, class: 'btn'
@@ -1,18 +0,0 @@
- 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
- if @product_category.supplier.present?
dt= Supplier.model_name.human
dd= link_to @product_category.supplier.name, @product_category.supplier
.form-actions
= link_to t("helpers.links.back"), product_categories_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @product_category], class: 'btn'
'
= link_to t("helpers.links.destroy"), @product_category, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
-18
View File
@@ -1,18 +0,0 @@
= form_for @section, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @section
.control-group class=(@section.errors[:title].any? ? 'error' : nil)
= f.label :title, class: 'control-label'
.controls
= f.text_field :title, class: 'text_field'
.control-group class=(@section.errors[:path].any? ? 'error' : nil)
= f.label :path, class: 'control-label'
.controls
= f.text_field :path, class: 'text_field'
.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"), sections_path, class: 'btn'
-4
View File
@@ -1,4 +0,0 @@
- model_class = Section
.page-header
= title :new, model_class
= render 'form'
-18
View File
@@ -1,18 +0,0 @@
- 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
- if @section.supplier.present?
dt= Supplier.model_name.human
dd= link_to @section.supplier.name, @section.supplier
.form-actions
= link_to t("helpers.links.back"), sections_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @section], class: 'btn'
'
= link_to t("helpers.links.destroy"), @section, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'