You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.1 KiB

  1. ---
  2. layout : 'default'
  3. css : 'module'
  4. title : 'UI Modules'
  5. description : 'Modules are interface elements whose behavior is an essential part of their definition'
  6. type : 'Semantic'
  7. ---
  8. <%- @partial('header') %>
  9. <div class="main container">
  10. <div class="peek">
  11. <div class="ui vertical pointing secondary menu">
  12. <a class="active item">Settings</a>
  13. </div>
  14. </div>
  15. <h2 class="ui dividing header">Settings</h2>
  16. <p>Settings in UI widgets are any part of a widget definition which is mutable. Most UI widgets have a set of common settings which are useful across all plugins.
  17. <h3 class="ui header">Common Settings</h3>
  18. <table class="ui celled table segment">
  19. <thead>
  20. <th>Name</th>
  21. <th>Usage</th>
  22. </thead>
  23. <tr>
  24. <td>name</td>
  25. <td>Name used in debug logs to differentiate this widget from other debug statements.</td>
  26. </tr>
  27. <tr>
  28. <td>debug</td>
  29. <td>Provides standard debug output to console.</td>
  30. </tr>
  31. <tr>
  32. <td>performance</td>
  33. <td>Provides performance logging to console of internal method calls.</td>
  34. </tr>
  35. <tr>
  36. <td>verbose</td>
  37. <td>Provides extra debug output to console</td>
  38. </tr>
  39. <tr>
  40. <td>namespace</td>
  41. <td>Namespace used for DOM event and metadata namespacing. Allows module's destroy method to not affect other modules.</td>
  42. </tr>
  43. <tr>
  44. <td>metadata</td>
  45. <td>An object containing any metadata attributes used.</td>
  46. </tr>
  47. <tr>
  48. <td>selectors</td>
  49. <td>An object containing all selectors used in the module, these are usually children of the module.</td>
  50. </tr>
  51. <tr>
  52. <td>classNames</td>
  53. <td>An object containing all classnames used in the module.</td>
  54. </tr>
  55. <tr>
  56. <td>errors</td>
  57. <td colspan="2">A javascript array of error statements used in the plugin. These may sometimes appear to the user, but most often appear in debug statements.
  58. </td>
  59. </tr>
  60. </tbody>
  61. </table>
  62. <h3 class="ui header">Changing Settings</h3>
  63. <ol class="ui list">
  64. <li>A settings object can be passed in when initializing the plugin
  65. <br>
  66. <div class="code">
  67. $('.foo')
  68. .module({
  69. moduleName: 'Godzilla',
  70. verbose: true
  71. })
  72. ;
  73. </div>
  74. </li>
  75. <li>Default settings for the module can be overridden by modifying $.fn.module.settings.
  76. <br><div class="code">$.fn.module.settings.moduleName = 'Godzilla';</div>
  77. </li>
  78. <li>Settings can be changed after a module is initialized by calling the 'settings' method on the module with either a settings object or a name, value pair.
  79. <br>
  80. <div class="code">
  81. $('.foo')
  82. // lets initialize that!
  83. .module()
  84. // oh wait forgot something
  85. .module('setting', 'moduleName', 'Godzilla')
  86. ;
  87. </div>
  88. </li>
  89. </ol>
  90. <h3 class="ui header">Reading Settings</h3>
  91. <p>Settings can also be read programmatically:
  92. <div class="code">
  93. $('.foo').module('setting', 'moduleName');
  94. // outputs godzilla
  95. </div>
  96. </div>
  97. </body>
  98. </html>