-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
article data UI for new unit handling
- Loading branch information
Ostler, Leonard
committed
Feb 20, 2022
1 parent
16eb988
commit 979eebc
Showing
5 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,41 @@ | ||
-# use the local 'f', or supply 'f_uq' and 'f_unit' for more control (like in balancing) | ||
- content_for :javascript do | ||
:javascript | ||
var parcel = $($.parseHTML("#{escape_javascript(render('shared/parcel'))}")); | ||
var parcels = #{raw @parcels.to_json}; | ||
|
||
$(function() { | ||
$(document).on('touchclick', 'a[data-add-parcel]', function() { | ||
parcel.clone().appendTo('#parcels'); | ||
return false; | ||
}); | ||
|
||
$(document).on('touchclick', 'a[data-remove-parcel]', function() { | ||
$(this).parents('tr').remove(); | ||
return false; | ||
}); | ||
}); | ||
|
||
.fold-line | ||
= (f_uq rescue f).input :unit_quantity, label: Article.human_attribute_name(:unit), | ||
input_html: {class: 'input-mini', title: Article.human_attribute_name(:unit_quantity)} | ||
= (f_unit rescue f).input :unit, label: '×'.html_safe, | ||
input_html: {class: 'input-mini', title: Article.human_attribute_name(:unit)} | ||
= f.input :unit_offered_by_supplier, label: "Unit offered by supplier", input_html: {class: 'input-mini', title: "unit in which article can be ordered from supplier"} | ||
= f.input :unit_description, label: "descr.", input_html: {class: 'input-mini', title: "free text unit"} | ||
= link_to t('.add_content'), '#', 'data-add-parcel' => true, class: 'btn', title: "add content" | ||
.fold-line | ||
= "." | ||
.fold-line | ||
.control-group | ||
%label.control-label{for: 'parcels'} | ||
= "Parcels" | ||
%table#fc_base_price{:class => "controls"} | ||
%tbody | ||
= render :partial => 'shared/parcel', :collection => [1] | ||
.fold-line | ||
= f.input :min_order_quantity, label: "Mininum order quantity" do | ||
.input-append | ||
= f.input_field :min_order_quantity, class: 'input-mini', title: "total minimum order quantity for this article" | ||
/ TODO: replace 'pck' with unit offered by supplier | ||
%span.add-on pck | ||
.fold-line | ||
= f.input :billing_unit, label: "Billing unit", input_html: {class: 'input-small', title: "unit dropdown"} | ||
.fold-line | ||
= f.input :goa_granularity, label: "Allow orders per", input_html: {class: 'input-mini', title: "steps in which ordergroups can order this article"} | ||
= f.input :goa_unit, label: '×'.html_safe, input_html: {class: 'input-small', title: "unit dropdown"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
%tr | ||
%td= text_field_tag 'articles[parcels][unit_quantifier]', nil, class: 'input-mini', title: "unit quantifier" | ||
%td= '×'.html_safe | ||
%td= text_field_tag 'articles[parcels][unit]', nil, class: 'input-mini', title: "unit dropdown" | ||
%td.actions{style: 'width:1em'} | ||
= link_to t('.remove'), method: :delete, 'data-remove-parcel' => true, title: 'remove', class: 'btn btn-danger btn-mini' do | ||
= glyph :remove | ||
%td= link_to t('.add_content'), '#', 'data-add-parcel' => true, class: 'btn btn-small' |