Add some view structure
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
@import ./foundation_and_overrides
|
||||||
|
|
||||||
|
.display-row
|
||||||
|
@extend .row
|
||||||
|
.display-label
|
||||||
|
font-weight: bold
|
||||||
|
@media #{$small-only}
|
||||||
|
+grid-column($columns:10, $center:true)
|
||||||
|
@media #{$medium-only}
|
||||||
|
+grid-column($columns:4, $offset:1)
|
||||||
|
@media #{$large-up}
|
||||||
|
+grid-column(3)
|
||||||
|
.display-field
|
||||||
|
@media #{$small-only}
|
||||||
|
+grid-column($columns:10, $center:true, $last-column:true)
|
||||||
|
@media #{$medium-only}
|
||||||
|
+grid-column($columns:4, $last-column:true)
|
||||||
|
@media #{$large-up}
|
||||||
|
+grid-column($columns: 3, $last-column:true)
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
@import font-awesome
|
@import font-awesome
|
||||||
@import ./foundation_and_overrides
|
@import ./foundation_and_overrides
|
||||||
.form-actions
|
.form-actions
|
||||||
|
.form-action-submit
|
||||||
|
+button($bg: $button-submit-color, $padding: $button-sml)
|
||||||
|
margin-right: $button-margin
|
||||||
a
|
a
|
||||||
&.form-action-index
|
&.form-action-index
|
||||||
+button($bg: $button-index-color, $padding: $button-sml)
|
+button($bg: $button-index-color, $padding: $button-sml)
|
||||||
@@ -13,6 +16,8 @@
|
|||||||
margin-right: $button-margin
|
margin-right: $button-margin
|
||||||
&.form-action-destroy
|
&.form-action-destroy
|
||||||
+button($bg: $button-destroy-color, $padding: $button-sml)
|
+button($bg: $button-destroy-color, $padding: $button-sml)
|
||||||
|
&.form-action-cancel
|
||||||
|
+button($bg: $button-cancel-color, $padding: $button-sml)
|
||||||
&.form-action-qr-codes
|
&.form-action-qr-codes
|
||||||
+button($bg: $button-qr-code-color, $padding: $button-sml)
|
+button($bg: $button-qr-code-color, $padding: $button-sml)
|
||||||
span
|
span
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
@import ./foundation_and_overrides
|
||||||
|
|
||||||
|
.form-row
|
||||||
|
@extend .row
|
||||||
|
.form-label
|
||||||
|
@media #{$small-only}
|
||||||
|
+grid-column($columns:10, $center:true)
|
||||||
|
@media #{$medium-only}
|
||||||
|
+grid-column($columns:4, $offset:1)
|
||||||
|
@media #{$large-up}
|
||||||
|
+grid-column(3)
|
||||||
|
.form-field
|
||||||
|
@media #{$small-only}
|
||||||
|
+grid-column($columns:10, $center:true, $last-column:true)
|
||||||
|
@media #{$medium-only}
|
||||||
|
+grid-column($columns:4, $last-column:true)
|
||||||
|
@media #{$large-up}
|
||||||
|
+grid-column($columns: 3, $last-column:true)
|
||||||
|
&.full
|
||||||
|
@media #{$large-up}
|
||||||
|
+grid-column($columns: 9, $last-column:true)
|
||||||
@@ -1255,4 +1255,6 @@ $button-index-color: $secondary-color
|
|||||||
$button-new-color: #afa
|
$button-new-color: #afa
|
||||||
$button-edit-color: #ffa
|
$button-edit-color: #ffa
|
||||||
$button-destroy-color: #faa
|
$button-destroy-color: #faa
|
||||||
|
$button-submit-color: $primary-color
|
||||||
|
$button-cancel-color: $secondary-color
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ table
|
|||||||
+table-fit
|
+table-fit
|
||||||
th.status-icons, td.status-icons
|
th.status-icons, td.status-icons
|
||||||
+table-fit
|
+table-fit
|
||||||
.table-edit
|
.table-edit
|
||||||
+button($bg: $secondary-color)
|
+button($bg: $secondary-color)
|
||||||
+button-icon-only
|
+button-icon-only
|
||||||
span
|
span
|
||||||
@extend .fa
|
@extend .fa
|
||||||
@extend .fa-pencil
|
@extend .fa-pencil
|
||||||
.table-destroy
|
.table-destroy
|
||||||
+button($bg: $secondary-color)
|
+button($bg: $secondary-color)
|
||||||
+button-icon-only
|
+button-icon-only
|
||||||
color: $warning-color
|
color: $warning-color
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
before_action :set_locale
|
before_action :set_locale
|
||||||
|
if Rails.env.development?
|
||||||
|
before_action :force_reloads
|
||||||
|
end
|
||||||
layout :layout_by_resource
|
layout :layout_by_resource
|
||||||
#protect_from_forgery
|
#protect_from_forgery
|
||||||
|
|
||||||
@@ -66,4 +69,8 @@ private
|
|||||||
format.json { render json: {ok: false}, status: 404 }
|
format.json { render json: {ok: false}, status: 404 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def force_reloads
|
||||||
|
load Rails.root.join('config/initializers/custom_form_builder.rb')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
module SuppliersHelper
|
||||||
|
def supplier_form_actions(*actions, &block)
|
||||||
|
options = actions.extract_options!
|
||||||
|
object = options[:object]
|
||||||
|
target = options[:for]
|
||||||
|
elements = []
|
||||||
|
actions.each do |action|
|
||||||
|
if action == :index
|
||||||
|
elements << link_to(content_tag(:span, nil, data: {t: 'helpers.links.index'}), [:suppliers, target], class: 'form-action-index')
|
||||||
|
elsif action == :new
|
||||||
|
elements << link_to(content_tag(:span, nil, data: {t: 'helpers.links.new'}), [:new, :suppliers, target.to_s.singularize], class: 'form-action-new')
|
||||||
|
elsif action == :edit
|
||||||
|
elements << link_to(content_tag(:span, nil, data: {t: 'helpers.links.edit'}), [:edit, :suppliers, object], class: 'form-action-edit')
|
||||||
|
elsif action == :destroy
|
||||||
|
elements << link_to(
|
||||||
|
content_tag(:span, nil, data: {t: 'helpers.links.destroy'}),
|
||||||
|
[:suppliers, object],
|
||||||
|
class: 'form-action-destroy', method: :delete, data: {confirm: are_you_sure? }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elements << capture(&block) if block.present?
|
||||||
|
content_tag(:div, elements.inject(&:+), class: 'form-actions').html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -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
|
= render 'error_messages', target: @product_category
|
||||||
= f.input :name
|
.form-row
|
||||||
.control-group
|
.form-label
|
||||||
|
= f.label :name
|
||||||
|
.form-field
|
||||||
|
= f.text_field :name
|
||||||
|
.form-row
|
||||||
= hidden_field_tag 'product_category[product_ids][]', ''
|
= hidden_field_tag 'product_category[product_ids][]', ''
|
||||||
|
.form-label
|
||||||
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
|
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
|
||||||
.controls
|
.form-field
|
||||||
- for product in current_supplier.products
|
- 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}"
|
= 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
|
= label_tag "product-checker-#{product.id}", product.display
|
||||||
br
|
br
|
||||||
.control-group
|
.form-row
|
||||||
|
.form-label
|
||||||
= label_tag nil, ProductCategory.human_attribute_name(:week_days), class: 'control-label'
|
= label_tag nil, ProductCategory.human_attribute_name(:week_days), class: 'control-label'
|
||||||
.controls
|
.form-field.full
|
||||||
#week_days-group.btn-group data-toggle="buttons-checkbox"
|
#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 = week_days.dup; day_names << day_names.shift if current_supplier.week_starts_on_monday?
|
||||||
- day_names.each do |day_name|
|
- 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
|
span#full_day-controller
|
||||||
#sub-day-container.hide
|
#sub-day-container.hide
|
||||||
= f.input_field :start_from, 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]}
|
/= f.input_field :end_on, as: :select, collection: (1..24).map{|h| ["#{h}:00", h*60]}
|
||||||
.hidden
|
.hidden
|
||||||
- @product_category.week_days.each.with_index do |day, i|
|
- @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] }
|
= 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 :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
|
/= f.check_box :full_day
|
||||||
|
= f.supplier_form_actions
|
||||||
.form-actions
|
|
||||||
= f.button :submit, class: 'btn-primary'
|
|
||||||
'
|
|
||||||
= link_to t("helpers.links.cancel"), suppliers_product_categories_path, class: 'btn'
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
span.name= link_to product_category.name, [:suppliers, product_category]
|
span.name= link_to product_category.name, [:suppliers, product_category]
|
||||||
span= product_category.visible_on
|
span= product_category.visible_on
|
||||||
.pull-right.actions
|
.pull-right.actions
|
||||||
= link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini edit-resource-button'
|
= link_to [:edit, :suppliers, product_category], class: 'table-edit' do
|
||||||
'
|
span data-title="helpers.links.edit"
|
||||||
= link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
|
= link_to [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'table-destroy' do
|
||||||
|
span data-title="helpers.links.destroy"
|
||||||
- else
|
- else
|
||||||
= no_content_given model_class
|
= no_content_given model_class
|
||||||
.form-actions
|
= supplier_form_actions :new, for: :product_categories
|
||||||
= link_to t("helpers.links.new"), new_suppliers_product_category_path, class: 'btn btn-primary'
|
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
- model_class = ProductCategory
|
- model_class = ProductCategory
|
||||||
.page-header= title :show, @product_category
|
.page-header= title :show, @product_category
|
||||||
|
.display-row
|
||||||
dl.dl-horizontal.show-list
|
.display-label
|
||||||
dt data-t='attributes.product_category.name'= model_class.human_attribute_name(:name)
|
span data-t='attributes.product_category.name'
|
||||||
dd= @product_category.name
|
.display-field
|
||||||
/dt data-t='attributes.product_category.position'= model_class.human_attribute_name(:position)
|
span= @product_category.name
|
||||||
/dd= @product_category.position
|
.display-row
|
||||||
dt data-t='attributes.product_category.visible_on'= model_class.human_attribute_name(:visible_on)
|
.display-label
|
||||||
dd= @product_category.visible_on
|
span data-t='attributes.product_category.visible_on'
|
||||||
dt data-t='models.plural.product'= Product.model_name.human_plural
|
.display-field
|
||||||
dd= @product_category.products.map{|product| link_to product.display, suppliers_product_path(product) }.join(', ').html_safe
|
span= @product_category.visible_on
|
||||||
|
.display-row
|
||||||
|
.display-label
|
||||||
.form-actions
|
span data-t='models.plural.product'
|
||||||
= link_to t("helpers.links.back"), suppliers_product_categories_path, class: 'btn', data: {t: 'helpers.links.back'}
|
.display-field
|
||||||
'
|
span= @product_category.products.map{|product| link_to product.display, suppliers_product_path(product) }.join(', ').html_safe
|
||||||
= link_to t('helpers.links.edit'), [:edit, :suppliers, @product_category], class: 'btn', data: {t: 'helpers.links.edit'}
|
= supplier_form_actions :index, :edit, :destroy, object: @product_category, for: :product_categories
|
||||||
'
|
|
||||||
= 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'}
|
|
||||||
|
|||||||
@@ -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
|
= render 'error_messages', target: @product
|
||||||
= f.input :name
|
.form-row
|
||||||
= f.input :code
|
.form-label
|
||||||
= f.input :price
|
= f.label :name, data: {t: 'attributes.product.name'}
|
||||||
.control-group
|
.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][]', []
|
= hidden_field_tag 'product[product_category_ids][]', []
|
||||||
|
.form-label
|
||||||
= label_tag nil, ProductCategory.model_name.human_plural, class: 'control-label'
|
= label_tag nil, ProductCategory.model_name.human_plural, class: 'control-label'
|
||||||
.controls
|
.form-field
|
||||||
- for product_category in current_supplier.product_categories
|
- 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}"
|
= 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
|
= label_tag "product-category-checker-#{product_category.id}", product_category.name
|
||||||
br
|
br
|
||||||
|
|
||||||
.form-actions
|
= f.supplier_form_actions
|
||||||
= f.button :submit, class: 'btn-primary save-product-button'
|
|
||||||
'
|
|
||||||
= link_to t("helpers.links.cancel"), suppliers_products_path, class: 'btn'
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
-# DEPRICATED
|
||||||
= form_for [:suppliers, @section], html: {class: 'form-horizontal' } do |f|
|
= form_for [:suppliers, @section], html: {class: 'form-horizontal' } do |f|
|
||||||
= render 'error_messages', target: @section
|
= render 'error_messages', target: @section
|
||||||
.control-group class=(@section.errors[:title].any? ? 'error' : nil)
|
.control-group class=(@section.errors[:title].any? ? 'error' : nil)
|
||||||
@@ -12,10 +13,4 @@
|
|||||||
= f.label :height, class: 'control-label'
|
= f.label :height, class: 'control-label'
|
||||||
.controls
|
.controls
|
||||||
= f.text_field :height, class: ['text_field', :numeric]
|
= f.text_field :height, class: ['text_field', :numeric]
|
||||||
.form-actions
|
= f.supplier_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'
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
-# DEPRICATED
|
||||||
- model_class = Section
|
- model_class = Section
|
||||||
.page-header
|
.page-header
|
||||||
= title :edit, model_class
|
= title :edit, model_class
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
- model_class = Section
|
- model_class = Section
|
||||||
.page-header= title :index, model_class
|
.page-header= title :index, model_class
|
||||||
.well
|
- if @sections.any?
|
||||||
- if @sections.any?
|
|
||||||
table.table
|
table.table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
@@ -23,8 +22,6 @@
|
|||||||
= 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('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'
|
= 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
|
- else
|
||||||
= no_content_given model_class
|
= no_content_given model_class
|
||||||
.form-actions
|
= supplier_form_actions :new, for: :sections
|
||||||
= link_to new_suppliers_section_path, class: 'form-action-new'
|
|
||||||
span data-t="helpers.links.new"
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
-# DEPRICATED
|
||||||
- model_class = Section
|
- model_class = Section
|
||||||
.page-header
|
.page-header
|
||||||
h1 data-t='section.manage_tables.title' data-t-attributes=%|{"title":"#{@section.title}"}|
|
h1 data-t='section.manage_tables.title' data-t-attributes=%|{"title":"#{@section.title}"}|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
-# DEPRICATED
|
||||||
- model_class = Section
|
- model_class = Section
|
||||||
.page-header
|
.page-header
|
||||||
= title :new, model_class
|
= title :new, model_class
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
-# DEPRICATED
|
||||||
- model_class = Section
|
- model_class = Section
|
||||||
- content_for :head do
|
- content_for :head do
|
||||||
= javascript_include_tag 'supplier/app/application'
|
= javascript_include_tag 'supplier/app/application'
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
-# DEPRICATED
|
||||||
ul#table-actions-list
|
ul#table-actions-list
|
||||||
- if @list
|
- if @list
|
||||||
- if @list.needs_help?
|
- if @list.needs_help?
|
||||||
|
|||||||
@@ -8,7 +8,4 @@
|
|||||||
= f.label :section_id, Section.model_name.human, class: 'control-label', data: {t: 'models.section'}
|
= f.label :section_id, Section.model_name.human, class: 'control-label', data: {t: 'models.section'}
|
||||||
.controls
|
.controls
|
||||||
= f.collection_select :section_id, current_supplier.sections, :id, :title, include_blank: "[#{t('supplier.tables.has_no_section')}]"
|
= f.collection_select :section_id, current_supplier.sections, :id, :title, include_blank: "[#{t('supplier.tables.has_no_section')}]"
|
||||||
.form-actions
|
= f.supplier_form_actions
|
||||||
= f.submit nil, class: 'btn btn-primary save-table-button'
|
|
||||||
'
|
|
||||||
= link_to t("helpers.links.cancel"), suppliers_tables_path, class: 'btn'
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ div.page-header= title :index, model_class
|
|||||||
- else
|
- else
|
||||||
= no_content_given model_class
|
= no_content_given model_class
|
||||||
|
|
||||||
.form-actions
|
= supplier_form_actions :new, for: :tables do
|
||||||
= link_to new_suppliers_table_path, class: 'form-action-new'
|
|
||||||
span data-t="helpers.links.new"
|
|
||||||
= link_to qr_codes_suppliers_tables_path(params.slice(:from_number, :to_number)), class: 'form-action-qr-codes', target: :_blank
|
= 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"
|
span data-t="tables.qr_codes.link"
|
||||||
|
|||||||
@@ -7,11 +7,4 @@ dl.dl-horizontal.show-list
|
|||||||
- if @table.section.present?
|
- if @table.section.present?
|
||||||
dt= Section.model_name.human
|
dt= Section.model_name.human
|
||||||
dd= link_to @table.section.title, [:suppliers, @table.section]
|
dd= link_to @table.section.title, [:suppliers, @table.section]
|
||||||
//= supplier_form_actions :index, :edit, :destroy, object: @table, for: :tables
|
= 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"
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
class CustomFormBuilder < ActionView::Helpers::FormBuilder
|
||||||
|
def supplier_form_actions(options = {})
|
||||||
|
t = @template
|
||||||
|
elements = []
|
||||||
|
elements << submit(nil, class: 'form-action-submit')
|
||||||
|
plural_subject = object.class.name.underscore.pluralize
|
||||||
|
elements << t.link_to(
|
||||||
|
t.content_tag(:span, nil, data: {t: 'helpers.links.cancel'}),
|
||||||
|
[:suppliers, plural_subject],
|
||||||
|
class: 'form-action-cancel'
|
||||||
|
)
|
||||||
|
t.content_tag(:div, elements.inject(&:+), class: 'form-actions')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ActionView::Base.default_form_builder = CustomFormBuilder
|
||||||
Reference in New Issue
Block a user