mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Temporary working version with hacked Foundation/Angular/Tabs
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
#= require angular
|
#= require angular
|
||||||
#= require angular-resource
|
#= 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 ../shared/jquery.timeago
|
||||||
#= require foundation
|
#= require foundation
|
||||||
|
|||||||
@@ -1,23 +1,18 @@
|
|||||||
Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) ->
|
Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) ->
|
||||||
$scope.active = (tab)->
|
$scope.active = (path)->
|
||||||
$location.path() == tab
|
$location.path() == path
|
||||||
|
|
||||||
$scope.tabs = ["contact", "about", "groups", "producers"]
|
$scope.tabs = ["contact", "about", "groups", "producers"]
|
||||||
for tab in $scope.tabs
|
for tab in $scope.tabs
|
||||||
$scope[tab] =
|
$scope[tab] =
|
||||||
active: false #$scope.active("/" + tab)
|
|
||||||
path: "/" + tab
|
path: "/" + tab
|
||||||
|
|
||||||
$scope.$watch ->
|
$scope.select = (tab)->
|
||||||
$location.path()
|
if $scope.active(tab.path)
|
||||||
, (path)->
|
$location.path "/"
|
||||||
for tab in $scope.tabs
|
else
|
||||||
$scope[tab].active = $scope.active($scope[tab].path)
|
$location.path tab.path
|
||||||
|
|
||||||
#$scope.select = (tab)->
|
|
||||||
#$location.path tab.path
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
# directive -> ng-click -> scope method (not isolated) -> toggle active | change location
|
# directive -> ng-click -> scope method (not isolated) -> toggle active | change location
|
||||||
# watch active expression -> change tab appearance
|
# 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.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
|
||||||
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
|
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
|
||||||
$httpProvider.defaults.headers.common.Accept = "application/json, text/javascript, */*"
|
$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"}
|
contact: "Contact"}
|
||||||
|
|
||||||
%tab{heading: heading,
|
%tab{heading: heading,
|
||||||
active: "#{name}.active",
|
active: "active(#{name}.path)",
|
||||||
select: "select(#{name})"}
|
select: "select(#{name})"}
|
||||||
= render "shop/shop/#{name}"
|
= render "shop/shop/#{name}"
|
||||||
|
|||||||
Reference in New Issue
Block a user