Move picking to a dropup

This commit is contained in:
Vit Brunner
2014-10-11 09:31:49 +02:00
parent 8edb8768dd
commit 55b57f0776
6 changed files with 56 additions and 27 deletions
-4
View File
@@ -1,10 +1,6 @@
angular.module('sideBySide', ['sideBySide.controllers', 'ngRoute', 'ngSanitize'])
.config [ '$routeProvider', ($routeProvider) ->
$routeProvider
.when '/:base?/pick', {
templateUrl: 'partials/pick.html'
controller: 'PickController'
}
.when '/:base?', {
templateUrl: 'partials/comparison.html'
controller: 'ComparisonController'
+12 -10
View File
@@ -15,9 +15,9 @@ angular.module("sideBySide.controllers", [])
'$scope', 'poems', 'transformer'
($scope, poems, transformer) ->
$scope.$watch () ->
(poem for poem in poems.all when poem.meta.Active is true).length
poems.getActive().length
, () ->
active = (poem for poem in poems.all when poem.meta.Active is true)
active = poems.getActive()
$scope.columns = active.length
transformed = transformer(active)
@@ -26,13 +26,15 @@ angular.module("sideBySide.controllers", [])
headingKey = poems.heading or "Author"
$scope.headings = (version[headingKey] for version in transformed.meta)
]
.controller "PickController", [
'$scope', 'poems'
($scope, poems) ->
$scope.$watch () ->
(poem for poem in poems.all when poem.meta.Active is true).length
, () ->
$scope.poems = poems.all
$scope.all = poems.all
$scope.switchActive = (poem) ->
if (not poem.meta.Active || poems.getActive().length > 1)
poem.meta.Active = not poem.meta.Active
$scope.flipPick = () ->
$scope.pick = not $scope.pick
$scope.pick = true
]
@@ -10,6 +10,9 @@ angular.module("sideBySide").service "poems", ['$q', 'fetch', ($q, fetch) ->
}]
@heading = undefined
@getActive = () ->
(poem for poem in @all when poem.meta.Active is true)
@load = (base = '') =>
config = base.replace(/\./g, '/') + "/config.json"