make new article dialog more responsive

This commit is contained in:
wvengen 2013-12-10 16:41:26 +01:00
parent 58de1a231b
commit 85b6ff908b
3 changed files with 41 additions and 25 deletions

View file

@ -248,11 +248,28 @@ tr.unavailable {
margin: 0; margin: 0;
} }
.inline-inputs { // two-column layout in forms (landscape tablet and wider only)
@media (min-width: 768px) {
.form-horizontal .twocol {
.control-group:nth-child(odd) {
float: left;
}
.control-group:nth-child(even) {
.control-label { .control-label {
float: none; width: auto;
display: inline;
vertical-align: middle;
margin: 0 10px; margin: 0 10px;
} }
// fix margin somehow off
// XXX there must be a better way
margin-bottom: 0;
.controls p {
margin-bottom: 20px;
}
}
}
} }
// allow to have indicator text instead of input with same markup
.control-text {
margin-top: 5px;
}

View file

@ -7,35 +7,34 @@
.modal-body .modal-body
= f.input :availability = f.input :availability
= f.input :name = f.input :name
= f.input :unit do .twocol
.inline-inputs = f.input :unit_quantity, label: Article.human_attribute_name(:unit),
= f.input_field :unit_quantity, class: 'input-mini', title: Article.human_attribute_name(:unit_quantity) input_html: {class: 'input-mini', title: Article.human_attribute_name(:unit_quantity)}
× = f.input :unit, label: '×'.html_safe,
= f.input_field :unit, class: 'input-mini', title: Article.human_attribute_name(:unit) input_html: {class: 'input-mini', title: Article.human_attribute_name(:unit)}
= f.input :note = f.input :note
= f.association :article_category = f.association :article_category
/ TODO labels / TODO labels
.twocol
= f.input :price do = f.input :price do
.inline-inputs
.input-prepend .input-prepend
%span.add-on= t 'number.currency.format.unit' %span.add-on= t 'number.currency.format.unit'
= f.input_field :price, class: 'input-mini' = f.input_field :price, class: 'input-mini'
.input-prepend = f.input :tax do
= f.label :tax
.input-append .input-append
= f.input_field :tax, class: 'input-mini' = f.input_field :tax, class: 'input-mini'
%span.add-on % %span.add-on %
= f.input :deposit do = f.input :deposit do
.inline-inputs
.input-prepend .input-prepend
%span.add-on= t 'number.currency.format.unit' %span.add-on= t 'number.currency.format.unit'
= f.input_field :deposit, class: 'input-mini' = f.input_field :deposit, class: 'input-mini'
%span#gross_price{style: 'margin-left: 10px'} .control-group
%label.control-label{for: 'article_fc_price'}
= Article.human_attribute_name(:fc_price) = Article.human_attribute_name(:fc_price)
%span#fc_price= number_to_currency(@article.fc_price) rescue nil .controls.control-text#article_fc_price
= number_to_currency(@article.fc_price) rescue nil
= f.input :origin = f.input :origin
= f.input :manufacturer = f.input :manufacturer
@ -53,5 +52,5 @@
// Article#gross_price and Article#fc_price // Article#gross_price and Article#fc_price
var gross_price = (price + deposit) * (tax / 100 + 1); var gross_price = (price + deposit) * (tax / 100 + 1);
var fc_price = gross_price * (#{FoodsoftConfig[:price_markup].to_f} / 100 + 1); var fc_price = gross_price * (#{FoodsoftConfig[:price_markup].to_f} / 100 + 1);
$('#fc_price').html($.isNumeric(fc_price) ? I18n.l("currency", fc_price) : '…'); $('#article_fc_price').html($.isNumeric(fc_price) ? I18n.l("currency", fc_price) : '…');
}); });

View file

@ -1341,7 +1341,7 @@ en:
default_message: Errors were found. Please check the form. default_message: Errors were found. Please check the form.
hints: hints:
article: article:
unit: ! 'For example: KG or 1L or 500g' unit: e.g. KG or 1L or 500g
message: message:
private: Message doesnt show in Foodsoft mail inbox private: Message doesnt show in Foodsoft mail inbox
order_article: order_article: