Commit 188e192d authored by Ujvari Gergely's avatar Ujvari Gergely

Introducing bottombar for notifications

parent ea294e2f
...@@ -655,6 +655,37 @@ blockquote { ...@@ -655,6 +655,37 @@ blockquote {
} }
} }
.bottombar {
@include smallshadow;
background: $white;
border: solid 1px $grayLighter;
height: 2em;
position: fixed;
left: -1px;
right: -1px;
bottom: .5em;
z-index: 5;
.barbutton {
&:hover {
@include box-shadow(inset 0 1px 3px hsla(0, 0%, 0%, .1));
}
&:active {
@include box-shadow(inset 0 2px 3px hsla(0, 0%, 0%, .1));
}
}
.inner > * {
padding: .3em;
&.pull-right {
display: inline-block;
font-family: $sansFontFamily;
}
}
}
//MAIN CONTENT/////// //MAIN CONTENT///////
.content { .content {
......
...@@ -110,6 +110,14 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); } ...@@ -110,6 +110,14 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
} }
} }
.bottombar {
position: fixed;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
left: 7px;
bottom: .5em;
}
//CONTROLBAR STUFF//////////////////////////////// //CONTROLBAR STUFF////////////////////////////////
.controlbar { .controlbar {
position: absolute; position: absolute;
......
...@@ -439,6 +439,32 @@ class App ...@@ -439,6 +439,32 @@ class App
$scope.has_update = false $scope.has_update = false
# Notifications
$scope.notifications = []
$scope.removeNotificationUpdate = ->
index = -1
for notif in $scope.notifications
if notif.type is 'update'
index = $scope.notifications.indexOf notif
break
if index > -1 then $scope.notifications.splice index,1
$scope.addUpdateNotification = ->
# Do not add an update notification twice
unless $scope.has_update
notification =
type: 'update'
text: 'Reload to seen new annotations'
callback: =>
$scope.reloadAnnotations()
$scope.removeNotificationUpdate()
close: $scope.removeNotificationUpdate
$scope.notifications.unshift notification
$scope.has_update = true
$scope.initUpdater = -> $scope.initUpdater = ->
$scope.has_update = false $scope.has_update = false
path = window.location.protocol + '//' + window.location.hostname + ':' + path = window.location.protocol + '//' + window.location.hostname + ':' +
...@@ -477,23 +503,21 @@ class App ...@@ -477,23 +503,21 @@ class App
if action is 'create' if action is 'create'
continue # We have created this continue # We have created this
if action is 'update' if action is 'update'
if check.message.pdated is annotation.updated then continue if check.message.updated is annotation.updated then continue
else else
$scope.has_update = true $scope.addUpdateNotification()
break break
if action is 'delete' if action is 'delete'
# We haven't deleted this yet # We haven't deleted this yet
$scope.has_update = true $scope.addUpdateNotification()
break break
else else
if action is 'delete' if action is 'delete'
continue # Probably our own delete or doesn't concern us continue # Probably our own delete or doesn't concern us
else else
$scope.has_update = true $scope.addUpdateNotification()
break break
#$scope.$digest()
$timeout => $timeout =>
$scope.initUpdater() $scope.initUpdater()
, 5000 , 5000
...@@ -885,9 +909,17 @@ class Search ...@@ -885,9 +909,17 @@ class Search
refresh() refresh()
class Notification
this.inject = ['$scope']
constructor: (
$scope
) ->
angular.module('h.controllers', ['bootstrap', 'h.streamfilter']) angular.module('h.controllers', ['bootstrap', 'h.streamfilter'])
.controller('AppController', App) .controller('AppController', App)
.controller('AnnotationController', Annotation) .controller('AnnotationController', Annotation)
.controller('EditorController', Editor) .controller('EditorController', Editor)
.controller('ViewerController', Viewer) .controller('ViewerController', Viewer)
.controller('SearchController', Search) .controller('SearchController', Search)
.controller('NotificationController', Notification)
...@@ -326,6 +326,20 @@ tags = ['$window', ($window) -> ...@@ -326,6 +326,20 @@ tags = ['$window', ($window) ->
restrict: 'C' restrict: 'C'
] ]
notification = ['$filter', ($filter) ->
link: (scope, elem, attrs, controller) ->
return unless controller?
# Publish the controller
scope.model = controller
controller: 'NotificationController'
priority: 100 # Must run before ngModel
require: '?ngModel'
restrict: 'C'
scope: {}
templateUrl: 'notification.html'
]
angular.module('h.directives', ['ngSanitize']) angular.module('h.directives', ['ngSanitize'])
.directive('authentication', authentication) .directive('authentication', authentication)
.directive('markdown', markdown) .directive('markdown', markdown)
...@@ -339,4 +353,5 @@ angular.module('h.directives', ['ngSanitize']) ...@@ -339,4 +353,5 @@ angular.module('h.directives', ['ngSanitize'])
.directive('userPicker', userPicker) .directive('userPicker', userPicker)
.directive('ngBlur', ngBlur) .directive('ngBlur', ngBlur)
.directive('repeatAnim', repeatAnim) .directive('repeatAnim', repeatAnim)
.directive('notification', notification)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment