From 62ca121db241366655fcff1d5e5f7170c74e951f Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 6 Dec 2013 10:49:06 +1100 Subject: [PATCH] Rename directives to avoid using the ng namespace, which is reserved for angular core --- .../admin/bulk_product_update.js.coffee | 12 +++++----- .../spree/admin/products/bulk_edit.html.haml | 22 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/admin/bulk_product_update.js.coffee b/app/assets/javascripts/admin/bulk_product_update.js.coffee index c2c4a56af7..7cf3907c4d 100644 --- a/app/assets/javascripts/admin/bulk_product_update.js.coffee +++ b/app/assets/javascripts/admin/bulk_product_update.js.coffee @@ -7,7 +7,7 @@ productsApp.config [ ] -productsApp.directive "ngDecimal", -> +productsApp.directive "ofnDecimal", -> require: "ngModel" link: (scope, element, attrs, ngModel) -> numRegExp = /^\d+(\.\d+)?$/ @@ -20,7 +20,7 @@ productsApp.directive "ngDecimal", -> viewValue -productsApp.directive "ngTrackProduct", -> +productsApp.directive "ofnTrackProduct", -> require: "ngModel" link: (scope, element, attrs, ngModel) -> property_name = attrs.ngTrackProduct @@ -31,7 +31,7 @@ productsApp.directive "ngTrackProduct", -> viewValue -productsApp.directive "ngTrackVariant", -> +productsApp.directive "ofnTrackVariant", -> require: "ngModel" link: (scope, element, attrs, ngModel) -> property_name = attrs.ngTrackVariant @@ -45,7 +45,7 @@ productsApp.directive "ngTrackVariant", -> viewValue -productsApp.directive "ngToggleVariants", -> +productsApp.directive "ofnToggleVariants", -> link: (scope, element, attrs) -> if scope.displayProperties[scope.product.id].showVariants element.removeClass "icon-chevron-right" @@ -65,7 +65,7 @@ productsApp.directive "ngToggleVariants", -> element.addClass "icon-chevron-down" -productsApp.directive "ngToggleColumn", -> +productsApp.directive "ofnToggleColumn", -> link: (scope, element, attrs) -> element.addClass "unselected" unless scope.column.visible element.click "click", -> @@ -78,7 +78,7 @@ productsApp.directive "ngToggleColumn", -> element.removeClass "unselected" -productsApp.directive "ngToggleColumnList", [ +productsApp.directive "ofnToggleColumnList", [ "$compile" ($compile) -> return link: (scope, element, attrs) -> diff --git a/app/views/spree/admin/products/bulk_edit.html.haml b/app/views/spree/admin/products/bulk_edit.html.haml index a0a9322ff2..e975cd4923 100644 --- a/app/views/spree/admin/products/bulk_edit.html.haml +++ b/app/views/spree/admin/products/bulk_edit.html.haml @@ -20,10 +20,10 @@ %div.options Filter Results: %input.search{ 'ng-model' => 'query', :type => 'text', 'placeholder' => 'Search Value' } - %input{ :type => 'button', :value => 'Toggle Columns', 'ng-toggle-column-list' => true } + %input{ :type => 'button', :value => 'Toggle Columns', 'ofn-toggle-column-list' => true } %div{ :style => 'display: none;' } %ul.column-list{ style: 'border: 1px solid darkgray; background-color: white;' } - %li.column-list-item{ 'ng-toggle-column' => 'column', 'ng-repeat' => 'column in columns' } + %li.column-list-item{ 'ofn-toggle-column' => 'column', 'ng-repeat' => 'column in columns' } {{ column.name }} %br.clear %br.clear @@ -41,20 +41,20 @@ %tbody{ 'ng-repeat' => 'product in products | filter:query', 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'" } %tr.product %td.left-actions - %a{ 'ng-toggle-variants' => 'true', :class => "view-variants icon-chevron-right", 'ng-show' => 'hasVariants(product)' } + %a{ 'ofn-toggle-variants' => 'true', :class => "view-variants icon-chevron-right", 'ng-show' => 'hasVariants(product)' } %td{ 'ng-show' => 'columns.name.visible' } - %input{ 'ng-model' => "product.name", :name => 'product_name', 'ng-track-product' => 'name', :type => 'text' } + %input{ 'ng-model' => "product.name", :name => 'product_name', 'ofn-track-product' => 'name', :type => 'text' } %td{ 'ng-show' => 'columns.supplier.visible' } - %select.select2{ 'ng-model' => 'product.supplier', :name => 'supplier', 'ng-track-product' => 'supplier', 'ng-options' => 's.name for s in suppliers' } + %select.select2{ 'ng-model' => 'product.supplier', :name => 'supplier', 'ofn-track-product' => 'supplier', 'ng-options' => 's.name for s in suppliers' } %td{ 'ng-show' => 'columns.price.visible' } - %input{ 'ng-model' => 'product.price', 'ng-decimal' => :true, :name => 'price', 'ng-track-product' => 'price', :type => 'text' } + %input{ 'ng-model' => 'product.price', 'ofn-decimal' => :true, :name => 'price', 'ofn-track-product' => 'price', :type => 'text' } %td{ 'ng-show' => 'columns.unit.visible' } - %select.select2{ 'ng-model' => 'product.variant_unit_with_scale', :name => 'variant_unit_with_scale', 'ng-track-product' => 'variant_unit_with_scale', 'ng-options' => 'unit[1] as unit[0] for unit in variant_unit_options' } + %select.select2{ 'ng-model' => 'product.variant_unit_with_scale', :name => 'variant_unit_with_scale', 'ofn-track-product' => 'variant_unit_with_scale', 'ng-options' => 'unit[1] as unit[0] for unit in variant_unit_options' } %td{ 'ng-show' => 'columns.on_hand.visible' } %span{ 'ng-bind' => 'product.on_hand', :name => 'on_hand', 'ng-show' => 'hasVariants(product)' } - %input.field{ 'ng-model' => 'product.on_hand', :name => 'on_hand', 'ng-track-product' => 'on_hand', 'ng-show' => '!hasVariants(product)', :type => 'number' } + %input.field{ 'ng-model' => 'product.on_hand', :name => 'on_hand', 'ofn-track-product' => 'on_hand', 'ng-show' => '!hasVariants(product)', :type => 'number' } %td{ 'ng-show' => 'columns.available_on.visible' } - %input{ 'ng-model' => 'product.available_on', :name => 'available_on', 'ng-track-product' => 'available_on', 'datetimepicker' => 'product.available_on', type: "text" } + %input{ 'ng-model' => 'product.available_on', :name => 'available_on', 'ofn-track-product' => 'available_on', 'datetimepicker' => 'product.available_on', type: "text" } %td.actions %a{ 'ng-click' => 'editWarn(product)', :class => "edit-product icon-edit no-text" } %td.actions @@ -68,9 +68,9 @@ {{ variant.options_text }} %td{ 'ng-show' => 'columns.supplier.visible' } %td{ 'ng-show' => 'columns.price.visible' } - %input{ 'ng-model' => 'variant.price', 'ng-decimal' => :true, :name => 'variant_price', 'ng-track-variant' => 'price', :type => 'text' } + %input{ 'ng-model' => 'variant.price', 'ofn-decimal' => :true, :name => 'variant_price', 'ofn-track-variant' => 'price', :type => 'text' } %td{ 'ng-show' => 'columns.on_hand.visible' } - %input.field{ 'ng-model' => 'variant.on_hand', 'ng-change' => 'updateOnHand(product)', :name => 'variant_on_hand', 'ng-track-variant' => 'on_hand', :type => 'number' } + %input.field{ 'ng-model' => 'variant.on_hand', 'ng-change' => 'updateOnHand(product)', :name => 'variant_on_hand', 'ofn-track-variant' => 'on_hand', :type => 'number' } %td{ 'ng-show' => 'columns.available_on.visible' } %td.actions %a{ 'ng-click' => 'editWarn(product,variant)', :class => "edit-variant icon-edit no-text" }