Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #10 from IlanFrumer/dev

fixing issue #3 - jQuery.ajax() was missing full set of settings and description
  • Loading branch information...
commit 187803b3de2e037e833dfb6ca63fb955d9f673f0 2 parents abc26ab + 1e4cd57
@mustardamus mustardamus authored
View
4 app/assets/javascripts/entry.js.coffee
@@ -102,6 +102,10 @@ class jqapi.Entry
for arg in args # for every argument
if arg and arg.name
argsEl.append $(templates.argumentsItem(arg)) # build and append element from template
+ if arg.property
+ for prop in arg.property
+ argsEl.append $(templates.propertyItem(prop))
+
insertExamples: (examples, el) ->
examples = [examples] unless $.isArray(examples)
View
86 app/assets/javascripts/templates.js.coffee
@@ -21,13 +21,26 @@ class jqapi.Templates
"""
entry: (entry) ->
+
+ dep = []
+
+ if entry and entry.deprecated
+ dep.push "version deprecated: <a href='//api.jquery.com/category/version/#{entry.deprecated}/'>#{entry.deprecated}</a>"
+
+ if entry and entry.removed
+ dep.push "removed: <a href='//api.jquery.com/category/version/#{entry.removed}/'>#{entry.removed}</a>"
+
+ unless dep is []
+ dep = "<p>#{dep.join ' | '}</p>"
+
"""
<div id='entry-wrapper'>
<div id='entry-header'>
<h1>#{entry.title}</h1>
<p>#{entry.desc}</p>
+ #{dep}
<ul id='categories'></ul>
- <a href='http://api.jquery.com/#{entry.slug}'>Original: api.jquery.com/#{entry.slug}</a>
+ <a class="origin" href='http://api.jquery.com/#{entry.slug}'>Original: api.jquery.com/#{entry.slug}</a>
</div>
<ul id='entries'></ul>
</div>
@@ -68,14 +81,81 @@ class jqapi.Templates
"""
argumentsItem: (arg) ->
+ def = ""
+ argt = []
+
+ if arg.default?
+ def = "( default: <code>#{arg.default}</code> )"
+
+ if $.isArray arg.type
+ for a in arg.type
+ argt.push a.name
+ else
+ argt = [arg.type]
+
+ argt = argt.join ", "
+
"""
<tr>
- <td class='name'>#{arg.name}</td>
- <td class='type'>#{arg.type}</td>
+ <td class='name'>#{arg.name} #{def}</td>
+ <td class='type'>#{argt}</td>
<td class='desc'>#{arg.desc}</td>
</tr>
"""
+ propertyItem: (prop) ->
+ def = ""
+ added = ""
+ types = []
+ args = []
+ ret = ""
+
+ if prop.default?
+ def = "(default: <code>#{prop.default}</code>)"
+
+ if prop.added?
+ added = """
+ <strong>
+ ( version added:
+ <a href="//api.jquery.com/category/version/#{prop.added}/">#{prop.added}</a> )
+ </strong>
+ """
+
+ if $.isArray prop.type
+ for t in prop.type
+ types.push t.name
+ else
+ types = [prop.type]
+
+ types = $.map types , (t) ->
+ "<a href='//api.jquery.com/Types##{t}'>#{t}</a>"
+
+ types = types.join ', '
+
+ if prop.argument?
+ for a in prop.argument
+ args.push "<a href='//api.jquery.com/Types##{a.type}'>#{a.type}</a> #{a.name}"
+ args = "( #{args.join ', '} )"
+ else
+ args = ""
+
+ if prop.return?
+ ret = " => <a href='//api.jquery.com/Types##{prop.return.type}'>#{prop.return.type}</a>"
+
+ """
+ <tr class="property"><td colspan=3>
+ <div>
+ <strong>#{prop.name}</strong>
+ #{def}
+ </div>
+ <div>
+ Type: #{types} #{args}#{ret}
+ </div>
+ <div class="desc">#{prop.desc} #{added}</div>
+
+ </td></tr>
+ """
+
examplesItem: (example) ->
"""
<li class='example clearfix'>
View
58 app/assets/stylesheets/entry.css.sass
@@ -24,8 +24,11 @@
color: #777
padding-right: 50px
line-height: 20px
-
a
+ text-decoration: none
+ color: red
+
+ a.origin
position: absolute
top: -10px
right: 0
@@ -241,7 +244,7 @@
table.arguments
width: 100%
-
+
tr
background: #edf3fe
@@ -254,9 +257,58 @@
&.name
width: 200px
+ code
+ font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace
+ padding: 1px 2px
+ font-weight: normal
+
&.type
width: 100px
color: #888
tr:nth-child(even)
- background: #e5edf9
+ background: #e5edf9
+
+ tr.property
+
+ font-size: 0.8em
+
+ a
+ color: red
+ text-decoration: none
+
+ &:hover
+ text-decoration: underline
+ color: #555
+
+ strong
+ font-weight: bold
+
+ code
+ font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace
+ padding: 1px 2px
+ font-weight: normal
+
+ pre
+ background: rgb(43,43,43)
+ em
+ font-style: italic
+
+ td
+ padding-left: 30px
+ background: rgb(214, 214, 214)
+
+ .desc
+ box-shadow: 1px 1px 5px black
+ padding: 2px
+
+ ul
+ padding: 5px
+
+ li
+ padding: 5px
+ &:nth-child(odd)
+ background: rgb(194, 194, 194)
+ &:nth-child(even)
+ background: rgb(174, 174, 174)
+
View
8 tasks/documentation.thor
@@ -114,6 +114,8 @@ class Docs < Thor
:name => entry['name'],
:type => entry['type'],
:title => entry['title'],
+ :deprecated => entry['deprecated'],
+ :removed => entry['removed'],
:desc => entry['desc'], # from first entry or from wrapper
:categories => [], # normalize categories as array
:entries => [] # all variatons of the method
@@ -255,8 +257,10 @@ class Docs < Thor
entryObj = { # build a new stripped entry obj
:title => entry[:title],
:desc => desc,
- :slug => entry[:slug] || entry[:name] # use slug if exist
- }
+ :slug => entry[:slug] || entry[:name], # use slug if exist
+ :deprecated => entry[:deprecated],
+ :removed => entry[:removed]
+ }
if sub_cat # entry is stored in a sub category
cat[:subcats].each do |subcat| # find the slug in the subcats
Please sign in to comment.
Something went wrong with that request. Please try again.