From 193325f81b4aafecede9c52cf19dd618bde00880 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Thu, 12 Nov 2015 09:52:10 +1100 Subject: [PATCH] Improve formatting around saving on line items index (BOM) --- app/assets/javascripts/templates/admin/save_bar.html.haml | 2 +- app/assets/stylesheets/admin/orders.css.scss | 6 ++++++ app/views/spree/admin/orders/bulk_management.html.haml | 7 +++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/templates/admin/save_bar.html.haml b/app/assets/javascripts/templates/admin/save_bar.html.haml index c028427875..62842f0bfb 100644 --- a/app/assets/javascripts/templates/admin/save_bar.html.haml +++ b/app/assets/javascripts/templates/admin/save_bar.html.haml @@ -1,7 +1,7 @@ #save-bar.animate-show{ ng: { show: 'dirty()' } } .twelve.columns.alpha %h5{ ng: { show: "dirty() && !saving()" } } - You have made unsaved changes + You have unsaved changes %h5{ ng: { hide: "dirty() || saving()" } } All changes saved %h5{ ng: { show: "saving()" } } diff --git a/app/assets/stylesheets/admin/orders.css.scss b/app/assets/stylesheets/admin/orders.css.scss index e8b6e305c6..b6271db230 100644 --- a/app/assets/stylesheets/admin/orders.css.scss +++ b/app/assets/stylesheets/admin/orders.css.scss @@ -8,6 +8,12 @@ input, div { } } +input.show-dirty { + &.ng-dirty { + border: solid 1px orange; + } +} + input, div { &.update-error { border: solid 1px red; diff --git a/app/views/spree/admin/orders/bulk_management.html.haml b/app/views/spree/admin/orders/bulk_management.html.haml index 805d7ebb59..e1e3b96f2e 100644 --- a/app/views/spree/admin/orders/bulk_management.html.haml +++ b/app/views/spree/admin/orders/bulk_management.html.haml @@ -146,14 +146,13 @@ %td.variant{ 'ng-show' => 'columns.variant.visible' } %a{ :href => '#', 'ng-click' => "setSelectedUnitsVariant(line_item.units_product,line_item.units_variant)" } {{ line_item.units_variant.full_name }} %td.quantity{ 'ng-show' => 'columns.quantity.visible' } - %input{ :type => 'number', :name => 'quantity', :id => 'quantity', ng: { model: "line_item.quantity", change: "updateOnQuantity(line_item)", required: "true" }, min: 1, 'obj-for-update' => "line_item", "attr-for-update" => "quantity" } + %input.show-dirty{ :type => 'number', :name => 'quantity', :id => 'quantity', ng: { model: "line_item.quantity", change: "updateOnQuantity(line_item)", required: "true" }, min: 1, step: 1 } %td.max{ 'ng-show' => 'columns.max.visible' } {{ line_item.max_quantity }} %td.final_weight_volume{ 'ng-show' => 'columns.final_weight_volume.visible' } - %input{ :type => 'number', :name => 'final_weight_volume', :id => 'final_weight_volume', ng: { model: "line_item.final_weight_volume", readonly: "unitValueLessThanZero(line_item)", change: "weightAdjustedPrice(line_item)", required: "true" }, min: 0, 'ng-pattern' => '/[1-9]+/', 'obj-for-update' => "line_item", "attr-for-update" => "final_weight_volume" } + %input.show-dirty{ :type => 'number', :name => 'final_weight_volume', :id => 'final_weight_volume', ng: { model: "line_item.final_weight_volume", readonly: "unitValueLessThanZero(line_item)", change: "weightAdjustedPrice(line_item)", required: "true" }, min: 0, 'ng-pattern' => '/[1-9]+/' } %td.price{ 'ng-show' => 'columns.price.visible' } - %input{ :type => 'text', :name => 'price', :id => 'price', :value => '{{ line_item.price * line_item.quantity | currency }}', 'ng-readonly' => "true", 'obj-for-update' => "line_item", "attr-for-update" => "price" } + %input.show-dirty{ :type => 'text', :name => 'price', :id => 'price', :ng => { model: 'line_item.price', readonly: "true" }, 'scale-as-currency' => 'line_item.quantity' } %td.actions %a{ href: "/admin/orders/{{line_item.order.number}}/edit", :class => "edit-order icon-edit no-text", 'confirm-link-click' => 'confirmRefresh()' } %td.actions %a{ 'ng-click' => "deleteLineItem(line_item)", :class => "delete-line-item icon-trash no-text" } - %input{ :type => "button", 'value' => 'Update', 'ng-click' => 'submit()' }