浏览代码

Thanks DevDocs's sponsors

Thibaut 11 年之前
父节点
当前提交
90a59030b8

+ 9 - 3
assets/javascripts/app/app.coffee

@@ -84,12 +84,18 @@
     @trigger 'ready'
     @trigger 'ready'
     @router.start()
     @router.start()
     @hideLoading()
     @hideLoading()
-    unless @doc
-      new app.views.News()
-      new app.views.Share()
+    @welcomeBack() unless @doc
+
     @removeEvent 'ready bootError'
     @removeEvent 'ready bootError'
     return
     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: ->
   reload: ->
     @docs.clearCache()
     @docs.clearCache()
     @disabledDocs.clearCache()
     @disabledDocs.clearCache()

+ 9 - 0
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
             """ 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/tw" target="_blank">Twitter</a>, <a href="/s/fb" target="_blank">Facebook</a>,
                 <a href="/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """
                 <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 :) """

+ 0 - 12
assets/javascripts/views/misc/share.coffee

@@ -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

+ 5 - 0
assets/stylesheets/components/_notif.scss

@@ -86,3 +86,8 @@
     border: 0;
     border: 0;
   }
   }
 }
 }
+
+._notif-list {
+  margin: .5em 0;
+  padding-left: 1rem;
+}