Message when wrong number of poems displayed

This commit is contained in:
Vit Brunner
2019-02-04 22:55:11 +01:00
parent 8dbccb3067
commit 68398cba95
3 changed files with 23 additions and 4 deletions
+2
View File
@@ -9,6 +9,8 @@
.pick(ng-show="pick")
.pick-in
div#too-few(ng-hide="! tooFew") There is no escape.
div#too-many(ng-hide="! tooMany") You can only compare five translations at the moment. Choose wisely.
table
tr
th(ng-repeat="attribute in metaKeys" ng-bind-html="attribute")
@@ -1,6 +1,6 @@
angular.module("sideBySide").controller "ComparisonController",
['$document', '$rootScope', '$scope', 'filter', 'load', 'poems', 'route', 'transformer'
($document, $rootScope, $scope, filter, load, poems, route, transformer) ->
['$document', '$rootScope', '$scope', '$timeout', 'filter', 'load', 'poems', 'route', 'transformer'
($document, $rootScope, $scope, $timeout, filter, load, poems, route, transformer) ->
min = 1
max = 5
@@ -40,9 +40,18 @@ angular.module("sideBySide").controller "ComparisonController",
$scope.switchActive = (poem) ->
length = poems.getActive().length
active = poem.meta.Active
if (length > min or not active) and (length < max or active)
if (length <= min and active)
$scope.tooFew = true
$timeout((-> $scope.tooFew = false), 1000)
else if (length >= max and not active)
$scope.tooMany = true
$timeout((-> $scope.tooMany = false), 2500)
else
poem.meta.Active = ! active
# TODO else notification
$scope.tooFew = false
$scope.tooMany = false
load(
route.getBaseDir()
+8
View File
@@ -106,6 +106,14 @@ a
a
color: $neutral
#too-few, #too-many
color: #F66
text-align: center
transition: .3s linear all
height: 36px
#too-few.ng-hide, #too-many.ng-hide
height: 0px
table
margin: auto
min-width: 50%