mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-09 11:34:24 +08:00
More status flipping restrictions
This commit is contained in:
@@ -14,6 +14,9 @@ angular.module("sideBySide.controllers", [])
|
||||
.controller "ComparisonController", [
|
||||
'$scope', 'poems', 'transformer'
|
||||
($scope, poems, transformer) ->
|
||||
min = 1
|
||||
max = 5
|
||||
|
||||
$scope.$watch () ->
|
||||
poems.getActive().length
|
||||
, () ->
|
||||
@@ -30,8 +33,11 @@ angular.module("sideBySide.controllers", [])
|
||||
$scope.all = poems.all
|
||||
|
||||
$scope.switchActive = (poem) ->
|
||||
if (not poem.meta.Active || poems.getActive().length > 1)
|
||||
length = poems.getActive().length
|
||||
active = poem.meta.Active
|
||||
if ((length > min or not active) and (length < max or active))
|
||||
poem.meta.Active = not poem.meta.Active
|
||||
# TODO else notification
|
||||
|
||||
$scope.flipPick = () ->
|
||||
$scope.pick = not $scope.pick
|
||||
|
||||
Reference in New Issue
Block a user