History

Add share notification

Thibaut committed 11 years ago

Commit b0071e21 parent 240700d3 files · +23 −1Browse files

Unified · Split

3 files
  1. assets/javascripts/app/app.coffee +3 −1
  2. assets/javascripts/templates/notif_tmpl.coffee +8 −0
  3. assets/javascripts/views/misc/share.coffee +12 −0
assets/javascripts/app/app.coffee+3−1
@@ -84,7 +84,9 @@ · 83 unmodified lines
84 @trigger 'ready'84 @trigger 'ready'
85 @router.start()85 @router.start()
86 @hideLoading()86 @hideLoading()
87 new app.views.News() unless @doc87 unless @doc
88 new app.views.News()
89 new app.views.Share()
88 @removeEvent 'ready bootError'90 @removeEvent 'ready bootError'
89 return91 return
90 92
assets/javascripts/templates/notif_tmpl.coffee+8−0
@@ -21,3 +21,11 @@ app.templates.notifInvalidLocation = -> · 20 unmodified lines
21 21
22app.templates.notifNews = (news) ->22app.templates.notifNews = (news) ->
23 notif 'Changelog', app.templates.newsList(news)23 notif 'Changelog', app.templates.newsList(news)
24
25app.templates.notifShare = ->
26 textNotif """ Hi there! """,
27 """ Like DevDocs? Help us reach more developers by sharing the link with your friends, on
28 <a href="https://twitter.com/intent/tweet?url=http%3A%2F%2Fdevdocs.io&via=DevDocs&text=All-in-one%2C%20quickly%20searchable%20API%20docs%3A" target="_blank">Twitter</a>,
29 <a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdevdocs.io" target="_blank">Facebook</a>,
30 <a href="http://www.reddit.com/submit?url=http%3A%2F%2Fdevdocs.io&title=All-in-one%2C%20quickly%20searchable%20API%20docs&resubmit=true" target="_blank">Reddit</a>,
31 etc.<br>Thanks :)"""
assets/javascripts/views/misc/share.coffee+12−0
@@ -0,0 +1,12 @@
1#= require views/misc/notif
2
3class app.views.Share extends app.views.Notif
4 @defautOptions:
5 autoHide: null
6
7 init: ->
8 @type = 'Share'
9 @count = app.store.get('count') or 0
10 app.store.set 'count', ++@count
11 @show() if @count is 5
12 return