History

Add RDoc scraper and Ruby documentation

Thibaut committed 12 years ago

Commit 30931041 parent f5eb54717 files · +337 −-3Browse files

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

Unified · Split

3 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  2. assets/javascripts/templates/pages/news_tmpl.coffee +4 −1
  3. assets/javascripts/views/pages/rdoc.coffee +20 −0
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -138,6 +138,11 @@ credits = [ · 137 unmodified lines
138138 '1997-2013 The PHP Documentation Group',
139139 'CC BY',
140140 'http://creativecommons.org/licenses/by/3.0/'
141+ ], [
142+ 'Ruby',
143+ '1993-2013 Yukihiro Matsumoto',
144+ 'Ruby',
145+ 'https://www.ruby-lang.org/en/about/license.txt'
141146 ], [
142147 'Sass',
143148 '2006-2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
assets/javascripts/templates/pages/news_tmpl.coffee+4−1
@@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines
2424 result
2525
2626 app.news = [
27− [ 1382572800000, # October 24, 2013
27+ [ 1384560000000, # November 16, 2013
28+ """ New <a href="/ruby/">Ruby</a> documentation """
29+ ], [
30+ 1382572800000, # October 24, 2013
2831 """ DevDocs is now <a href="https://github.com/Thibaut/devdocs">open source</a>. """
2932 ], [
3033 1381276800000, # October 9, 2013
assets/javascripts/views/pages/rdoc.coffee+20−0
@@ -0,0 +1,20 @@
1+#= require views/pages/base
2+
3+class app.views.RdocPage extends app.views.BasePage
4+ @events:
5+ click: 'onClick'
6+
7+ afterRender: ->
8+ @highlightCode @findAll('pre.ruby'), 'ruby'
9+ @highlightCode @findAll('pre.c'), 'clike'
10+ return
11+
12+ onClick: (event) ->
13+ return unless event.target.classList.contains 'method-click-advice'
14+ $.stopEvent(event)
15+
16+ source = $ '.method-source-code', event.target.parentNode.parentNode
17+ isShown = source.style.display is 'block'
18+
19+ source.style.display = if isShown then 'none' else 'block'
20+ event.target.textContent = if isShown then 'Show source' else 'Hide source'