Skip to content

Commit

Permalink
properties template added
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan authored and ilan committed Mar 19, 2013
1 parent bbc5bc2 commit b76bfb4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/entry.js.coffee
Expand Up @@ -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)
Expand Down
23 changes: 22 additions & 1 deletion app/assets/javascripts/templates.js.coffee
Expand Up @@ -68,14 +68,35 @@ class jqapi.Templates
"""

argumentsItem: (arg) ->
argn = arg.name
if arg and arg.optional
argn = "[#{arg.name}]"

"""
<tr>
<td class='name'>#{arg.name}</td>
<td class='name'>#{argn}</td>
<td class='type'>#{arg.type}</td>
<td class='desc'>#{arg.desc}</td>
</tr>
"""

propertyItem: (prop) ->
if prop.default?
prop.def = "(default: <em>#{prop.default}</em>)"
else
prop.def = ""

"""
<tr class="property"><td colspan=3>
#{prop.name}
#{prop.def}
<br>
Type:
<a href="//api.jquery.com/Types##{prop.type}">#{prop.type}</a>
<p>#{prop.desc}</p>
</td></tr>
"""

examplesItem: (example) ->
"""
<li class='example clearfix'>
Expand Down
25 changes: 24 additions & 1 deletion app/assets/stylesheets/entry.css.sass
Expand Up @@ -259,4 +259,27 @@
color: #888

tr:nth-child(even)
background: #e5edf9
background: #e5edf9

tr.property

td
color: pink

padding-left: 30px
background: rgb(34, 34, 34)

p
font-size: 1em
margin: 0
ul
padding-left: 30px

li::after
content: "\00a0"
display: block
border: 0
border-top: 1px dashed #ccc
line-height: 4px


0 comments on commit b76bfb4

Please sign in to comment.