mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-14 18:56:49 +00:00
Temporary working version with hacked Foundation/Angular/Tabs
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#
|
||||
#= require angular
|
||||
#= require angular-resource
|
||||
#= require mm-foundation-tpls-0.1.0.min.js
|
||||
#= require ../shared/mm-foundation-tpls-0.2.0-SNAPSHOT
|
||||
#
|
||||
#= require ../shared/jquery.timeago
|
||||
#= require foundation
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) ->
|
||||
$scope.active = (tab)->
|
||||
$location.path() == tab
|
||||
$scope.active = (path)->
|
||||
$location.path() == path
|
||||
|
||||
$scope.tabs = ["contact", "about", "groups", "producers"]
|
||||
for tab in $scope.tabs
|
||||
$scope[tab] =
|
||||
active: false #$scope.active("/" + tab)
|
||||
path: "/" + tab
|
||||
|
||||
$scope.$watch ->
|
||||
$location.path()
|
||||
, (path)->
|
||||
for tab in $scope.tabs
|
||||
$scope[tab].active = $scope.active($scope[tab].path)
|
||||
$scope.select = (tab)->
|
||||
if $scope.active(tab.path)
|
||||
$location.path "/"
|
||||
else
|
||||
$location.path tab.path
|
||||
|
||||
#$scope.select = (tab)->
|
||||
#$location.path tab.path
|
||||
#
|
||||
#
|
||||
|
||||
# directive -> ng-click -> scope method (not isolated) -> toggle active | change location
|
||||
# watch active expression -> change tab appearance
|
||||
|
||||
@@ -2,4 +2,3 @@ window.Darkswarm = angular.module("Darkswarm", ["ngResource", "filters", 'mm.fou
|
||||
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
|
||||
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
|
||||
$httpProvider.defaults.headers.common.Accept = "application/json, text/javascript, */*"
|
||||
|
||||
|
||||
2615
app/assets/javascripts/shared/mm-foundation-tpls-0.2.0-SNAPSHOT.js
Normal file
2615
app/assets/javascripts/shared/mm-foundation-tpls-0.2.0-SNAPSHOT.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,6 @@
|
||||
contact: "Contact"}
|
||||
|
||||
%tab{heading: heading,
|
||||
active: "#{name}.active",
|
||||
active: "active(#{name}.path)",
|
||||
select: "select(#{name})"}
|
||||
= render "shop/shop/#{name}"
|
||||
|
||||
Reference in New Issue
Block a user