From b0071e2e64594447fea3fd7ab6b6bf666e971ea5 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sun, 23 Nov 2014 10:52:47 -0500 Subject: [PATCH] Add share notification --- assets/javascripts/app/app.coffee | 4 +++- assets/javascripts/templates/notif_tmpl.coffee | 8 ++++++++ assets/javascripts/views/misc/share.coffee | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 assets/javascripts/views/misc/share.coffee diff --git a/assets/javascripts/app/app.coffee b/assets/javascripts/app/app.coffee index 134f2892..09ea219c 100644 --- a/assets/javascripts/app/app.coffee +++ b/assets/javascripts/app/app.coffee @@ -84,7 +84,9 @@ @trigger 'ready' @router.start() @hideLoading() - new app.views.News() unless @doc + unless @doc + new app.views.News() + new app.views.Share() @removeEvent 'ready bootError' return diff --git a/assets/javascripts/templates/notif_tmpl.coffee b/assets/javascripts/templates/notif_tmpl.coffee index 34fa3fe7..9dd5e78f 100644 --- a/assets/javascripts/templates/notif_tmpl.coffee +++ b/assets/javascripts/templates/notif_tmpl.coffee @@ -21,3 +21,11 @@ app.templates.notifInvalidLocation = -> app.templates.notifNews = (news) -> notif 'Changelog', app.templates.newsList(news) + +app.templates.notifShare = -> + textNotif """ Hi there! """, + """ Like DevDocs? Help us reach more developers by sharing the link with your friends, on + Twitter, + Facebook, + Reddit, + etc.
Thanks :)""" diff --git a/assets/javascripts/views/misc/share.coffee b/assets/javascripts/views/misc/share.coffee new file mode 100644 index 00000000..3da15e0b --- /dev/null +++ b/assets/javascripts/views/misc/share.coffee @@ -0,0 +1,12 @@ +#= require views/misc/notif + +class app.views.Share extends app.views.Notif + @defautOptions: + autoHide: null + + init: -> + @type = 'Share' + @count = app.store.get('count') or 0 + app.store.set 'count', ++@count + @show() if @count is 5 + return