wheels 0.0.48 → 0.0.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. data/VERSION +1 -1
  2. data/app/controllers/access_control_entries_controller.rb +4 -4
  3. data/app/controllers/external_links_controller.rb +5 -0
  4. data/app/controllers/feedbacks_controller.rb +10 -0
  5. data/app/controllers/menus_controller.rb +2 -0
  6. data/app/controllers/pages_controller.rb +16 -29
  7. data/app/controllers/sitemaps_controller.rb +135 -0
  8. data/app/helpers/application_helper.rb +4 -3
  9. data/app/helpers/external_links_helper.rb +2 -0
  10. data/app/helpers/feedbacks_helper.rb +2 -0
  11. data/app/helpers/menus_helper.rb +2 -0
  12. data/app/helpers/sitemaps_helper.rb +12 -0
  13. data/app/mailers/feedback_mailer.rb +10 -0
  14. data/app/models/ability.rb +2 -1
  15. data/app/models/access_control_entry.rb +17 -15
  16. data/app/models/external_link.rb +4 -0
  17. data/app/models/feedback.rb +13 -0
  18. data/app/models/image.rb +1 -1
  19. data/app/models/menu.rb +4 -0
  20. data/app/models/page.rb +2 -5
  21. data/app/models/sitemap.rb +153 -0
  22. data/app/models/user.rb +7 -1
  23. data/app/validators/email_validator.rb +22 -0
  24. data/app/views/access_control_entries/_form.html.haml +1 -1
  25. data/app/views/access_control_entries/_index.html.haml +3 -3
  26. data/app/views/access_control_entries/_show.html.haml +1 -1
  27. data/app/views/external_links/_fields_for.html.haml +2 -0
  28. data/app/views/external_links/_form.html.haml +18 -0
  29. data/app/views/external_links/_show.html.haml +7 -0
  30. data/app/views/external_links/edit.html.haml +7 -0
  31. data/app/views/external_links/index.html.haml +23 -0
  32. data/app/views/external_links/new.html.haml +5 -0
  33. data/app/views/external_links/show.html.haml +2 -0
  34. data/app/views/feedback_mailer/submit_feedback.html.haml +22 -0
  35. data/app/views/feedbacks/_form.html.haml +37 -0
  36. data/app/views/feedbacks/index.html.haml +27 -0
  37. data/app/views/feedbacks/new.html.haml +5 -0
  38. data/app/views/feedbacks/show.html.haml +19 -0
  39. data/app/views/layouts/application.html.haml +21 -16
  40. data/app/views/layouts/bare.html.haml +2 -0
  41. data/app/views/loadbehind/_view.js.haml +1 -2
  42. data/app/views/menus/_form.html.haml +13 -0
  43. data/app/views/menus/edit.html.haml +7 -0
  44. data/app/views/menus/index.html.haml +19 -0
  45. data/app/views/menus/new.html.haml +5 -0
  46. data/app/views/menus/show.html.haml +7 -0
  47. data/app/views/pages/_child_pages_links.html.haml +1 -1
  48. data/app/views/pages/_control_panel.html.haml +1 -6
  49. data/app/views/pages/_form.html.haml +2 -2
  50. data/app/views/pages/_form_fields.html.haml +7 -2
  51. data/app/views/pages/_show.html.haml +4 -0
  52. data/app/views/pages/create.js.haml +2 -1
  53. data/app/views/pages/destroy.js.haml +3 -0
  54. data/app/views/pages/edit.js.haml +4 -0
  55. data/app/views/pages/index.html.haml +4 -2
  56. data/app/views/pages/index.js.haml +3 -0
  57. data/app/views/pages/new.js.haml +3 -0
  58. data/app/views/pages/show.html.haml +2 -10
  59. data/app/views/pages/show.js.haml +3 -0
  60. data/app/views/pages/update.js.haml +2 -2
  61. data/app/views/sitemaps/edit.html.haml +12 -0
  62. data/app/views/sitemaps/edit.js.erb +0 -0
  63. data/app/views/sitemaps/index.html.haml +93 -0
  64. data/app/views/sitemaps/index.json.erb +23 -0
  65. data/app/views/sitemaps/new.html.haml +8 -0
  66. data/app/views/sitemaps/new.js.erb +0 -0
  67. data/app/views/users/edit.html.haml +45 -0
  68. data/db/migrate/{add_fields_to_users.rb → 0010_add_fields_to_users.rb} +0 -0
  69. data/db/migrate/{create_blogs.rb → 0020_create_blogs.rb} +0 -0
  70. data/db/migrate/{create_galleries.rb → 0030_create_galleries.rb} +0 -0
  71. data/db/migrate/{create_images.rb → 0040_create_images.rb} +0 -0
  72. data/db/migrate/{create_profiles.rb → 0050_create_profiles.rb} +0 -0
  73. data/db/migrate/{insert_admin_user_and_roles.rb → 0060_insert_admin_user_and_roles.rb} +0 -0
  74. data/db/migrate/{create_pages.rb → 0070_create_pages.rb} +0 -0
  75. data/db/migrate/{create_forums.rb → 0080_create_forums.rb} +0 -0
  76. data/db/migrate/{create_discussions.rb → 0090_create_discussions.rb} +0 -0
  77. data/db/migrate/{create_forum_messages.rb → 0100_create_forum_messages.rb} +0 -0
  78. data/db/migrate/{create_access_control_entries.rb → 0110_create_access_control_entries.rb} +3 -3
  79. data/db/migrate/{create_attachments.rb → 0120_create_attachments.rb} +0 -4
  80. data/db/migrate/{create_roles.rb → 0130_create_roles.rb} +0 -0
  81. data/db/migrate/0140_create_feedbacks.rb +20 -0
  82. data/db/migrate/0150_create_external_links.rb +14 -0
  83. data/db/migrate/0160_create_sitemaps.rb +17 -0
  84. data/db/migrate/0170_create_menus.rb +14 -0
  85. data/lib/development_mail_interceptor.rb +7 -0
  86. data/lib/generators/wheels/recipes/wheels.rb +18 -12
  87. data/lib/wheels/base.rb +7 -0
  88. data/lib/wheels/routes.rb +8 -3
  89. data/lib/wheels.rb +2 -0
  90. data/public/javascripts/jquery-validate/additional-methods.js +259 -0
  91. data/public/javascripts/jquery-validate/changelog.txt +239 -0
  92. data/public/javascripts/jquery-validate/jquery.validate.js +1146 -0
  93. data/public/javascripts/jquery-validate/jquery.validate.min.js +16 -0
  94. data/public/javascripts/jquery-validate/jquery.validate.pack.js +15 -0
  95. data/public/javascripts/jquery-validate/lib/jquery-1.4.2.js +6240 -0
  96. data/public/javascripts/jquery-validate/lib/jquery.form.js +660 -0
  97. data/public/javascripts/jquery-validate/lib/jquery.js +4376 -0
  98. data/public/javascripts/jquery-validate/lib/jquery.metadata.js +122 -0
  99. data/public/javascripts/jquery-validate/localization/messages_ar.js +24 -0
  100. data/public/javascripts/jquery-validate/localization/messages_bg.js +23 -0
  101. data/public/javascripts/jquery-validate/localization/messages_cn.js +23 -0
  102. data/public/javascripts/jquery-validate/localization/messages_cs.js +23 -0
  103. data/public/javascripts/jquery-validate/localization/messages_da.js +20 -0
  104. data/public/javascripts/jquery-validate/localization/messages_de.js +20 -0
  105. data/public/javascripts/jquery-validate/localization/messages_el.js +24 -0
  106. data/public/javascripts/jquery-validate/localization/messages_es.js +23 -0
  107. data/public/javascripts/jquery-validate/localization/messages_fa.js +23 -0
  108. data/public/javascripts/jquery-validate/localization/messages_fi.js +21 -0
  109. data/public/javascripts/jquery-validate/localization/messages_fr.js +23 -0
  110. data/public/javascripts/jquery-validate/localization/messages_he.js +23 -0
  111. data/public/javascripts/jquery-validate/localization/messages_hu.js +20 -0
  112. data/public/javascripts/jquery-validate/localization/messages_it.js +23 -0
  113. data/public/javascripts/jquery-validate/localization/messages_kk.js +23 -0
  114. data/public/javascripts/jquery-validate/localization/messages_lt.js +23 -0
  115. data/public/javascripts/jquery-validate/localization/messages_lv.js +23 -0
  116. data/public/javascripts/jquery-validate/localization/messages_nl.js +23 -0
  117. data/public/javascripts/jquery-validate/localization/messages_no.js +23 -0
  118. data/public/javascripts/jquery-validate/localization/messages_pl.js +23 -0
  119. data/public/javascripts/jquery-validate/localization/messages_ptbr.js +23 -0
  120. data/public/javascripts/jquery-validate/localization/messages_ptpt.js +23 -0
  121. data/public/javascripts/jquery-validate/localization/messages_ro.js +23 -0
  122. data/public/javascripts/jquery-validate/localization/messages_ru.js +23 -0
  123. data/public/javascripts/jquery-validate/localization/messages_se.js +21 -0
  124. data/public/javascripts/jquery-validate/localization/messages_sk.js +20 -0
  125. data/public/javascripts/jquery-validate/localization/messages_tr.js +23 -0
  126. data/public/javascripts/jquery-validate/localization/messages_tw.js +23 -0
  127. data/public/javascripts/jquery-validate/localization/messages_ua.js +23 -0
  128. data/public/javascripts/jquery-validate/localization/methods_de.js +12 -0
  129. data/public/javascripts/jquery-validate/localization/methods_nl.js +9 -0
  130. data/public/javascripts/jquery-validate/localization/methods_pt.js +9 -0
  131. data/public/javascripts/jquery-validate/todo +172 -0
  132. data/public/javascripts/jquery.cookie.js +96 -0
  133. data/public/javascripts/jquery.filedrop.js +253 -0
  134. data/public/javascripts/jquery.hotkeys.js +99 -0
  135. data/public/javascripts/jquery.js +6240 -0
  136. data/public/javascripts/jquery.jstree.js +3510 -0
  137. data/public/javascripts/jquery.uploadify.js +26 -0
  138. data/public/javascripts/jquery.validate.js +1147 -0
  139. data/public/javascripts/sitemap_jstree.js +329 -0
  140. data/public/javascripts/swfobject.js +4 -0
  141. data/public/jstree/_demo/_dump.sql +20 -0
  142. data/public/jstree/_demo/_inc/__mysql_errors.log +0 -0
  143. data/public/jstree/_demo/_inc/class._database.php +146 -0
  144. data/public/jstree/_demo/_inc/class._database_i.php +152 -0
  145. data/public/jstree/_demo/_inc/class.tree.php +602 -0
  146. data/public/jstree/_demo/_install.txt +6 -0
  147. data/public/jstree/_demo/config.php +14 -0
  148. data/public/jstree/_demo/index.html +262 -0
  149. data/public/jstree/_demo/server.php +69 -0
  150. data/public/jstree/_docs/!style.css +37 -0
  151. data/public/jstree/_docs/_drive.png +0 -0
  152. data/public/jstree/_docs/_html_data.html +2 -0
  153. data/public/jstree/_docs/_json_data.json +4 -0
  154. data/public/jstree/_docs/_search_data.json +6 -0
  155. data/public/jstree/_docs/_search_result.json +1 -0
  156. data/public/jstree/_docs/_xml_flat.xml +12 -0
  157. data/public/jstree/_docs/_xml_nest.xml +18 -0
  158. data/public/jstree/_docs/checkbox.html +148 -0
  159. data/public/jstree/_docs/contextmenu.html +120 -0
  160. data/public/jstree/_docs/cookies.html +96 -0
  161. data/public/jstree/_docs/core.html +622 -0
  162. data/public/jstree/_docs/crrm.html +315 -0
  163. data/public/jstree/_docs/dnd.html +197 -0
  164. data/public/jstree/_docs/hotkeys.html +81 -0
  165. data/public/jstree/_docs/html_data.html +174 -0
  166. data/public/jstree/_docs/index.html +75 -0
  167. data/public/jstree/_docs/json_data.html +240 -0
  168. data/public/jstree/_docs/languages.html +138 -0
  169. data/public/jstree/_docs/search.html +114 -0
  170. data/public/jstree/_docs/sort.html +84 -0
  171. data/public/jstree/_docs/syntax/!script.js +2232 -0
  172. data/public/jstree/_docs/syntax/!style.css +511 -0
  173. data/public/jstree/_docs/syntax/clipboard.swf +0 -0
  174. data/public/jstree/_docs/syntax/help.png +0 -0
  175. data/public/jstree/_docs/syntax/magnifier.png +0 -0
  176. data/public/jstree/_docs/syntax/page_white_code.png +0 -0
  177. data/public/jstree/_docs/syntax/page_white_copy.png +0 -0
  178. data/public/jstree/_docs/syntax/printer.png +0 -0
  179. data/public/jstree/_docs/syntax/wrapping.png +0 -0
  180. data/public/jstree/_docs/themeroller.html +98 -0
  181. data/public/jstree/_docs/themes.html +126 -0
  182. data/public/jstree/_docs/types.html +173 -0
  183. data/public/jstree/_docs/ui.html +188 -0
  184. data/public/jstree/_docs/unique.html +70 -0
  185. data/public/jstree/_docs/xml_data.html +214 -0
  186. data/public/jstree/_lib/jquery.cookie.js +96 -0
  187. data/public/jstree/_lib/jquery.hotkeys.js +99 -0
  188. data/public/jstree/_lib/jquery.js +6240 -0
  189. data/public/jstree/jquery.jstree.js +3510 -0
  190. data/public/jstree/jstree.html +237 -0
  191. data/public/jstree/themes/apple/bg.jpg +0 -0
  192. data/public/jstree/themes/apple/d.png +0 -0
  193. data/public/jstree/themes/apple/dot_for_ie.gif +0 -0
  194. data/public/jstree/themes/apple/style.css +60 -0
  195. data/public/jstree/themes/apple/throbber.gif +0 -0
  196. data/public/jstree/themes/classic/d.png +0 -0
  197. data/public/jstree/themes/classic/dot_for_ie.gif +0 -0
  198. data/public/jstree/themes/classic/style.css +59 -0
  199. data/public/jstree/themes/classic/throbber.gif +0 -0
  200. data/public/jstree/themes/default/d.gif +0 -0
  201. data/public/jstree/themes/default/d.png +0 -0
  202. data/public/jstree/themes/default/style.css +73 -0
  203. data/public/jstree/themes/default/throbber.gif +0 -0
  204. data/public/jstree/themes/default-rtl/d.gif +0 -0
  205. data/public/jstree/themes/default-rtl/d.png +0 -0
  206. data/public/jstree/themes/default-rtl/dots.gif +0 -0
  207. data/public/jstree/themes/default-rtl/style.css +83 -0
  208. data/public/jstree/themes/default-rtl/throbber.gif +0 -0
  209. data/public/stylesheets/sass/dreamy.sass +21 -56
  210. data/public/stylesheets/sass/menu.sass +43 -9
  211. data/public/stylesheets/sass/uploadify.sass +52 -0
  212. data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  213. data/public/stylesheets/ui-lightness/jquery-ui-1.8.4.custom.css +549 -0
  214. data/wheels.gemspec +187 -15
  215. metadata +188 -16
@@ -0,0 +1,622 @@
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>jsTree Testing</title>
8
+ <script type="text/javascript" src="../_lib/jquery.js"></script>
9
+ <script type="text/javascript" src="../_lib/jquery.cookie.js"></script>
10
+ <script type="text/javascript" src="../_lib/jquery.hotkeys.js"></script>
11
+ <script type="text/javascript" src="../jquery.jstree.js"></script>
12
+
13
+ <link type="text/css" rel="stylesheet" href="syntax/!style.css"/>
14
+ <link type="text/css" rel="stylesheet" href="!style.css"/>
15
+ <script type="text/javascript" src="syntax/!script.js"></script>
16
+ </head>
17
+ <body>
18
+ <div id="container">
19
+
20
+ <h1>jsTree v.1.0 - Core</h1>
21
+ <h2>Description</h2>
22
+ <div id="description">
23
+ <h3>Including the files</h3>
24
+ <p>First of all, as jsTree is a jQuery component, you need to include jQuery itself. jsTree v.1.0 requires jQuery version 1.4.2</p>
25
+
26
+ <div class="code_f"><pre class="brush:xml;">
27
+ &lt;script type="text/javascript" src="_lib/jquery.js"&gt;&lt;/script&gt;
28
+ </pre></div>
29
+
30
+ <p>Then you need to include jsTree:</p>
31
+
32
+ <div class="code_f"><pre class="brush:xml;">
33
+ &lt;script type="text/javascript" src="jquery.jstree.js"&gt;&lt;/script&gt;
34
+ </pre></div>
35
+
36
+ <p>Or you could use the minified version:</p>
37
+
38
+ <div class="code_f"><pre class="brush:xml;">
39
+ &lt;script type="text/javascript" src="jquery.jstree.min.js"&gt;&lt/script&gt;
40
+ </pre></div>
41
+
42
+ <p>You may change the path to whatever you like, but it is recommended not to rename <code>jquery.tree.js</code> or <code>jquery.tree.min.js</code> as the filenames may be used for path autodetection (for example in the <code>themes</code> plugin, but if you really need to rename the file most plugins will give you the option to set the path manually).</p>
43
+
44
+ <p>Additionally some plugins have dependencies - plugins that detect a dependency is missing will throw an error.</p>
45
+
46
+ <h3>Creating and configuring an instance</h3>
47
+ <p>You can create a tree in the following manner:</p>
48
+
49
+ <div class="code_f"><pre class="brush:js;">
50
+ jQuery("some-selector-to-container-node-here").jstree([ config_object ]);
51
+ </pre></div>
52
+
53
+ <p>In the optional config object you specify all the options that you want to set. Each plugin will describe its configuration and defaults. In the <a href="#configuration">configuration section</a> below you will find the options defined by the core. Each plugin's options (even the core) are set in their own subobject, which is named after the plugin. For example all of the core's options are set in the <code>core</code> key of the config object:</p>
54
+ <div class="code_f"><pre class="brush:js;">
55
+ jQuery("some-selector-to-container-node-here")
56
+ .jstree({
57
+ core : {
58
+ /* core options go here */
59
+ }
60
+ });
61
+ </pre></div>
62
+
63
+ <p class="note">Please note that if your options for a given plugin are the same as the defaults you may omit those options or omit the subobject completely (if you do not need to modify the defaults).</p>
64
+
65
+ <p>There is only one special config option that is not a part of any plugin - this is the <code>plugins</code> option, which defines a list of active plugins for the instance being created. Although many plugins may be included, only the ones listed in this option will be active. The only autoincluded "plugin" is the jstree core.</p>
66
+
67
+ <div class="code_f"><pre class="brush:js;">
68
+ jQuery("some-selector-to-container-node-here")
69
+ .jstree({
70
+ core : { /* core options go here */ },
71
+ plugins : [ "themes", "html_data", "some-other-plugin" ]
72
+ });
73
+ </pre></div>
74
+
75
+ <h3>Interacting with the tree</h3>
76
+
77
+ <p>To perform an operation programatically on a given instance you can use two methods:</p>
78
+ <div class="code_f"><pre class="brush:js;">
79
+ /* METHOD ONE */
80
+ jQuery("some-selector-to-container-node-here")
81
+ .jstree("operation_name" [, argument_1, argument_2, ...]);
82
+
83
+ /* METHOD TWO */
84
+ jQuery.jstree._reference(needle)
85
+ /* NEEDLE can be a DOM node or selector for the container or a node within the container */
86
+ .operation_name([ argument_1, argument_2, ...]);
87
+ </pre></div>
88
+ <p class="note">NOTE: Functions prefixed with <code>_</code> can not be called with method one.</p>
89
+
90
+ <p>jsTree uses events to notify of any changes happening in the tree. All events fire on the tree container in the <code>jstree</code> namespace and are named after the function that triggered them. Please note that for some events it is best to bind before creating the instance. For example:</p>
91
+ <div class="code_f"><pre class="brush:js;">
92
+ jQuery("some-container")
93
+ .bind("loaded.jstree", function (event, data) {
94
+ alert("TREE IS LOADED");
95
+ })
96
+ .jstree({ /* configuration here */ });
97
+ </pre></div>
98
+ <p>Please note the second parameter <code>data</code>. Its structure is as follows:</p>
99
+ <div class="code_f"><pre class="brush:js;">
100
+ {
101
+ "inst" : /* the actual tree instance */,
102
+ "args" : /* arguments passed to the function */,
103
+ "rslt" : /* any data the function passed to the event */,
104
+ "rlbk" : /* an optional rollback object - it is not always present */
105
+ }
106
+ </pre></div>
107
+ <p>There is also one special event - <code>before.jstree</code>. This events enables you to prevent an operation from executing. Look at the <a href="#demos">demo</a> below.</p>
108
+
109
+ </div>
110
+
111
+ <h2 id="configuration">Configuration</h2>
112
+ <div class="panel configuration">
113
+
114
+ <h3>html_titles</h3>
115
+ <p class="meta">Boolean. Default is <code>false</code>.</p>
116
+ <p>Defines whether titles can contain HTML code.</p>
117
+
118
+ <h3>animation</h3>
119
+ <p class="meta">A number. Default is <code>500</code>.</p>
120
+ <p>Defines the duration of open/close animations. <code>0</code> means no animation.</p>
121
+
122
+ <h3>initially_open</h3>
123
+ <p class="meta">An array. Default is <code>[]</code>.</p>
124
+ <p>Defines which nodes are to be automatically opened when the tree finishes loading - a list of IDs is expected.</p>
125
+
126
+ <h3>rtl</h3>
127
+ <p class="meta">Boolean. Default is <code>false</code>.</p>
128
+ <p>Defines whether the tree is in right-to-left mode (also make sure you are using a RTL theme - for example the included <code>default-rtl</code>).</p>
129
+
130
+ <h3>strings</h3>
131
+ <p class="meta">Object. Default is <code>{ loading : "Loading ...", new_node : "New node" }</code>.</p>
132
+ <p>Contains strings needed for the operation of the tree so that you can localize.</p>
133
+
134
+
135
+ </div>
136
+
137
+ <h2 id="demos">Demos</h2>
138
+ <div class="panel">
139
+
140
+ <h3>Binding to an event and executing an action</h3>
141
+ <input type="button" class="button" value="toggle_node" id="toggle_node" style="clear:both;" />
142
+ <div id="demo1" class="demo">
143
+ <ul>
144
+ <li id="phtml_1">
145
+ <a href="#">Root node 1</a>
146
+ <ul>
147
+ <li id="phtml_2">
148
+ <a href="#">Child node 1</a>
149
+ </li>
150
+ <li id="phtml_3">
151
+ <a href="#">Child node 2</a>
152
+ </li>
153
+ </ul>
154
+ </li>
155
+ <li id="phtml_4">
156
+ <a href="#">Root node 2</a>
157
+ </li>
158
+ </ul>
159
+ </div>
160
+ <script type="text/javascript" class="source">
161
+ $(function () {
162
+ $("#toggle_node").click(function () {
163
+ $("#demo1").jstree("toggle_node","#phtml_1");
164
+ });
165
+ $("#demo1")
166
+ .bind("open_node.jstree close_node.jstree", function (e) {
167
+ $("#log1").html("Last operation: " + e.type);
168
+ })
169
+ .jstree({ "plugins" : [ "themes", "html_data" ] });
170
+ });
171
+ </script>
172
+ <p class="log" id="log1" style="clear:both;">&#160;</p>
173
+
174
+ <h3>Preventing an action</h3>
175
+ <p>This is the same demo as above, but this time the operation will be prevented.</p>
176
+ <input type="button" class="button" value="toggle_node" id="toggle_node2" style="clear:both;" />
177
+ <div id="demo2" class="demo">
178
+ <ul>
179
+ <li id="html_1">
180
+ <a href="#">Root node 1</a>
181
+ <ul>
182
+ <li id="html_2">
183
+ <a href="#">Child node 1</a>
184
+ </li>
185
+ <li id="html_3">
186
+ <a href="#">Child node 2</a>
187
+ </li>
188
+ </ul>
189
+ </li>
190
+ <li id="html_4">
191
+ <a href="#">Root node 2</a>
192
+ </li>
193
+ </ul>
194
+ </div>
195
+ <script type="text/javascript">
196
+ $(function () {
197
+ $("#toggle_node2").click(function () {
198
+ $("#demo2").jstree("toggle_node","#html_1");
199
+ });
200
+ $("#demo2")
201
+ .bind("open_node.jstree close_node.jstree", function (e) {
202
+ $("#log2").html("Last operation: " + e.type);
203
+ })
204
+ .jstree({ "plugins" : [ "themes", "html_data" ] });
205
+ });
206
+ </script>
207
+ <script type="text/javascript" class="source">
208
+ $(function () {
209
+ $("#demo2").bind("before.jstree", function (e, data) {
210
+ if(data.func === "open_node") {
211
+ $("#log2").html(data.args[0].attr("id"));
212
+ e.stopImmediatePropagation();
213
+ return false;
214
+ }
215
+ });
216
+ });
217
+ </script>
218
+ <p class="log" id="log2" style="clear:both;">&#160;</p>
219
+ <p>The important part is <code>e.stopImmediatePropagation(); return false</code>.</p>
220
+ </div>
221
+
222
+ <h2 id="api">API</h2>
223
+ <div class="panel api">
224
+ <p class="note">Use extra caution when working with functions prefixed with an underscore - <code>_</code>!<br />Those functions are probably for internal usage only.</p>
225
+
226
+
227
+ <h3 id="jstree.defaults">jQuery.jstree.defaults</h3>
228
+ <p class="meta">An object. Default is a collection of all included plugin's defaults.</p>
229
+ <p>This object is exposed so that you can apply standart settings to all future instances</p>
230
+
231
+ <h3 id="jstree.plugin">jQuery.jstree.plugin ( plugin_name , plugin_data )</h3>
232
+ <p>This function is used by developers to extend jstree (add "plugins").</p>
233
+ <ul class="arguments">
234
+ <li>
235
+ <code class="tp">string</code> <strong>plugin_name</strong>
236
+ <p>The plugin name - it should be unique.</p>
237
+ </li>
238
+ <li>
239
+ <code class="tp">object</code> <strong>plugin_data</strong>
240
+ <p>The plugin itself. It consists of <code>__init</code> &amp; <code>__destroy</code> functions, <code>defaults</code> object (that of course could be an array or a simple value) and a <code>_fn</code> object, whose keys are all the functions you are extending jstree with. You can overwrite functions (but you can in your function call the overriden old function), and you are responsible for triggering events and setting rollback points. You can omit any of the elements in the <code>plugin_data</code> param. Keep in mind jstree will automatically clear classes prepended with <code>jstree-</code> and all events in the <code>jstree</code> namespace when destroying a tree, so you do not need to worry about those.</p>
241
+ <p>Read jstree's code for examples on how to develop plugins.</p>
242
+ </li>
243
+ </ul>
244
+
245
+ <h3 id="jstree.rollback">jQuery.jstree.rollback ( rollback_object )</h3>
246
+ <p>This function will roll the tree back to the state specified by the rollback object</p>
247
+ <ul class="arguments">
248
+ <li>
249
+ <code class="tp">string</code> <strong>rollback_object</strong>
250
+ <p>Normally you will get this object from the event you are handling. You can of course use <code>.get_rollback()</code> to get the current state of the tree as a rollback object.</p>
251
+ <div class="code_f"><pre class="brush:js;">
252
+ $("some-container").bind("some-event.jstree", function (e, data) {
253
+ $.jstree.rollback(data.rlbk);
254
+ });</pre></div>
255
+ <p>Keep in mind that not all events will give you a rollback object - sometimes <code>data.rlbk</code> will be <code>false</code>.</p>
256
+ </li>
257
+ </ul>
258
+
259
+ <h3 id="jstree._focused">jQuery.jstree._focused ()</h3>
260
+ <p>Returns the currently focused tree instance on the page. If not interaction has been made - it is the last one to be created.</p>
261
+
262
+ <h3 id="jstree._reference">jQuery.jstree._reference ( needle )</h3>
263
+ <p>Returns the tree instance for the specified <code>needle</code>.</p>
264
+ <ul class="arguments">
265
+ <li>
266
+ <code class="tp">mixed</code> <strong>needle</strong>
267
+ <p>This can be a DOM node, jQuery node or selector pointing to the tree container, or an element within the tree.</p>
268
+ </li>
269
+ </ul>
270
+
271
+ <h3 id="jstree._instance">jQuery.jstree._instance ( index , container , settings )</h3>
272
+ <p>This function is used internally when creating new tree instances. Calling this function by itself is not enough to create a new instance. To create a tree use the documented method <code>$("selector").jstree([ options ])</code>.</p>
273
+
274
+ <h3 id="jstree._fn">jQuery.jstree._fn</h3>
275
+ <p>This object stores all functions included by plugins. It is used internally as a prototype for all instances - do not modify manually.</p>
276
+
277
+ <h3 id="data">.data</h3>
278
+ <p>An object where all plugins store instance specific data. Do not modify manually.</p>
279
+
280
+ <h3 id="get_settings">.get_settings ()</h3>
281
+ <p>Returns a copy of the instance's settings object - the defaults, extended by your own config object.</p>
282
+
283
+ <h3 id="_get_settings">._get_settings ()</h3>
284
+ <p>Returns the instance's settings object - the defaults, extended by your own config object.</p>
285
+
286
+ <h3 id="get_index">.get_index ()</h3>
287
+ <p>Returns the internal instance index.</p>
288
+
289
+ <h3 id="get_container">.get_container ()</h3>
290
+ <p>Returns the jQuery extended container node of the tree.</p>
291
+
292
+ <h3 id="_set_settings">._set_settings ( settings )</h3>
293
+ <p>Replace the settings object with the <code>settings</code> param. Please note that not all plugins will react to the change. Unless you know exactly what you are doing you'd be better off recreating the tree with the new settings.</p>
294
+
295
+ <h3 id="init">.init ()</h3>
296
+ <p>This function is used internally when creating a new instance. Triggers an event, which fires after the tree is initialized, but not yet loaded.</p>
297
+
298
+ <h3 id="destroy">.destroy ()</h3>
299
+ <p>Destroys the instance - it will automatically remove all bound events in the <code>jstree</code> namespace &amp; remove all classes starting with <code>jstree-</code>. Triggers an event.</p>
300
+
301
+ <h3 id="save_opened">.save_opened ()</h3>
302
+ <p>Stores the currently open nodes before refreshing. Used internally. Triggers an event.</p>
303
+
304
+ <h3 id="reopen">.reopen ( is_callback )</h3>
305
+ <p>Reopens all the nodes stored by <code>save_opened</code> or set in the <code>initially_open</code> config option on first load. It is called multiple times while reopening nodes - the <code>is_callback</code> param determines if this is the first call (<code>false</code>) or not. Used internally. Triggers an event.</p>
306
+
307
+ <h3 id="refresh">.refresh ( node )</h3>
308
+ <p>Refreshes the tree. Saves all open nodes, and reloads and then reopens all saved nodes. Triggers an event.</p>
309
+ <ul class="arguments">
310
+ <li>
311
+ <code class="tp">mixed</code> <strong>node</strong>
312
+ <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree. If set this will reload only the given node - otherwise - the whole tree. Passing <code>-1</code> also reloads the whole tree.</p>
313
+ </li>
314
+ </ul>
315
+
316
+ <h3 id="loaded">.loaded ()</h3>
317
+ <p>A dummy function, whose purpose is only to trigger the loaded event. This event is triggered once after the tree's root nodes are loaded, but before any nodes set in <code>initially_open</code> are opened.</p>
318
+
319
+ <h3 id="set_focus">.set_focus ()</h3>
320
+ <p>Makes the current instance the focused one on the page. Triggers an event.</p>
321
+
322
+ <h3 id="is_focused">.is_focused ()</h3>
323
+ <p>Returns <code>true</code> if the current instance is the focused one, otherwise returns <code>false</code>.</p>
324
+
325
+ <h3 id="_get_node">._get_node ( node )</h3>
326
+ <p>Return the jQuery extended <code>LI</code> element of the node, <code>-1</code> if the container node is passed, or <code>false</code> otherwise.</p>
327
+ <ul class="arguments">
328
+ <li>
329
+ <code class="tp">mixed</code> <strong>node</strong>
330
+ <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
331
+ </li>
332
+ </ul>
333
+
334
+ <h3 id="_get_next">._get_next ( node , strict )</h3>
335
+ <p>Gets the <code>LI</code> element representing the node next to the passed <code>node</code>. Returns <code>false</code> on failure.</p>
336
+ <ul class="arguments">
337
+ <li>
338
+ <code class="tp">mixed</code> <strong>node</strong>
339
+ <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree, whose next sibling we want.</p>
340
+ </li>
341
+ <li>
342
+ <code class="tp">bool</code> <strong>strict</strong>
343
+ <p>If set to <code>true</code> only immediate siblings are calculated. Otherwise if the <code>node</code> is the last child of its parent this function will "jump out" and return the parent's next sibling, etc. Default is <code>false</code>.</p>
344
+ </li>
345
+ </ul>
346
+
347
+ <h3 id="_get_prev">._get_prev ( node , strict )</h3>
348
+ <p>Gets the <code>LI</code> element representing the node previous to the passed <code>node</code>. Returns <code>false</code> on failure.</p>
349
+ <ul class="arguments">
350
+ <li>
351
+ <code class="tp">mixed</code> <strong>node</strong>
352
+ <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree, whose previous sibling we want.</p>
353
+ </li>
354
+ <li>
355
+ <code class="tp">bool</code> <strong>strict</strong>
356
+ <p>If set to <code>true</code> only immediate siblings are calculated. Otherwise if the <code>node</code> is the first child of its parent this function will "jump out" and return the parent itself. Default is <code>false</code>.</p>
357
+ </li>
358
+ </ul>
359
+
360
+ <h3 id="_get_parent">._get_parent ( node )</h3>
361
+ <p>Gets the <code>LI</code> element representing the parent of the passed <code>node</code>. Returns <code>false</code> on failure.</p>
362
+ <ul class="arguments">
363
+ <li>
364
+ <code class="tp">mixed</code> <strong>node</strong>
365
+ <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree, whose parent we want.</p>
366
+ </li>
367
+ </ul>
368
+
369
+ <h3 id="_get_children">._get_children ( node )</h3>
370
+ <p>Gets the <code>LI</code> elements representing the children of the passed <code>node</code>. Returns <code>false</code> on failure (or if the node has no children).</p>
371
+ <ul class="arguments">
372
+ <li>
373
+ <code class="tp">mixed</code> <strong>node</strong>
374
+ <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree, whose children we want. Use <code>-1</code> to return all root nodes.</p>
375
+ </li>
376
+ </ul>
377
+
378
+ <h3 id="get_path">.get_path ( node , id_mode )</h3>
379
+ <p>Return the path to a node, either as an array of IDs or as an array of node names.</p>
380
+ <ul class="arguments">
381
+ <li>
382
+ <code class="tp">mixed</code> <strong>node</strong>
383
+ <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree, whose path we want.</p>
384
+ </li>
385
+ <li>
386
+ <code class="tp">bool</code> <strong>id_mode</strong>
387
+ <p>If set to <code>true</code> IDs are returned instead of the names of the parents. Default is <code>false</code>.</p>
388
+ </li>
389
+ </ul>
390
+
391
+ <h3 id="open_node">.open_node ( node , callback , skip_animation )</h3>
392
+ <p>Opens a closed node, so that its children are visible. If the <code>animation</code> config option is greater than <code>0</code> the children are revealed using a slide down animation, whose duration is the value of the <code>animation</code> config option in milliseconds. Triggers an event.</p>
393
+ <ul class="arguments">
394
+ <li>
395
+ <code class="tp">mixed</code> <strong>node</strong>
396
+ <p>This can be a DOM node, jQuery node or selector pointing to an element we want opened.</p>
397
+ </li>
398
+ <li>
399
+ <code class="tp">function</code> <strong>callback</strong>
400
+ <p>A callback function executed once the node is opened. Used mostly internally, you'd be better of waiting for the event. You can skip this, by not specifying it, or by passing <code>false</code>.</p>
401
+ </li>
402
+ <li>
403
+ <code class="tp">bool</code> <strong>skip_animation</strong>
404
+ <p>If set to <code>true</code> the animation set in the <code>animation</code> config option is skipped. Default is <code>false</code>.</p>
405
+ </li>
406
+ </ul>
407
+
408
+ <h3 id="close_node">.close_node ( node , skip_animation )</h3>
409
+ <p>Closes an open node, so that its children are not visible. If the <code>animation</code> config option is greater than <code>0</code> the children are hidden using a slide up animation, whose duration is the value of the <code>animation</code> config option in milliseconds. Triggers an event.</p>
410
+ <ul class="arguments">
411
+ <li>
412
+ <code class="tp">mixed</code> <strong>node</strong>
413
+ <p>This can be a DOM node, jQuery node or selector pointing to an element we want closed.</p>
414
+ </li>
415
+ <li>
416
+ <code class="tp">bool</code> <strong>skip_animation</strong>
417
+ <p>If set to <code>true</code> the animation set in the <code>animation</code> config option is skipped. Default is <code>false</code>.</p>
418
+ </li>
419
+ </ul>
420
+
421
+ <h3 id="toggle_node">.toggle_node ( node )</h3>
422
+ <p>If a node is closed - this function opens it, if it is open - calling this function will close it.</p>
423
+ <ul class="arguments">
424
+ <li>
425
+ <code class="tp">mixed</code> <strong>node</strong>
426
+ <p>This can be a DOM node, jQuery node or selector pointing to an element we want toggled.</p>
427
+ </li>
428
+ </ul>
429
+
430
+ <h3 id="open_all">.open_all ( node , original_obj )</h3>
431
+ <p>Opens all descendants of the <code>node</code> node.</p>
432
+ <ul class="arguments">
433
+ <li>
434
+ <code class="tp">mixed</code> <strong>node</strong>
435
+ <p>This can be a DOM node, jQuery node or selector pointing to an element whose descendants you want opened. If this param is omitted or set to <code>-1</code> all nodes in the tree are opened.</p>
436
+ </li>
437
+ <li>
438
+ <code class="tp">mixed</code> <strong>original_obj</strong>
439
+ <p>Used internally when recursively calling the same function - do not pass this param.</p>
440
+ </li>
441
+ </ul>
442
+
443
+ <h3 id="close_all">.close_all ( node )</h3>
444
+ <p>Closes all descendants of the <code>node</code> node.</p>
445
+ <ul class="arguments">
446
+ <li>
447
+ <code class="tp">mixed</code> <strong>node</strong>
448
+ <p>This can be a DOM node, jQuery node or selector pointing to an element whose descendants you want closed. If this param is omitted or set to <code>-1</code> all nodes in the tree are closed.</p>
449
+ </li>
450
+ </ul>
451
+
452
+ <div style="height:1px; visibility:hidden;"><span id="is_leaf">&nbsp;</span><span id="is_closed">&nbsp;</span></div>
453
+ <h3 id="is_open">.is_open ( node ), .is_closed ( node ), .is_leaf ( node )</h3>
454
+ <p>Those function check if the <code>node</code> is in a state.</p>
455
+ <ul class="arguments">
456
+ <li>
457
+ <code class="tp">mixed</code> <strong>node</strong>
458
+ <p>This can be a DOM node, jQuery node or selector pointing to an element you want checked.</p>
459
+ </li>
460
+ </ul>
461
+
462
+ <h3 id="clean_node">.clean_node ( node )</h3>
463
+ <p>Applies all necessary classes to the <code>node</code> and its descendants. Used internally. Triggers an event.</p>
464
+ <ul class="arguments">
465
+ <li>
466
+ <code class="tp">mixed</code> <strong>node</strong>
467
+ <p>This can be a DOM node, jQuery node or selector pointing to an element you want cleaned. If this param is omitted or set to <code>-1</code> all nodes in the tree are cleaned.</p>
468
+ </li>
469
+ </ul>
470
+
471
+ <h3 id="get_rollback">.get_rollback ()</h3>
472
+ <p>Get the current tree's state in the rollback format. Used mainly internally by plugins.</p>
473
+
474
+ <h3 id="set_rollback">.set_rollback ( html , data )</h3>
475
+ <p>Rollback the tree. Used ONLY internally! Both arguments are part of the rollback object. If you need to rollback - take a look at <a href="#jstree.rollback">jQuery.jstree.rollback()</a>. Triggers event.</p>
476
+
477
+ <h3 id="load_node">.load_node ( node , success_callback , error_callback )</h3>
478
+ <p>A dummy function that is overwritten by data plugins. Triggers event.</p>
479
+ <ul class="arguments">
480
+ <li>
481
+ <code class="tp">mixed</code> <strong>node</strong>
482
+ <p>This can be a DOM node, jQuery node or selector pointing to an element you want loaded. Use <code>-1</code> for root nodes.</p>
483
+ </li>
484
+ <li>
485
+ <code class="tp">function</code> <strong>success_callback</strong>
486
+ <p>A function to be executed once the node is loaded successfully - used internally. You should wait for the event.</p>
487
+ </li>
488
+ <li>
489
+ <code class="tp">function</code> <strong>error_callback</strong>
490
+ <p>A function to be executed if the node is not loaded due to an error - used internally. You should wait for the event.</p>
491
+ </li>
492
+ </ul>
493
+
494
+ <h3 id="_is_loaded">._is_loaded ( node )</h3>
495
+ <p>A dummy function that should return <code>true</code> if the node's children are loaded or <code>false</code> otherwise.</p>
496
+ <ul class="arguments">
497
+ <li>
498
+ <code class="tp">mixed</code> <strong>node</strong>
499
+ <p>This can be a DOM node, jQuery node or selector pointing to an element you want to check.</p>
500
+ </li>
501
+ </ul>
502
+
503
+ <h3 id="create_node">.create_node ( node , position , js , callback , is_loaded )</h3>
504
+ <p>Creates the DOM structure necessary for a new node. Triggers an event.</p>
505
+ <ul class="arguments">
506
+ <li>
507
+ <code class="tp">mixed</code> <strong>node</strong>
508
+ <p>This can be a DOM node, jQuery node or selector pointing to the element you want to create in (or next to).</p>
509
+ </li>
510
+ <li>
511
+ <code class="tp">mixed</code> <strong>position</strong>
512
+ <p>The position of the newly created node. This can be a zero based index to position the element at a specific point among the current children. You can also pass in one of those strings: <code>"before"</code>, <code>"after"</code>, <code>"inside"</code>, <code>"first"</code>, <code>"last"</code>.</p>
513
+ </li>
514
+ <li>
515
+ <code class="tp">object</code> <strong>js</strong>
516
+ <p>The data for the newly created node. Consists of three keys:</p><p style="margin-left:25px;"><code class="tp">attr</code> - an object of attributes (same used for <code>jQuery.attr()</code>. You can omit this key;<br /><code class="tp">state</code> - a string - either <code>"open"</code> or <code>"closed"</code>, for a leaf node - omit this key;<br /><code class="tp">data</code> - a string or an object - if a string is passed it is used for the title of the node, if an object is passed there are two keys you can specify: <code>attr</code> and <code>title</code>;</p>
517
+ </li>
518
+ <li>
519
+ <code class="tp">function</code> <strong>callback</strong>
520
+ <p>A function to be executed once the node is created - used internally. You should wait for the event.</p>
521
+ </li>
522
+ <li>
523
+ <code class="tp">bool</code> <strong>is_loaded</strong>
524
+ <p>Specifies if the parent of the node is loaded or not - used ONLY internally.</p>
525
+ </li>
526
+ </ul>
527
+
528
+ <h3 id="get_text">.get_text ( node )</h3>
529
+ <p>Returns the title of a node.</p>
530
+ <ul class="arguments">
531
+ <li>
532
+ <code class="tp">mixed</code> <strong>node</strong>
533
+ <p>This can be a DOM node, jQuery node or selector pointing to the element whose title you need.</p>
534
+ </li>
535
+ </ul>
536
+
537
+ <h3 id="set_text">.set_text ( node , text )</h3>
538
+ <p>Sets the title of a node. Triggers an event. This is used mostly internally - wait for a <a href="#rename_node">.rename_node event</a> to avoid confusion.</p>
539
+ <ul class="arguments">
540
+ <li>
541
+ <code class="tp">mixed</code> <strong>node</strong>
542
+ <p>This can be a DOM node, jQuery node or selector pointing to the element whose title you want to change.</p>
543
+ </li>
544
+ <li>
545
+ <code class="tp">string</code> <strong>text</strong>
546
+ <p>The new title.</p>
547
+ </li>
548
+ </ul>
549
+
550
+ <h3 id="rename_node">.rename_node ( node , text )</h3>
551
+ <p>Sets the title of a node. Triggers an event.</p>
552
+ <ul class="arguments">
553
+ <li>
554
+ <code class="tp">mixed</code> <strong>node</strong>
555
+ <p>This can be a DOM node, jQuery node or selector pointing to the element whose title you want to change.</p>
556
+ </li>
557
+ <li>
558
+ <code class="tp">string</code> <strong>text</strong>
559
+ <p>The new title.</p>
560
+ </li>
561
+ </ul>
562
+
563
+ <h3 id="delete_node">.delete_node ( node )</h3>
564
+ <p>Removes a node. Triggers an event.</p>
565
+ <ul class="arguments">
566
+ <li>
567
+ <code class="tp">mixed</code> <strong>node</strong>
568
+ <p>This can be a DOM node, jQuery node or selector pointing to the element you want to remove.</p>
569
+ </li>
570
+ </ul>
571
+
572
+ <h3 id="prepare_move">.prepare_move ( o , r , pos , cb , is_cb )</h3>
573
+ <p>This function is used internally to prepare all necessary variables and nodes when moving a node around. It is automatically called as needed - you do not need to call it manually. Triggers an event.</p>
574
+
575
+ <h3 id="check_move">.check_move ()</h3>
576
+ <p>Checks if the prepared move is a valid one.</p>
577
+
578
+ <h3 id="move_node">.move_node ( node , ref , position , is_copy , is_prepared , skip_check )</h3>
579
+ <p>Moves a node to a new place. Triggers an event.</p>
580
+ <ul class="arguments">
581
+ <li>
582
+ <code class="tp">mixed</code> <strong>node</strong>
583
+ <p>This can be a DOM node, jQuery node or selector pointing to the element you want to move.</p>
584
+ </li>
585
+ <li>
586
+ <code class="tp">mixed</code> <strong>ref</strong>
587
+ <p>This can be a DOM node, jQuery node or selector pointing to the element which will be the reference element in the move. <code>-1</code> may be used too (to indicate the container node).</p>
588
+ </li>
589
+ <li>
590
+ <code class="tp">mixed</code> <strong>position</strong>
591
+ <p>The new position of the moved node. This can be a zero based index to position the element at a specific point among the reference node's current children. You can also use one of these strings: <code>"before"</code>, <code>"after"</code>, <code>"inside"</code>, <code>"first"</code>, <code>"last"</code>.</p>
592
+ </li>
593
+ <li>
594
+ <code class="tp">bool</code> <strong>is_copy</strong>
595
+ <p>Should this be a copy or a move operation.</p>
596
+ </li>
597
+ <li>
598
+ <code class="tp">bool</code> <strong>is_prepared</strong>
599
+ <p>Used internally when this function is called recursively.</p>
600
+ </li>
601
+ <li>
602
+ <code class="tp">bool</code> <strong>skip_check</strong>
603
+ <p>If this is set to <code>true</code> <a href="#check_move">check_move</a> is not called.</p>
604
+ </li>
605
+ </ul>
606
+
607
+ <h3 id="_get_move">._get_move ()</h3>
608
+ <p>Returns the lastly prepared move. The returned object contains:<br />
609
+ <code>.o</code> - the node being moved<br />
610
+ <code>.r</code> - the reference node in the move<br />
611
+ <code>.ot</code> - the origin tree instance<br />
612
+ <code>.rt</code> - the reference tree instance<br />
613
+ <code>.p</code> - the position to move to (may be a string - <code>"last"</code>, <code>"first"</code>, etc)<br />
614
+ <code>.cp</code> - the calculated position to move to (always a number)<br />
615
+ <code>.np</code> - the new parent<br />
616
+ </p>
617
+
618
+ </div>
619
+
620
+ </div>
621
+ </body>
622
+ </html>