mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-05 02:41:33 +00:00
Moving taxons into its own module, adding preferred shopfront taxon order to enterprise
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
angular.module("ofn.admin", ["ngResource", "ngAnimate", "ofn.dropdown", "admin.products", "infinite-scroll"]).config ($httpProvider) ->
|
||||
angular.module("ofn.admin", ["ngResource", "ngAnimate", "ofn.dropdown", "admin.products", "admin.taxons", "infinite-scroll"]).config ($httpProvider) ->
|
||||
$httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content")
|
||||
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
//= require ./products/products
|
||||
//= require ./shipping_methods/shipping_methods
|
||||
//= require ./side_menu/side_menu
|
||||
//= require ./taxons/taxons
|
||||
//= require ./utils/utils
|
||||
//= require ./users/users
|
||||
//= require textAngular.min.js
|
||||
|
||||
@@ -1 +1 @@
|
||||
angular.module("admin.enterprises", [
|
||||
angular.module("admin.enterprises", [
|
||||
@@ -1,9 +1,10 @@
|
||||
angular.module("ofn.admin").directive "ofnTaxonAutocomplete", (Taxons) ->
|
||||
angular.module("admin.taxons").directive "ofnTaxonAutocomplete", (Taxons) ->
|
||||
# Adapted from Spree's existing taxon autocompletion
|
||||
scope: true
|
||||
link: (scope,element,attrs) ->
|
||||
multiple = scope.$eval attrs.multipleSelection
|
||||
placeholder = attrs.placeholder
|
||||
initalSelection = scope.$eval attrs.ngModel
|
||||
|
||||
setTimeout ->
|
||||
element.select2
|
||||
@@ -11,9 +12,9 @@ angular.module("ofn.admin").directive "ofnTaxonAutocomplete", (Taxons) ->
|
||||
multiple: multiple
|
||||
initSelection: (element, callback) ->
|
||||
if multiple
|
||||
callback Taxons.findByIDs(scope.product.category_id)
|
||||
callback Taxons.findByIDs(initalSelection)
|
||||
else
|
||||
callback Taxons.findByID(scope.product.category_id)
|
||||
callback Taxons.findByID(initalSelection)
|
||||
query: (query) ->
|
||||
query.callback { results: Taxons.findByTerm(query.term) }
|
||||
formatResult: (taxon) ->
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("ofn.admin").factory "Taxons", (taxons, $filter) ->
|
||||
angular.module("admin.taxons").factory "Taxons", (taxons, $filter) ->
|
||||
new class Taxons
|
||||
constructor: ->
|
||||
@taxons = taxons
|
||||
1
app/assets/javascripts/admin/taxons/taxons.js.coffee
Normal file
1
app/assets/javascripts/admin/taxons/taxons.js.coffee
Normal file
@@ -0,0 +1 @@
|
||||
angular.module("admin.taxons", [])
|
||||
Reference in New Issue
Block a user