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
+3 -3
View File
@@ -9,16 +9,16 @@ html(ng-app="sideBySide")
link(rel="stylesheet", type="text/css", href="styles/style.css")
include _scripts.html.jade
body
body(ng-controller="AppController")
noscript Well, terribly sorry but you do need to have Javascript enabled.
// top menu
.pure-menu.pure-menu-open.pure-menu-horizontal.menu-main
ul
li
a(href="#") Home
a(href="#{{config}}") Home
li
a(href="#") Pick
a(href="#{{config}}/pick") Pick
li
a(href="#") Help
li
+1
View File
@@ -0,0 +1 @@
div Here you can pick which versions are displayed.
+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")