Move small close button to helper.

Workaround for show order deface override nuking attributes of the close button.
This commit is contained in:
wvengen 2015-04-10 18:58:51 +02:00
parent cf0fcccfc3
commit 507651f5ba
10 changed files with 18 additions and 12 deletions

View File

@ -233,6 +233,14 @@ module ApplicationHelper
Foodsoft::ExpansionVariables.expand(text, options) Foodsoft::ExpansionVariables.expand(text, options)
end end
# @param dismiss [String, Symbol] Bootstrap dismiss value (modal, alert)
# @return [String] HTML for close button dismissing
def close_button(dismiss)
content_tag :button, type: 'button', class: 'close', data: {dismiss: dismiss} do
I18n.t('ui.marks.close').html_safe
end
end
# @return [String] path to foodcoop CSS style (with MD5 parameter for caching) # @return [String] path to foodcoop CSS style (with MD5 parameter for caching)
def foodcoop_css_path(options={}) def foodcoop_css_path(options={})
super(options.merge({md5: Digest::MD5.hexdigest(FoodsoftConfig[:custom_css].to_s)})) super(options.merge({md5: Digest::MD5.hexdigest(FoodsoftConfig[:custom_css].to_s)}))

View File

@ -2,7 +2,7 @@
= f.hidden_field :shared_updated_on = f.hidden_field :shared_updated_on
= f.hidden_field :supplier_id = f.hidden_field :supplier_id
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = close_button :modal
%h3= @article.new_record? ? t('.title_new') : t('.title_edit') %h3= @article.new_record? ? t('.title_new') : t('.title_edit')
.modal-body .modal-body
= f.input :availability = f.input :availability
@ -22,4 +22,3 @@
.modal-footer .modal-footer
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'} = link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
= f.submit class: 'btn btn-primary' = f.submit class: 'btn btn-primary'

View File

@ -1,10 +1,9 @@
= simple_form_for @order, url: update_note_finance_order_path(@order), remote: true, method: :put do |f| = simple_form_for @order, url: update_note_finance_order_path(@order), remote: true, method: :put do |f|
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = close_button :modal
%h3 Notiz bearbeiten %h3 Notiz bearbeiten
.modal-body .modal-body
= f.input :note, input_html: {class: 'input-xlarge'} = f.input :note, input_html: {class: 'input-xlarge'}
.modal-footer .modal-footer
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'} = link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
= f.submit t('ui.save'), class: 'btn btn-primary' = f.submit t('ui.save'), class: 'btn btn-primary'

View File

@ -1,7 +1,7 @@
= simple_form_for @group_order_article, remote: true do |form| = simple_form_for @group_order_article, remote: true do |form|
= form.hidden_field :order_article_id = form.hidden_field :order_article_id
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = close_button :modal
%h3= t('.amount_change_for', article: @order_article.article.name) %h3= t('.amount_change_for', article: @order_article.article.name)
.modal-body .modal-body
= form.input :ordergroup_id, as: :select, collection: Ordergroup.all.map { |g| [g.name, g.id] } = form.input :ordergroup_id, as: :select, collection: Ordergroup.all.map { |g| [g.name, g.id] }

View File

@ -23,7 +23,7 @@
.row-fluid .row-fluid
.well.pull-left .well.pull-left
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= '×'.html_safe = close_button :alert
%h2= @order.name %h2= @order.name
%dl.dl-horizontal %dl.dl-horizontal
- unless @order.note.blank? - unless @order.note.blank?
@ -47,7 +47,7 @@
%dd= number_to_currency(@ordering_data[:available_funds]) %dd= number_to_currency(@ordering_data[:available_funds])
.well.pull-right .well.pull-right
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= '×'.html_safe = close_button :alert
= render 'switch_order', current_order: @order = render 'switch_order', current_order: @order
.row-fluid .row-fluid

View File

@ -1,6 +1,6 @@
= simple_form_for @invite, remote: true do |form| = simple_form_for @invite, remote: true do |form|
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = close_button :modal
%h3= t '.title' %h3= t '.title'
.modal-body .modal-body
= t('.body', group: @invite.group.name).html_safe = t('.body', group: @invite.group.name).html_safe

View File

@ -1,6 +1,6 @@
= simple_form_for [@order, @order_article], remote: true do |form| = simple_form_for [@order, @order_article], remote: true do |form|
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = close_button :modal
%h3= t '.title' %h3= t '.title'
.modal-body .modal-body
- if params[:without_units] - if params[:without_units]

View File

@ -1,6 +1,6 @@
= simple_form_for [@order, @order_article], remote: true do |form| = simple_form_for [@order, @order_article], remote: true do |form|
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = close_button :modal
%h3= t '.title' %h3= t '.title'
.modal-body .modal-body
= form.association :article, collection: @order.supplier_articles, label_method: lambda {|a| article_label_with_unit(a)} = form.association :article, collection: @order.supplier_articles, label_method: lambda {|a| article_label_with_unit(a)}

View File

@ -1,7 +1,7 @@
- title t('.title', name: @order.name) - title t('.title', name: @order.name)
.well .well
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= t('ui.marks.close').html_safe = close_button :alert
%p %p
= raw t '.description1', = raw t '.description1',
state: t("orders.state.#{@order.state}").capitalize, state: t("orders.state.#{@order.state}").capitalize,

View File

@ -1,6 +1,6 @@
= simple_form_for stock_article, remote: true, :validate => true do |f| = simple_form_for stock_article, remote: true, :validate => true do |f|
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = close_button :modal
%h3= title %h3= title
.modal-body .modal-body
= f.association :supplier = f.association :supplier