From 90a59030b887330de4557cdc77d7aeb214da4dbb Mon Sep 17 00:00:00 2001 From: Thibaut <thibaut@me.com> Date: Sun, 14 Dec 2014 14:56:06 -0500 Subject: [PATCH] Thanks DevDocs's sponsors --- assets/javascripts/app/app.coffee | 12 +++++++++--- assets/javascripts/templates/notif_tmpl.coffee | 9 +++++++++ assets/javascripts/views/misc/share.coffee | 12 ------------ assets/stylesheets/components/_notif.scss | 5 +++++ 4 files changed, 23 insertions(+), 15 deletions(-) delete mode 100644 assets/javascripts/views/misc/share.coffee diff --git a/assets/javascripts/app/app.coffee b/assets/javascripts/app/app.coffee index 09ea219c..7554869d 100644 --- a/assets/javascripts/app/app.coffee +++ b/assets/javascripts/app/app.coffee @@ -84,12 +84,18 @@ @trigger 'ready' @router.start() @hideLoading() - unless @doc - new app.views.News() - new app.views.Share() + @welcomeBack() unless @doc + @removeEvent 'ready bootError' return + welcomeBack: -> + @visitCount = @store.get('count') or 0 + @store.set 'count', ++@visitCount + new app.views.Notif 'Share', autoHide: null if @visitCount is 5 + new app.views.Notif 'Thanks', autoHide: null if @visitCount is 10 + new app.views.News() + reload: -> @docs.clearCache() @disabledDocs.clearCache() diff --git a/assets/javascripts/templates/notif_tmpl.coffee b/assets/javascripts/templates/notif_tmpl.coffee index baad3fd1..67eada0b 100644 --- a/assets/javascripts/templates/notif_tmpl.coffee +++ b/assets/javascripts/templates/notif_tmpl.coffee @@ -27,3 +27,12 @@ app.templates.notifShare = -> """ Like DevDocs? Help us reach more developers by sharing the link with your friends, on <a href="/s/tw" target="_blank">Twitter</a>, <a href="/s/fb" target="_blank">Facebook</a>, <a href="/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """ + +app.templates.notifThanks = -> + textNotif """ Hi there! """, + """ <p class="_notif-text">Quick shout-out to our awesome sponsors: + <ul class="_notif-list"> + <li><a href="http://devdocs.io/s/maxcdn" target="_blank">MaxCDN</a> has been supporting DevDocs since day one. They provide CDN solutions that make DevDocs and countless other sites faster.</li> + <li><a href="http://devdocs.io/s/shopify" target="_blank">Shopify</a> is where I spend my weekdays. Interested in working on one of the biggest commerce platform in the world, in a delightful work environment? We're hiring! + </ul> + <p class="_notif-text">Have a great day :) """ diff --git a/assets/javascripts/views/misc/share.coffee b/assets/javascripts/views/misc/share.coffee deleted file mode 100644 index 3da15e0b..00000000 --- a/assets/javascripts/views/misc/share.coffee +++ /dev/null @@ -1,12 +0,0 @@ -#= 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 diff --git a/assets/stylesheets/components/_notif.scss b/assets/stylesheets/components/_notif.scss index 575fedf7..d9cf8cae 100644 --- a/assets/stylesheets/components/_notif.scss +++ b/assets/stylesheets/components/_notif.scss @@ -86,3 +86,8 @@ border: 0; } } + +._notif-list { + margin: .5em 0; + padding-left: 1rem; +}