mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-09 11:34:24 +08:00
Message when wrong number of poems displayed
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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%
|
||||
|
||||
Reference in New Issue
Block a user