common.template.html 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. ---
  2. layout: fluid/docs_base
  3. version: "<$ version.current.name $>"
  4. category: storage
  5. id: "<$ doc.name|lower|replace(' ','-') $>"
  6. title: "<$ doc.name $> - Ionic Framework"
  7. ---
  8. <@ macro paramList(paramData) -@>
  9. <@- if paramData -@><span class="params">(
  10. <@- for param in paramData -@>
  11. <span class="param"><$ param | escape $><@ if not loop.last @>, <@ endif @></span>
  12. <@- endfor @>)</span>
  13. <@- endif @>
  14. <@- endmacro -@>
  15. <@ macro returnObject(params) -@>
  16. <@- if params -@>
  17. <table class="table returns-object-table param-table">
  18. <thead>
  19. <tr>
  20. <th>Property</th>
  21. <th>Type</th>
  22. <th>Details</th>
  23. </tr>
  24. </thead>
  25. <tbody>
  26. <@ for param in params @>
  27. <tr>
  28. <td class="fixed-width">
  29. <$ param.key $>
  30. </td>
  31. <td>
  32. <$ param.type | code $>
  33. </td>
  34. <td>
  35. <$ param.description | marked $>
  36. </td>
  37. </tr>
  38. <@ endfor @>
  39. </tbody>
  40. </table>
  41. <@- endif @>
  42. <@- endmacro -@>
  43. <@ macro githubViewLink(doc) -@>
  44. <a href="https://github.com/<$ versionInfo.gitRepoInfo.owner $>/<$ versionInfo.gitRepoInfo.repo $>/tree/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line+1 $>-L<$ doc.location.end.line+1 $>"><$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>)</a>
  45. <@- endmacro -@>
  46. <@ macro paramTable(params, isDirective) -@>
  47. <table class="table param-table" style="margin:0;">
  48. <thead>
  49. <tr>
  50. <th><@ if isDirective @>Attr<@ else @>Param<@ endif @></th>
  51. <th>Type</th>
  52. <th>Details</th>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. <@ for param in params @>
  57. <tr>
  58. <td>
  59. <$ param.name $>
  60. <@ if param.alias @>| <$ param.alias $><@ endif @>
  61. <@ if param.type.optional @><div><em>(optional)</em></div><@ endif @>
  62. </td>
  63. <td>
  64. <$ typeList(param.typeList) $>
  65. </td>
  66. <td>
  67. <$ param.description | marked $>
  68. <@ if param.default @><p><em>(default: <$ param.default $>)</em></p><@ endif @>
  69. </td>
  70. </tr>
  71. <@ endfor @>
  72. </tbody>
  73. </table>
  74. <@- endmacro -@>
  75. <@ macro inputTable(params, isDirective) -@>
  76. <table class="table param-table" style="margin:0;">
  77. <thead>
  78. <tr>
  79. <th>Attr</th>
  80. <th>Type</th>
  81. <th>Details</th>
  82. </tr>
  83. </thead>
  84. <tbody>
  85. <@ for param in params @>
  86. <tr>
  87. <td><$ param.name $></td>
  88. <td><code><$ param.type $></code></td>
  89. <td><$ param.description | marked $></td>
  90. </tr>
  91. <@ endfor @>
  92. </tbody>
  93. </table>
  94. <@- endmacro -@>
  95. <@ macro outputTable(params, isDirective) -@>
  96. <table class="table param-table" style="margin:0;">
  97. <thead>
  98. <tr>
  99. <th>Attr</th>
  100. <th>Details</th>
  101. </tr>
  102. </thead>
  103. <tbody>
  104. <@ for param in params @>
  105. <tr>
  106. <td><$ param.name $></td>
  107. <td><$ param.description | marked $></td>
  108. </tr>
  109. <@ endfor @>
  110. </tbody>
  111. </table>
  112. <@- endmacro -@>
  113. <@- macro functionSyntax(fn) @>
  114. <@- set sep = joiner(',&nbsp;') -@>
  115. <code><$ fn.name $><@- if not fn.isProperty @>(<@ endif -@><@- for param in fn.params @><$ sep() $>
  116. <@- if param.type.optional @>[<@ endif -@>
  117. <$ param.name $>
  118. <@- if param.type.optional @>]<@ endif -@>
  119. <@ endfor @><@- if not fn.isProperty @>)<@ endif -@></code>
  120. <@ if fn.alias @><small>(alias: <$ fn.alias $>)</small><@ endif @>
  121. <@ endmacro -@>
  122. <@ macro typeList(types) -@>
  123. <@ set separator = joiner("|") @>
  124. <@ for type in types @><$ separator() $><$ type | code $><@ endfor @>
  125. <@- endmacro -@>
  126. <@- macro typeInfo(fn) -@>
  127. <$ typeList(fn.typeList) $> <$ fn.description | marked $>
  128. <@- endmacro -@>
  129. <@ block body @>
  130. <@ block content @>
  131. <@ block header @>
  132. <h1 class="api-title">
  133. <a class="anchor" name="<$ doc.name | dashCase $>" href="#<$ doc.name | dashCase $>"></a>
  134. <@ if doc.docType == "directive" @>
  135. <$ doc.name | dashCase $>
  136. <@ else @>
  137. <$ doc.name $>
  138. <@- if doc.directiveInfo @>
  139. <h3><code><$ doc.directiveInfo.properties[0].values $></code></h3>
  140. <@ endif -@>
  141. <@ endif @>
  142. <@ if doc.parent @>
  143. <br />
  144. <small>
  145. Child of <$ doc.parent $>
  146. </small>
  147. <@ endif @>
  148. <@ if doc.delegate @>
  149. <br/>
  150. <small>
  151. Delegate: <$ doc.delegate $>
  152. </small>
  153. <@ endif @>
  154. </h1>
  155. <a class="improve-docs" href="http://github.com/ionic-team/ionic/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
  156. Improve this doc
  157. </a>
  158. <@ endblock @>
  159. <@ block description @>
  160. <$ doc.description | marked $>
  161. <@ endblock @>
  162. <!-- @usage tag -->
  163. <@ if doc.usage @>
  164. <h2><a class="anchor" name="usage" href="#usage"></a>Usage</h2>
  165. <@ block usage @>
  166. <$ doc.usage | marked $>
  167. <@ endblock @>
  168. <@ endif @>
  169. <!-- @property tags -->
  170. <@ if doc.properties @>
  171. <h2><a class="anchor" name="attributes" href="#attributes"></a>Attributes:</h2>
  172. <table class="table" style="margin:0;">
  173. <thead>
  174. <tr>
  175. <th>Attribute</th>
  176. <@ set hasTypes = false @>
  177. <@ for prop in doc.properties @>
  178. <@ if prop.type @>
  179. <@ set hasTypes = true @>
  180. <@ endif @>
  181. <@ endfor @>
  182. <@ if hasTypes @>
  183. <th>Type</th>
  184. <@ endif @>
  185. <th>Description</th>
  186. </tr>
  187. </thead>
  188. <tbody>
  189. <@ for prop in doc.properties @>
  190. <tr>
  191. <td>
  192. <$ prop.name $>
  193. </td>
  194. <@ if hasTypes @>
  195. <td>
  196. <$ prop.type.name $>
  197. </td>
  198. <@ endif @>
  199. <td>
  200. <$ prop.description $>
  201. </td>
  202. </tr>
  203. <@ endfor @>
  204. </tbody>
  205. </table>
  206. <@ endif @>
  207. <@- if doc.statics.length -@>
  208. <h2><a class="anchor" name="static-members" href="#static-members"></a>Static Members</h2>
  209. <@- for method in doc.statics @><@ if not method.internal @>
  210. <div id="<$ method.name $>"></div>
  211. <h3><a class="anchor" name="<$ method.name $>" href="#<$ method.name $>"></a><$ functionSyntax(method) $></h3>
  212. <$ method.description $>
  213. <@ if method.params @><$ paramTable(method.params) $><@ endif @>
  214. <@ if method.this @><h4> Method's `this` <$ method.this $></h4><@ endif @>
  215. <@ if method.returns @>
  216. <div class="anchor" class="return-value">
  217. <b>Returns:</b> <$ typeInfo(method.returns) $>
  218. <@ if method.returnsObjectParams @>
  219. <$ returnObject(method.returnsObjectParams) $>
  220. <@ endif @>
  221. </div>
  222. <@ endif @>
  223. <@ endif @>
  224. <@ endfor -@>
  225. <@ endif @>
  226. <!-- instance methods on the class -->
  227. <@- if doc.members and doc.members.length @>
  228. <h2><a class="anchor" name="instance-members" href="#instance-members"></a>Instance Members</h2>
  229. <@- for method in doc.members @>
  230. <div id="<$ method.name $>"></div>
  231. <h3><a class="anchor" name="<$ method.name $>" href="#<$ method.name $>"></a><$ functionSyntax(method) $></h3>
  232. <$ method.description $>
  233. <@ if method.params @><$ paramTable(method.params) $><@ endif @>
  234. <@ if method.this @>
  235. <h4> Method's `this` <$ method.this $></h4>
  236. <@ endif @>
  237. <@ if method.returns @>
  238. <div class="return-value">
  239. <b>Returns:</b> <$ typeInfo(method.returns) $>
  240. <@ if method.returnsObjectParams @>
  241. <$ returnObject(method.returnsObjectParams) $>
  242. <@ endif @>
  243. </div>
  244. <@ endif @>
  245. <@ endfor -@>
  246. <@- endif -@>
  247. <@- if doc.inputs and doc.inputs.length @>
  248. <!-- input methods on the class -->
  249. <h2><a class="anchor" name="input-properties" href="#input-properties"></a>Input Properties</h2>
  250. <$ inputTable(doc.inputs) $>
  251. <@- endif -@>
  252. <@- if doc.outputs and doc.outputs.length @>
  253. <!-- output events on the class -->
  254. <h2><a class="anchor" name="output-events" href="#output-events"></a>Output Events</h2>
  255. <$ outputTable(doc.outputs) $>
  256. <@- endif -@>
  257. <@ block advanced @>
  258. <@- if doc.advanced -@>
  259. <h2><a class="anchor" name="advanced" href="#advanced"></a>Advanced</h2>
  260. <$ doc.advanced | marked $>
  261. <@- endif -@>
  262. <@ endblock @>
  263. <!-- related link -->
  264. <@- if doc.see @>
  265. <h2><a class="anchor" name="related" href="#related"></a>Related</h2>
  266. <@ for s in doc.see @>
  267. <$ s | safe $> <@- if not loop.last @>,<@- endif -@>
  268. <@- endfor -@>
  269. <@- endif -@>
  270. <!-- end content block -->
  271. <@ endblock @>
  272. <!-- end body block -->
  273. <@ endblock @>