You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/assets/javascripts/views/misc/updates.coffee

29 lines
679 B

#= require views/misc/notif
class app.views.Updates extends app.views.Notif
@className += ' _notif-news'
@defautOptions:
autoHide: 30000
init: ->
@updatedDocs = @getUpdatedDocs()
@show() if @updatedDocs.length
@markAllAsRead()
return
render: ->
@html app.templates.notifUpdates(@updatedDocs)
return
getUpdatedDocs: ->
return [] unless time = @getLastUpdateTime()
doc for doc in app.docs.all() when doc.mtime > time
getLastUpdateTime: ->
app.settings.get 'version'
markAllAsRead: ->
app.settings.set 'version', if app.config.env is 'production' then app.config.version else Math.floor(Date.now() / 1000)
return