mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Better handling of the home page hubs
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
Darkswarm.controller "HubNodeCtrl", ($scope, Navigation, $location, $anchorScroll) ->
|
||||
$scope.toggle = ->
|
||||
Navigation.navigate $scope.hub.path
|
||||
|
||||
$scope.active = ->
|
||||
$location.path() == $scope.hub.path
|
||||
|
||||
if $scope.active()
|
||||
console.log "scrolling baby"
|
||||
$anchorScroll()
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
Darkswarm.factory 'Navigation', ($location) ->
|
||||
new class Navigation
|
||||
paths: []
|
||||
path: null
|
||||
path: $location.path()
|
||||
|
||||
navigate: (path = false)->
|
||||
@path = path || @path || @paths[0]
|
||||
|
||||
if $location.path() == @path
|
||||
$location.path("/")
|
||||
else
|
||||
|
||||
@@ -7,7 +7,3 @@
|
||||
display: block
|
||||
&:first-child
|
||||
cursor: pointer
|
||||
&.closed
|
||||
&:hover, &:active, &:focus
|
||||
background: white
|
||||
border: 1px solid $clr-strong
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
|
||||
hub
|
||||
display: block
|
||||
strong
|
||||
color: $clr-strong
|
||||
border: 1px solid transparent
|
||||
&.closed
|
||||
&:hover, &:active, &:focus
|
||||
background: white
|
||||
border: 1px solid $clr-strong
|
||||
|
||||
&.open
|
||||
border: 1px solid $clr-strong
|
||||
p
|
||||
|
||||
@@ -30,11 +30,12 @@
|
||||
.row{bindonce: true}
|
||||
.small-12.columns
|
||||
.active_table
|
||||
|
||||
%hub.row{"ng-repeat" => "hub in filteredHubs = (hubs | filterHubs:query)",
|
||||
"ng-class" => "{'open' : open}"}
|
||||
"ng-class" => "{'closed' : !active(), 'open' : active()}",
|
||||
"ng-controller" => "HubNodeCtrl",
|
||||
id: "{{hub.path}}"}
|
||||
.small-12.columns
|
||||
.row.active_table_row{"ng-click" => "open = !open", "ng-class" => "{'closed' : !open}"}
|
||||
.row.active_table_row{"ng-click" => "toggle()", "ng-class" => "{'closed' : !active()}"}
|
||||
.columns.small-4
|
||||
%strong {{ hub.name }}
|
||||
.columns.small-3
|
||||
@@ -46,7 +47,7 @@
|
||||
.columns.small-1.text-right
|
||||
%i{"ng-class" => "{'fi-arrow-down' : !open, 'fi-arrow-up' : open}"}
|
||||
|
||||
.row.active_table_row{"ng-if" => "open"}
|
||||
.row.active_table_row{"ng-show" => "active()"}
|
||||
.columns.small-4
|
||||
%strong Shop for
|
||||
%p
|
||||
@@ -65,7 +66,7 @@
|
||||
%li Shiny Olives
|
||||
%li Love in the Time of Cholera
|
||||
|
||||
.row.active_table_row{"ng-if" => "open"}
|
||||
.row.active_table_row{"ng-show" => "active()"}
|
||||
.columns.small-11
|
||||
%a{"bo-href" => "hub.path"}
|
||||
Shop at
|
||||
|
||||
Reference in New Issue
Block a user