mirror of https://github.com/freeCodeCamp/devdocs
parent
41dd8deceb
commit
d20156e1f1
@ -0,0 +1,25 @@
|
||||
#= require views/misc/notif
|
||||
|
||||
class app.views.Updates extends app.views.Notif
|
||||
@className += ' _notif-news'
|
||||
|
||||
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
|
Loading…
Reference in new issue