mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Moving single line selectors to template, making sure other users of taxons-selector still work
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Darkswarm.directive 'singleLineSelector', ($timeout, $filter) ->
|
||||
Darkswarm.directive 'singleLineSelectors', ($timeout, $filter) ->
|
||||
restrict: 'E'
|
||||
templateUrl: "single_line_selectors.html"
|
||||
link: (scope,element,attrs) ->
|
||||
scope.fitting = false
|
||||
|
||||
|
||||
@@ -45,3 +45,9 @@ Darkswarm.directive "taxonSelector", (FilterSelectorsService)->
|
||||
taxon: taxon
|
||||
selectors.push selector
|
||||
selectors
|
||||
|
||||
scope.ifDefined = (value, if_undefined) ->
|
||||
if angular.isDefined(value)
|
||||
value
|
||||
else
|
||||
if_undefined
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
%ul
|
||||
%taxon-selector{objects: "Products.products | products:query | products:showProfiles",
|
||||
"active-taxons" => "activeTaxons", "taxon-selectors" => "taxonSelectors" }
|
||||
|
||||
%li.more{ ng: { show: "overFlowSelectors().length > 0 || fitting", class: "{active: selectedOverFlowSelectors().length > 0}" } }
|
||||
%a.dropdown{ dropdown: { toggle: "#more-taxons" } }
|
||||
%span
|
||||
+ {{ overFlowSelectors().length }} more
|
||||
%i.ofn-i_052-point-down
|
||||
.f-dropdown.content#more-taxons
|
||||
%ul
|
||||
%active-selector{ ng: { repeat: "selector in overFlowSelectors()", hide: "selector.fits" } }
|
||||
%render-svg{path: "{{selector.taxon.icon}}"}
|
||||
%span {{ selector.taxon.name }}
|
||||
@@ -1,3 +1,3 @@
|
||||
%active-selector{"ng-repeat" => "selector in taxonSelectors", "ng-show" => "selector.fits"}
|
||||
%active-selector{ ng: { repeat: "selector in selectors()", show: "ifDefined(selector.fits, true)" } }
|
||||
%render-svg{path: "{{selector.taxon.icon}}"}
|
||||
%span {{ selector.taxon.name }}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Type
|
||||
%ul.small-block-grid-2.medium-block-grid-4.large-block-grid-5
|
||||
%taxon-selector{objects: "Enterprises.hubs | searchEnterprises:query",
|
||||
results: "activeTaxons"}
|
||||
"active-taxons" => "activeTaxons"}
|
||||
.small-12.large-3.columns
|
||||
%h5.tdhead
|
||||
.light Filter by
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
.light Filter by
|
||||
Type
|
||||
%ul.small-block-grid-2.medium-block-grid-4.large-block-grid-6
|
||||
%taxon-selector{objects: "Enterprises.producers | searchEnterprises:query ",
|
||||
results: "activeTaxons"}
|
||||
%taxon-selector{objects: "Enterprises.producers | searchEnterprises:query ",
|
||||
"active-taxons" => "activeTaxons"}
|
||||
= render partial: 'shared/components/filter_box'
|
||||
|
||||
|
||||
@@ -1,38 +1,5 @@
|
||||
.filter-box.filter-box-shopfront.animate-hide.text-right
|
||||
%single-line-selector
|
||||
%ul
|
||||
%taxon-selector{objects: "Products.products | products:query | products:showProfiles",
|
||||
"active-taxons" => "activeTaxons", "taxon-selectors" => "taxonSelectors" }
|
||||
|
||||
%li.more{ ng: { show: "overFlowSelectors().length > 0 || fitting", class: "{active: selectedOverFlowSelectors().length > 0}" } }
|
||||
%a.dropdown{ dropdown: { toggle: "#more-taxons" } }
|
||||
%span
|
||||
+ {{ overFlowSelectors().length }} more
|
||||
%i.ofn-i_052-point-down
|
||||
.f-dropdown.content#more-taxons
|
||||
%ul
|
||||
%active-selector{ ng: { repeat: "selector in overFlowSelectors()", hide: "selector.fits" } }
|
||||
%render-svg{path: "{{selector.taxon.icon}}"}
|
||||
%span {{ selector.taxon.name }}
|
||||
|
||||
/ TODO: Needs controller for Angular Bootstrap directive for dropdown:
|
||||
/ {"ng-controller" => "DropdownCtrl"}
|
||||
|
||||
/ %li
|
||||
/ .btn-group{:dropdown => "", "is-open" => "status.isopen"}
|
||||
/ %button.btn.btn-primary.dropdown-toggle{"dropdown-toggle" => "", "ng-disabled" => "disabled", :type => "button"}
|
||||
/ + 7 more
|
||||
/ %span.caret
|
||||
/ %ul.dropdown-menu{:role => "menu"}
|
||||
/ %li
|
||||
/ %a{:href => "#"} Action
|
||||
/ %li
|
||||
/ %a{:href => "#"} Another action
|
||||
/ %li
|
||||
/ %a{:href => "#"} Something else here
|
||||
/ %li.divider
|
||||
/ %li
|
||||
/ %a{:href => "#"} Separated link
|
||||
%single-line-selectors
|
||||
|
||||
-# .filter-box.property-box-shopfront.animate-hide.text-right
|
||||
-# %ul
|
||||
|
||||
Reference in New Issue
Block a user