History

Add share notification

Thibaut committed 11 years ago

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

Showing the changes to assets/javascripts (3 of 3 files). Show all

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
8484 @trigger 'ready'
8585 @router.start()
8686 @hideLoading()
87− new app.views.News() unless @doc
87+ unless @doc
88+ new app.views.News()
89+ new app.views.Share()
8890 @removeEvent 'ready bootError'
8991 return
9092
assets/javascripts/templates/notif_tmpl.coffee+8−0
@@ -21,3 +21,11 @@ app.templates.notifInvalidLocation = -> · 20 unmodified lines
2121
2222 app.templates.notifNews = (news) ->
2323 notif 'Changelog', app.templates.newsList(news)
24+
25+app.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+
3+class 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