Make base configurable again

This commit is contained in:
Vit Brunner
2014-09-30 20:26:21 +02:00
parent 387ff7f038
commit 906f1c1af0
4 changed files with 19 additions and 6 deletions
+4 -1
View File
@@ -1,7 +1,10 @@
angular.module('sideBySide', ['sideBySide.controllers', 'ngRoute', 'ngSanitize'])
.config [ '$routeProvider', ($routeProvider) ->
$routeProvider
.when '/:config?', {
.when '/:base?/pick', {
templateUrl: 'partials/pick.html'
}
.when '/:base?', {
templateUrl: 'partials/comparison.html'
controller: 'ComparisonController'
}
+11 -2
View File
@@ -1,4 +1,13 @@
angular.module("sideBySide.controllers", [])
.controller "AppController", [
'$routeParams', '$scope'
($routeParams, $scope) ->
$scope.$on "$routeChangeSuccess", ($currentRoute, $previousRoute) ->
$scope.base = if $previousRoute.params.base \
then '/' + $previousRoute.params.base
else ''
]
.controller "ComparisonController", [
'$routeParams', '$q', '$scope', 'fetch', 'transformer'
($routeParams, $q, $scope, fetch, transformer) ->
@@ -20,8 +29,8 @@ angular.module("sideBySide.controllers", [])
)
)
config = if $routeParams.config \
then $routeParams.config.replace(/\./g, '/') \
config = if $routeParams.base \
then $routeParams.base.replace(/\./g, '/') \
else ''
update(config + "/config.json")