Add some view structure
This commit is contained in:
@@ -1,35 +1,37 @@
|
||||
= simple_form_for [:suppliers, @product_category], html: {class: 'form-horizontal'} do |f|
|
||||
= form_for [:suppliers, @product_category] do |f|
|
||||
= render 'error_messages', target: @product_category
|
||||
= f.input :name
|
||||
.control-group
|
||||
.form-row
|
||||
.form-label
|
||||
= f.label :name
|
||||
.form-field
|
||||
= f.text_field :name
|
||||
.form-row
|
||||
= hidden_field_tag 'product_category[product_ids][]', ''
|
||||
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
|
||||
.controls
|
||||
.form-label
|
||||
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
|
||||
.form-field
|
||||
- for product in current_supplier.products
|
||||
= check_box_tag "product_category[product_ids][]", product.id, @product_category.product_ids.to_a.include?(product.id), id: "product-checker-#{product.id}"
|
||||
= label_tag "product-checker-#{product.id}", product.display
|
||||
br
|
||||
.control-group
|
||||
= label_tag nil, ProductCategory.human_attribute_name(:week_days), class: 'control-label'
|
||||
.controls
|
||||
.form-row
|
||||
.form-label
|
||||
= label_tag nil, ProductCategory.human_attribute_name(:week_days), class: 'control-label'
|
||||
.form-field.full
|
||||
#week_days-group.btn-group data-toggle="buttons-checkbox"
|
||||
- day_names = week_days.dup; day_names << day_names.shift if current_supplier.week_starts_on_monday?
|
||||
- day_names.each do |day_name|
|
||||
button.week-day-toggle.btn type="button" data-day=day_name data-t="product_category.week_days.abbreviation.#{day_name}"
|
||||
button.week-day-toggle.tiny type="button" data-day=day_name data-t="product_category.week_days.abbreviation.#{day_name}"
|
||||
|
||||
|
||||
span#full_day-controller
|
||||
#sub-day-container.hide
|
||||
= f.input_field :start_from, as: :select, collection: (1..24).map{|h| ["#{h}:00", h*60]}
|
||||
= f.input_field :end_on, as: :select, collection: (1..24).map{|h| ["#{h}:00", h*60]}
|
||||
/= f.input_field :start_from, as: :select, collection: (1..24).map{|h| ["#{h}:00", h*60]}
|
||||
/= f.input_field :end_on, as: :select, collection: (1..24).map{|h| ["#{h}:00", h*60]}
|
||||
.hidden
|
||||
- @product_category.week_days.each.with_index do |day, i|
|
||||
= select_tag 'product_category[week_days][]', options_for_select([0,1], day), class: 'week-day-select', id: "week-day-select-#{week_days[i]}", data: {day: week_days[i] }
|
||||
/= f.input :full_day, as: :select, collection: [true, false], label: false, include_blank: false
|
||||
= f.input_field :full_day, as: :boolean, label: false, wrapper: false
|
||||
/= f.input_field :full_day, as: :boolean, label: false, wrapper: false
|
||||
/= f.check_box :full_day
|
||||
|
||||
.form-actions
|
||||
= f.button :submit, class: 'btn-primary'
|
||||
'
|
||||
= link_to t("helpers.links.cancel"), suppliers_product_categories_path, class: 'btn'
|
||||
= f.supplier_form_actions
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
span.name= link_to product_category.name, [:suppliers, product_category]
|
||||
span= product_category.visible_on
|
||||
.pull-right.actions
|
||||
= link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini edit-resource-button'
|
||||
'
|
||||
= link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
|
||||
= link_to [:edit, :suppliers, product_category], class: 'table-edit' do
|
||||
span data-title="helpers.links.edit"
|
||||
= link_to [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'table-destroy' do
|
||||
span data-title="helpers.links.destroy"
|
||||
- else
|
||||
= no_content_given model_class
|
||||
.form-actions
|
||||
= link_to t("helpers.links.new"), new_suppliers_product_category_path, class: 'btn btn-primary'
|
||||
= supplier_form_actions :new, for: :product_categories
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
- model_class = ProductCategory
|
||||
.page-header= title :show, @product_category
|
||||
|
||||
dl.dl-horizontal.show-list
|
||||
dt data-t='attributes.product_category.name'= model_class.human_attribute_name(:name)
|
||||
dd= @product_category.name
|
||||
/dt data-t='attributes.product_category.position'= model_class.human_attribute_name(:position)
|
||||
/dd= @product_category.position
|
||||
dt data-t='attributes.product_category.visible_on'= model_class.human_attribute_name(:visible_on)
|
||||
dd= @product_category.visible_on
|
||||
dt data-t='models.plural.product'= Product.model_name.human_plural
|
||||
dd= @product_category.products.map{|product| link_to product.display, suppliers_product_path(product) }.join(', ').html_safe
|
||||
|
||||
|
||||
.form-actions
|
||||
= link_to t("helpers.links.back"), suppliers_product_categories_path, class: 'btn', data: {t: 'helpers.links.back'}
|
||||
'
|
||||
= link_to t('helpers.links.edit'), [:edit, :suppliers, @product_category], class: 'btn', data: {t: 'helpers.links.edit'}
|
||||
'
|
||||
= link_to t("helpers.links.destroy"), [:suppliers, @product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger', data: {t: 'helpers.links.destroy'}
|
||||
.display-row
|
||||
.display-label
|
||||
span data-t='attributes.product_category.name'
|
||||
.display-field
|
||||
span= @product_category.name
|
||||
.display-row
|
||||
.display-label
|
||||
span data-t='attributes.product_category.visible_on'
|
||||
.display-field
|
||||
span= @product_category.visible_on
|
||||
.display-row
|
||||
.display-label
|
||||
span data-t='models.plural.product'
|
||||
.display-field
|
||||
span= @product_category.products.map{|product| link_to product.display, suppliers_product_path(product) }.join(', ').html_safe
|
||||
= supplier_form_actions :index, :edit, :destroy, object: @product_category, for: :product_categories
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
= simple_form_for [:suppliers, @product], html: {class: 'form-horizontal'} do |f|
|
||||
= form_for [:suppliers, @product] do |f|
|
||||
= render 'error_messages', target: @product
|
||||
= f.input :name
|
||||
= f.input :code
|
||||
= f.input :price
|
||||
.control-group
|
||||
.form-row
|
||||
.form-label
|
||||
= f.label :name, data: {t: 'attributes.product.name'}
|
||||
.form-field
|
||||
= f.text_field :name
|
||||
.form-row
|
||||
.form-label
|
||||
= f.label :code, data: {t: 'attributes.product.code'}
|
||||
.form-field
|
||||
= f.text_field :code
|
||||
.form-row
|
||||
.form-label
|
||||
= f.label :price, data: {t: 'attributes.product.price'}
|
||||
.form-field
|
||||
= f.text_field :price
|
||||
/= f.input :name
|
||||
/= f.input :code
|
||||
/= f.input :price
|
||||
.form-row
|
||||
= hidden_field_tag 'product[product_category_ids][]', []
|
||||
= label_tag nil, ProductCategory.model_name.human_plural, class: 'control-label'
|
||||
.controls
|
||||
.form-label
|
||||
= label_tag nil, ProductCategory.model_name.human_plural, class: 'control-label'
|
||||
.form-field
|
||||
- for product_category in current_supplier.product_categories
|
||||
= check_box_tag "product[product_category_ids][]", product_category.id, @product.product_categories.to_a.include?(product_category), id: "product-category-checker-#{product_category.id}"
|
||||
= label_tag "product-category-checker-#{product_category.id}", product_category.name
|
||||
br
|
||||
|
||||
.form-actions
|
||||
= f.button :submit, class: 'btn-primary save-product-button'
|
||||
'
|
||||
= link_to t("helpers.links.cancel"), suppliers_products_path, class: 'btn'
|
||||
= f.supplier_form_actions
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-# DEPRICATED
|
||||
= form_for [:suppliers, @section], html: {class: 'form-horizontal' } do |f|
|
||||
= render 'error_messages', target: @section
|
||||
.control-group class=(@section.errors[:title].any? ? 'error' : nil)
|
||||
@@ -12,10 +13,4 @@
|
||||
= f.label :height, class: 'control-label'
|
||||
.controls
|
||||
= f.text_field :height, class: ['text_field', :numeric]
|
||||
.form-actions
|
||||
= f.submit nil, class: 'btn btn-primary'
|
||||
- unless f.object.new_record?
|
||||
'
|
||||
= link_to t('supplier.tables.qr_codes.link'), qr_codes_suppliers_tables_path(section_id: @section.id), class: 'btn btn-info', data: {t: 'tables.qr_codes.link'}
|
||||
'
|
||||
= link_to t("helpers.links.cancel"), suppliers_sections_path, class: 'btn'
|
||||
= f.supplier_form_actions
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-# DEPRICATED
|
||||
- model_class = Section
|
||||
.page-header
|
||||
= title :edit, model_class
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
- model_class = Section
|
||||
.page-header= title :index, model_class
|
||||
.well
|
||||
- if @sections.any?
|
||||
table.table
|
||||
thead
|
||||
- if @sections.any?
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th.link data-t='attributes.section.title' = model_class.human_attribute_name(:title)
|
||||
th.table-info data-t='models.plural.table' = Table.model_name.human_plural
|
||||
th.numeric data-t='attributes.section.width' = model_class.human_attribute_name(:width)
|
||||
th.numeric data-t='attributes.section.height' = model_class.human_attribute_name(:height)
|
||||
th.actions data-t='helpers.actions.title' = t 'helpers.actions.title'
|
||||
tbody
|
||||
- @sections.each do |section|
|
||||
tr
|
||||
th.link data-t='attributes.section.title' = model_class.human_attribute_name(:title)
|
||||
th.table-info data-t='models.plural.table' = Table.model_name.human_plural
|
||||
th.numeric data-t='attributes.section.width' = model_class.human_attribute_name(:width)
|
||||
th.numeric data-t='attributes.section.height' = model_class.human_attribute_name(:height)
|
||||
th.actions data-t='helpers.actions.title' = t 'helpers.actions.title'
|
||||
tbody
|
||||
- @sections.each do |section|
|
||||
tr
|
||||
td.link= link_to section.title, [:suppliers, section]
|
||||
td.table-info
|
||||
span.table-count= section.tables.size
|
||||
span.active-table-count= (@active_table_ids & section.tables.map(&:id)).size
|
||||
td.numeric= section.width
|
||||
td.numeric= section.height
|
||||
td.actions
|
||||
= link_to t('supplier.tables.qr_codes.link'), qr_codes_suppliers_tables_path(section_id: section.id), class: 'btn btn-mini btn-info', data: {t: 'tables.qr_codes.link'}
|
||||
'
|
||||
= link_to t("helpers.links.destroy"), [:suppliers, section], method: :delete, data: {confirm: are_you_sure?, t: 'helpers.links.destroy'}, class: 'btn btn-mini btn-danger'
|
||||
- else
|
||||
= no_content_given model_class
|
||||
.form-actions
|
||||
= link_to new_suppliers_section_path, class: 'form-action-new'
|
||||
span data-t="helpers.links.new"
|
||||
td.link= link_to section.title, [:suppliers, section]
|
||||
td.table-info
|
||||
span.table-count= section.tables.size
|
||||
span.active-table-count= (@active_table_ids & section.tables.map(&:id)).size
|
||||
td.numeric= section.width
|
||||
td.numeric= section.height
|
||||
td.actions
|
||||
= link_to t('supplier.tables.qr_codes.link'), qr_codes_suppliers_tables_path(section_id: section.id), class: 'btn btn-mini btn-info', data: {t: 'tables.qr_codes.link'}
|
||||
'
|
||||
= link_to t("helpers.links.destroy"), [:suppliers, section], method: :delete, data: {confirm: are_you_sure?, t: 'helpers.links.destroy'}, class: 'btn btn-mini btn-danger'
|
||||
- else
|
||||
= no_content_given model_class
|
||||
= supplier_form_actions :new, for: :sections
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-# DEPRICATED
|
||||
- model_class = Section
|
||||
.page-header
|
||||
h1 data-t='section.manage_tables.title' data-t-attributes=%|{"title":"#{@section.title}"}|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-# DEPRICATED
|
||||
- model_class = Section
|
||||
.page-header
|
||||
= title :new, model_class
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-# DEPRICATED
|
||||
- model_class = Section
|
||||
- content_for :head do
|
||||
= javascript_include_tag 'supplier/app/application'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-# DEPRICATED
|
||||
ul#table-actions-list
|
||||
- if @list
|
||||
- if @list.needs_help?
|
||||
|
||||
@@ -8,7 +8,4 @@
|
||||
= f.label :section_id, Section.model_name.human, class: 'control-label', data: {t: 'models.section'}
|
||||
.controls
|
||||
= f.collection_select :section_id, current_supplier.sections, :id, :title, include_blank: "[#{t('supplier.tables.has_no_section')}]"
|
||||
.form-actions
|
||||
= f.submit nil, class: 'btn btn-primary save-table-button'
|
||||
'
|
||||
= link_to t("helpers.links.cancel"), suppliers_tables_path, class: 'btn'
|
||||
= f.supplier_form_actions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- model_class = Table
|
||||
.page-header
|
||||
= title :edit, model_class
|
||||
= render 'form'
|
||||
= render 'form'
|
||||
|
||||
@@ -30,8 +30,6 @@ div.page-header= title :index, model_class
|
||||
- else
|
||||
= no_content_given model_class
|
||||
|
||||
.form-actions
|
||||
= link_to new_suppliers_table_path, class: 'form-action-new'
|
||||
span data-t="helpers.links.new"
|
||||
= supplier_form_actions :new, for: :tables do
|
||||
= link_to qr_codes_suppliers_tables_path(params.slice(:from_number, :to_number)), class: 'form-action-qr-codes', target: :_blank
|
||||
span data-t="tables.qr_codes.link"
|
||||
|
||||
@@ -7,11 +7,4 @@ dl.dl-horizontal.show-list
|
||||
- if @table.section.present?
|
||||
dt= Section.model_name.human
|
||||
dd= link_to @table.section.title, [:suppliers, @table.section]
|
||||
//= supplier_form_actions :index, :edit, :destroy, object: @table, for: :tables
|
||||
.form-actions
|
||||
= link_to [:suppliers, :tables], class: 'form-action-index'
|
||||
span data-t="helpers.links.index"
|
||||
= link_to [:edit, :suppliers, @table], class: 'form-action-edit'
|
||||
span data-t="helpers.links.edit"
|
||||
= link_to [:suppliers, @table], method: :delete, data: {confirm: are_you_sure? }, class: 'form-action-destroy'
|
||||
span data-t="helpers.links.destroy"
|
||||
= supplier_form_actions :index, :edit, :destroy, object: @table, for: :tables
|
||||
|
||||
Reference in New Issue
Block a user