bone_tree 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +190 -0
- data/Guardfile +14 -0
- data/README +1 -0
- data/Rakefile +21 -0
- data/app/assets/images/bonetree.png +0 -0
- data/app/assets/images/crushed_bone.png +0 -0
- data/app/assets/index.html +439 -0
- data/app/assets/javascripts/bone_tree.js +1292 -0
- data/app/assets/stylesheets/bone_tree.css +186 -0
- data/app/assets/stylesheets/bone_tree_repo.css +73 -0
- data/bone_tree-0.0.1.gem +0 -0
- data/bone_tree.gemspec +20 -0
- data/config.rb +26 -0
- data/config.ru +4 -0
- data/docs/index.html +222 -0
- data/docs/resources/base.css +70 -0
- data/docs/resources/index.css +20 -0
- data/docs/resources/module.css +24 -0
- data/docs/source/javascripts/bone_tree/_namespace.js.html +45 -0
- data/docs/source/javascripts/bone_tree/models/_directory.js.html +126 -0
- data/docs/source/javascripts/bone_tree/models/_file.js.html +112 -0
- data/docs/source/javascripts/bone_tree/models/_nodes.js.html +174 -0
- data/docs/source/javascripts/bone_tree/models/_settings.js.html +75 -0
- data/docs/source/javascripts/bone_tree/views/_directory.js.html +94 -0
- data/docs/source/javascripts/bone_tree/views/_file.js.html +82 -0
- data/docs/source/javascripts/bone_tree/views/_menu.js.html +110 -0
- data/docs/source/javascripts/bone_tree/views/_tree.js.html +432 -0
- data/lib/version.rb +4 -0
- data/source/images/bonetree.png +0 -0
- data/source/images/crushed_bone.png +0 -0
- data/source/index.html.haml +438 -0
- data/source/javascripts/_backbone.js +1293 -0
- data/source/javascripts/_jquery.min.js +5 -0
- data/source/javascripts/_underscore.js +999 -0
- data/source/javascripts/bone_tree/_namespace.js.coffee +7 -0
- data/source/javascripts/bone_tree/models/_directory.js.coffee +63 -0
- data/source/javascripts/bone_tree/models/_file.js.coffee +55 -0
- data/source/javascripts/bone_tree/models/_nodes.js.coffee +117 -0
- data/source/javascripts/bone_tree/models/_settings.js.coffee +25 -0
- data/source/javascripts/bone_tree/views/_directory.js.coffee +73 -0
- data/source/javascripts/bone_tree/views/_file.js.coffee +49 -0
- data/source/javascripts/bone_tree/views/_menu.js.coffee +97 -0
- data/source/javascripts/bone_tree/views/_tree.js.coffee +498 -0
- data/source/javascripts/bone_tree.js.coffee +1 -0
- data/source/layout.haml +13 -0
- data/source/stylesheets/bone_tree.css.sass +107 -0
- data/source/stylesheets/bone_tree_repo.css.sass +65 -0
- data/spec/javascripts/directory_view_spec.coffee +91 -0
- data/spec/javascripts/file_view_spec.coffee +70 -0
- data/spec/javascripts/helpers/spec_helper.coffee +7 -0
- data/spec/javascripts/menu_view_spec.coffee +42 -0
- data/spec/javascripts/nodes_spec.coffee +37 -0
- data/spec/javascripts/support/jasmine.yml +8 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/javascripts/tree_view_spec.coffee +39 -0
- metadata +123 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>_file.js.coffee</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
7
|
+
<link rel="stylesheet" media="all" href="../../../../resources/base.css" />
|
8
|
+
<link rel="stylesheet" media="all" href="../../../../resources/module.css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<header>
|
12
|
+
<h1>_file.js.coffee</h1>
|
13
|
+
</header>
|
14
|
+
<div id="content">
|
15
|
+
<div id="sidebar">
|
16
|
+
|
17
|
+
<h4>Classes</h4>
|
18
|
+
<ul class="classlist">
|
19
|
+
|
20
|
+
<li><a href="#Views.File">Views.File</a></li>
|
21
|
+
|
22
|
+
</ul>
|
23
|
+
|
24
|
+
|
25
|
+
</div>
|
26
|
+
<div id="main">
|
27
|
+
|
28
|
+
|
29
|
+
<div id="classes">
|
30
|
+
<h2>Classes</h2>
|
31
|
+
|
32
|
+
<div class="class">
|
33
|
+
<div class="header">
|
34
|
+
<a id="Views.File"><h3>Views.File</h3></a>
|
35
|
+
|
36
|
+
|
37
|
+
<a class="parent" href="#Backbone.View"><h3>extends Backbone.View</h3></a>
|
38
|
+
|
39
|
+
|
40
|
+
</div>
|
41
|
+
<div class="class_content">
|
42
|
+
<p>Internal: View that renders a File node and controls its behavior (class: 'file', tag: 'li').</p>
|
43
|
+
<div class="methods">
|
44
|
+
|
45
|
+
|
46
|
+
<div class="instancemethods">
|
47
|
+
<h3>Instance Methods</h3>
|
48
|
+
|
49
|
+
<div class="method">
|
50
|
+
<h4>initialize(options)</h4>
|
51
|
+
<p>Internal: Initialize a new file node. Adds associated model cid to the
|
52
|
+
view element. Binds change handlers to the <code>change:name</code> and
|
53
|
+
<code>change:extension</code> events. These take care of resorting the file
|
54
|
+
nodes.</p>
|
55
|
+
|
56
|
+
<ul>
|
57
|
+
<li>options - Passes in settings object, which is used to control
|
58
|
+
whether or not file extensions are shown.</li>
|
59
|
+
</ul>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div class="method">
|
63
|
+
<h4>render()</h4>
|
64
|
+
<p>Internal: Sets the text of the file node according to the underlying model
|
65
|
+
name. If the 'showExtensions' setting is set, renders the
|
66
|
+
full file name with extension, otherwise renders just the file
|
67
|
+
name attribute.</p>
|
68
|
+
</div>
|
69
|
+
|
70
|
+
</div>
|
71
|
+
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
</body>
|
82
|
+
</html>
|
@@ -0,0 +1,110 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>_menu.js.coffee</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
7
|
+
<link rel="stylesheet" media="all" href="../../../../resources/base.css" />
|
8
|
+
<link rel="stylesheet" media="all" href="../../../../resources/module.css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<header>
|
12
|
+
<h1>_menu.js.coffee</h1>
|
13
|
+
</header>
|
14
|
+
<div id="content">
|
15
|
+
<div id="sidebar">
|
16
|
+
|
17
|
+
<h4>Classes</h4>
|
18
|
+
<ul class="classlist">
|
19
|
+
|
20
|
+
<li><a href="#Views.Menu">Views.Menu</a></li>
|
21
|
+
|
22
|
+
</ul>
|
23
|
+
|
24
|
+
|
25
|
+
</div>
|
26
|
+
<div id="main">
|
27
|
+
|
28
|
+
|
29
|
+
<div id="classes">
|
30
|
+
<h2>Classes</h2>
|
31
|
+
|
32
|
+
<div class="class">
|
33
|
+
<div class="header">
|
34
|
+
<a id="Views.Menu"><h3>Views.Menu</h3></a>
|
35
|
+
|
36
|
+
|
37
|
+
<a class="parent" href="#Backbone.View"><h3>extends Backbone.View</h3></a>
|
38
|
+
|
39
|
+
|
40
|
+
</div>
|
41
|
+
<div class="class_content">
|
42
|
+
<p>Internal: View that controls the context menu (class: 'filetree_context_menu').</p>
|
43
|
+
|
44
|
+
<p>Events</p>
|
45
|
+
|
46
|
+
<ul>
|
47
|
+
<li><p>contextMenu - Prevents the standard browser context menu from appearing
|
48
|
+
when right clicking within the file tree context menu.</p></li>
|
49
|
+
<li><p>click .rename - Prompts the user to rename a file.</p></li>
|
50
|
+
<li><p>click .delete - Deletes a node from the file tree.</p></li>
|
51
|
+
</ul>
|
52
|
+
<div class="methods">
|
53
|
+
|
54
|
+
|
55
|
+
<div class="instancemethods">
|
56
|
+
<h3>Instance Methods</h3>
|
57
|
+
|
58
|
+
<div class="method">
|
59
|
+
<h4>initialize(options)</h4>
|
60
|
+
<p>Internal: Initialize a new menu widget.</p>
|
61
|
+
|
62
|
+
<ul>
|
63
|
+
<li>options - An Object. Internally used to pass the settings configuration
|
64
|
+
into the menu. This controls whether or not the user is
|
65
|
+
prompted to confirm deleting a file.</li>
|
66
|
+
</ul>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div class="method">
|
70
|
+
<h4>contextMenu(e)</h4>
|
71
|
+
<p>Internal: Kill the default browser behavior for the contextmenu event.</p>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
<div class="method">
|
75
|
+
<h4>delete(e)</h4>
|
76
|
+
<p>Internal: Deletes a node from the file tree. If the confirmDeletes setting
|
77
|
+
is set, prompts the user for delete confirmation.</p>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<div class="method">
|
81
|
+
<h4>rename(e)</h4>
|
82
|
+
<p>Internal: Prompts the user to rename a File or Directory.</p>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div class="method">
|
86
|
+
<h4>render()</h4>
|
87
|
+
<p>Internal: Renders the <ul> that contains the context menu choices
|
88
|
+
'Rename' and 'Delete'.</p>
|
89
|
+
|
90
|
+
<p>Returns <code>this</code>, the menu view.</p>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div class="method">
|
94
|
+
<h4>template()</h4>
|
95
|
+
<p>Internal: html template for the context menu.</p>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
</body>
|
110
|
+
</html>
|
@@ -0,0 +1,432 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>_tree.js.coffee</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
7
|
+
<link rel="stylesheet" media="all" href="../../../../resources/base.css" />
|
8
|
+
<link rel="stylesheet" media="all" href="../../../../resources/module.css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<header>
|
12
|
+
<h1>_tree.js.coffee</h1>
|
13
|
+
</header>
|
14
|
+
<div id="content">
|
15
|
+
<div id="sidebar">
|
16
|
+
|
17
|
+
<h4>Classes</h4>
|
18
|
+
<ul class="classlist">
|
19
|
+
|
20
|
+
<li><a href="#Views.Tree">Views.Tree</a></li>
|
21
|
+
|
22
|
+
</ul>
|
23
|
+
|
24
|
+
|
25
|
+
</div>
|
26
|
+
<div id="main">
|
27
|
+
|
28
|
+
|
29
|
+
<div id="classes">
|
30
|
+
<h2>Classes</h2>
|
31
|
+
|
32
|
+
<div class="class">
|
33
|
+
<div class="header">
|
34
|
+
<a id="Views.Tree"><h3>Views.Tree</h3></a>
|
35
|
+
|
36
|
+
|
37
|
+
<a class="parent" href="#Backbone.View"><h3>extends Backbone.View</h3></a>
|
38
|
+
|
39
|
+
|
40
|
+
</div>
|
41
|
+
<div class="class_content">
|
42
|
+
<p>Public: The base tree object. Events from other objects are proxied to the tree
|
43
|
+
so API consumers only need to know about this top level object.</p>
|
44
|
+
<div class="methods">
|
45
|
+
|
46
|
+
|
47
|
+
<div class="instancemethods">
|
48
|
+
<h3>Instance Methods</h3>
|
49
|
+
|
50
|
+
<div class="method">
|
51
|
+
<h4>initialize()</h4>
|
52
|
+
<p>Public: Initialize a new filetree widget</p>
|
53
|
+
|
54
|
+
<ul>
|
55
|
+
<li>options - An Object of global configuration options for the file tree.
|
56
|
+
<ul><li>autoOpenFiles - A Boolean. If true, each file that is added to the tree
|
57
|
+
immediately triggers an <code>openFile</code> event (default: true).</li>
|
58
|
+
<li>beforeAdd - A Function that is invoked before each file is added to the tree.
|
59
|
+
It is passed the raw file attributes and should return true if
|
60
|
+
that file should be added to the tree and false if not. The
|
61
|
+
default implementation is to return true.</li>
|
62
|
+
<li>confirmDeletes - A Boolean. If true, the tree will prompt the user, making
|
63
|
+
sure they want to delete the file (default: false).</li>
|
64
|
+
<li>showExtensions - A Boolean. If true, files display their extensions. Internally,
|
65
|
+
extensions are always kept track of but by default they are
|
66
|
+
hidden (default: false).</li></ul></li>
|
67
|
+
</ul>
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div class="method">
|
71
|
+
<h4>addFile(filePath, fileData)</h4>
|
72
|
+
<p>Public: Method to add files and associated file data to the tree.</p>
|
73
|
+
|
74
|
+
<ul>
|
75
|
+
<li>filePath - A String that represents the directory path to the file.
|
76
|
+
Directories that don't yet exist will be created. If no
|
77
|
+
file is specified, eg. '/dir1/dir2/' then only the directories
|
78
|
+
will be created and this method will return null.</li>
|
79
|
+
<li>fileData - An Object of attributes to store in the File object. This
|
80
|
+
could represent information such as lastModified, fileContents,
|
81
|
+
fileCreator, etc.</li>
|
82
|
+
</ul>
|
83
|
+
|
84
|
+
<p>Examples</p>
|
85
|
+
|
86
|
+
<pre><code>tree.addFile '/source/main.coffee',
|
87
|
+
contents: "alert('hello world.')"
|
88
|
+
lastModified: 1330725130170
|
89
|
+
# => <File>
|
90
|
+
</code></pre>
|
91
|
+
|
92
|
+
<p>Returns the File object if it was created and null if no file was given.</p>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div class="method">
|
96
|
+
<h4>addFromJSON(data, currentPath)</h4>
|
97
|
+
<p>Public: Creates a file tree from a JSON representation. Expects the
|
98
|
+
JSON object to have a <code>name</code> property at each level, specifying
|
99
|
+
the name of the file or directory, and a files array if the
|
100
|
+
current node has child directories or files.</p>
|
101
|
+
|
102
|
+
<ul>
|
103
|
+
<li><p>data - An Object that represents hierarchical file data.</p></li>
|
104
|
+
<li><p>currentPath - A String representing the current location in the tree.
|
105
|
+
Defaults to the file tree root. (default: "")</p></li>
|
106
|
+
</ul>
|
107
|
+
|
108
|
+
<p>Examples</p>
|
109
|
+
|
110
|
+
<pre><code>data = {
|
111
|
+
name: "My Project"
|
112
|
+
files: [
|
113
|
+
{ name: "Empty Folder" }
|
114
|
+
{ name: "SomeFile.coffee" }
|
115
|
+
{ name: "AnotherFile.coffee" }
|
116
|
+
{
|
117
|
+
name: "Folder with Files inside"
|
118
|
+
files: [
|
119
|
+
{ name: "NestedFile.coffee" }
|
120
|
+
]
|
121
|
+
}
|
122
|
+
]
|
123
|
+
}
|
124
|
+
|
125
|
+
tree.addFromJSON(data)
|
126
|
+
# => <Tree>
|
127
|
+
</code></pre>
|
128
|
+
|
129
|
+
<p>Returns the Tree view object.</p>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div class="method">
|
133
|
+
<h4>addToTree(currentDirectory, remainingDirectories, fileName)</h4>
|
134
|
+
<p>Internal: Recursive method that traverses nodes, creating
|
135
|
+
Files and Directories.</p>
|
136
|
+
|
137
|
+
<ul>
|
138
|
+
<li>currentDirectory - A Node object representing which directory we are
|
139
|
+
adding the current Directory or File to.</li>
|
140
|
+
<li>remainingDirectories - A '/' separated String representing the remaining
|
141
|
+
directories to add.</li>
|
142
|
+
<li>fileName - The String name of the file to be added. This can
|
143
|
+
include the extension name separated by a '.'.</li>
|
144
|
+
</ul>
|
145
|
+
|
146
|
+
<p>Examples</p>
|
147
|
+
|
148
|
+
<pre><code>tree.addToTree(@root, '/source/subdirectory/', 'main.coffee')
|
149
|
+
# => <File>
|
150
|
+
</code></pre>
|
151
|
+
|
152
|
+
<p>Returns the File object if it was created and null if no file was given.</p>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div class="method">
|
156
|
+
<h4>beforeAdd(fileData)</h4>
|
157
|
+
<p>Internal: This function provides a filter to exclude files from the
|
158
|
+
file tree based on conditions from their raw data. This function
|
159
|
+
shouldn't be modified directly, it should instead by passed in
|
160
|
+
as an option when instantiating the file tree. The default
|
161
|
+
implementation is to return true and allow all files to be
|
162
|
+
added to the tree.</p>
|
163
|
+
|
164
|
+
<ul>
|
165
|
+
<li>fileData - An Object containing the raw attributes of the file to be
|
166
|
+
created. Use these to determine conditions to allow or
|
167
|
+
exclude files from the tree.</li>
|
168
|
+
</ul>
|
169
|
+
|
170
|
+
<p>Examples</p>
|
171
|
+
|
172
|
+
<pre><code># set up a beforeAdd filter on the tree view
|
173
|
+
tree = new BoneTree.Views.Tree
|
174
|
+
beforeAdd: (fileData) ->
|
175
|
+
if fileData.extension is 'wav'
|
176
|
+
return false
|
177
|
+
else
|
178
|
+
return true
|
179
|
+
</code></pre>
|
180
|
+
|
181
|
+
<p>Returns true if the file should be added to the tree and false otherwise.</p>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
<div class="method">
|
185
|
+
<h4>findOrCreateView(node)</h4>
|
186
|
+
<p>Internal: Look up existing view in the view cache or Create a new view
|
187
|
+
of the correct type (either File or Directory).</p>
|
188
|
+
|
189
|
+
<ul>
|
190
|
+
<li>node - A Node object. Either a File object or a Directory object.
|
191
|
+
This is the model that the view will be associated with.</li>
|
192
|
+
</ul>
|
193
|
+
|
194
|
+
<p>Examples</p>
|
195
|
+
|
196
|
+
<pre><code>file = new BoneTree.Models.File
|
197
|
+
|
198
|
+
# This will create a new view since we just created the File
|
199
|
+
tree.findOrCreateView(file)
|
200
|
+
# => <FileView>
|
201
|
+
</code></pre>
|
202
|
+
|
203
|
+
<p>Returns the view corresponding to the model passed in.</p>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div class="method">
|
207
|
+
<h4>getModelByCid(cid)</h4>
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div class="method">
|
212
|
+
<h4>closeDirectories()</h4>
|
213
|
+
<p>Public: Close all the directories in the file tree.</p>
|
214
|
+
|
215
|
+
<p>Examples</p>
|
216
|
+
|
217
|
+
<pre><code>tree.closeDirectories()
|
218
|
+
# => <Tree>
|
219
|
+
</code></pre>
|
220
|
+
|
221
|
+
<p>Returns the Tree view object.</p>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div class="method">
|
225
|
+
<h4>closeMenu(e)</h4>
|
226
|
+
<p>Internal: Close the context menu. This is called every click on
|
227
|
+
the document and closes the menu unless you are clicking
|
228
|
+
within it. This shouldn't be called directly, it is called
|
229
|
+
automatically by Backbone from user interactions.</p>
|
230
|
+
|
231
|
+
<p>Returns the Menu view object.</p>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="method">
|
235
|
+
<h4>contextMenu(e)</h4>
|
236
|
+
<p>Internal: Open the context menu. This prevents the default browser
|
237
|
+
context menu event. This shouldn't be called directly, it is
|
238
|
+
called automatically by Backbone from user interations.</p>
|
239
|
+
|
240
|
+
<p>Returns the Menu view object.</p>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div class="method">
|
244
|
+
<h4>filterNodes(nodeType, nodeName)</h4>
|
245
|
+
<p>Internal: Returns file tree nodes that match the nodeType and nodeName.</p>
|
246
|
+
|
247
|
+
<ul>
|
248
|
+
<li>nodeType - A String that represents the nodeType to match. Choices are
|
249
|
+
'file' or 'directory'.</li>
|
250
|
+
<li>nodeName - A String that represents the name of the node to match.</li>
|
251
|
+
</ul>
|
252
|
+
|
253
|
+
<p>Examples</p>
|
254
|
+
|
255
|
+
<pre><code># Add some files to the tree
|
256
|
+
tree.addFile('/source/main.coffee')
|
257
|
+
tree.addFile('/source/player.coffee')
|
258
|
+
|
259
|
+
# returns an array containing the File 'main.coffee'
|
260
|
+
tree.filterNodes('file', 'main')
|
261
|
+
# => [<File>]
|
262
|
+
</code></pre>
|
263
|
+
|
264
|
+
<p>Returns an Array of nodes that match the filter criteria.</p>
|
265
|
+
</div>
|
266
|
+
|
267
|
+
<div class="method">
|
268
|
+
<h4>flatten(currentNode, results)</h4>
|
269
|
+
<p>Internal: Returns a one dimensional ordered array representing the
|
270
|
+
Directory and File nodes in the tree.</p>
|
271
|
+
|
272
|
+
<ul>
|
273
|
+
<li>currentNode - The node to start at when flattening</li>
|
274
|
+
<li>nodeName - A String that represents the name of the node to match.</li>
|
275
|
+
</ul>
|
276
|
+
|
277
|
+
<p>Examples</p>
|
278
|
+
|
279
|
+
<pre><code># Add some files to the tree
|
280
|
+
tree.addFile('/source/main.coffee')
|
281
|
+
tree.addFile('/source/player.coffee')
|
282
|
+
|
283
|
+
# returns an array containing the File 'main.coffee'
|
284
|
+
tree.filterNodes('file', 'main')
|
285
|
+
# => [<File>]
|
286
|
+
</code></pre>
|
287
|
+
|
288
|
+
<p>Returns an Array of nodes that match the filter criteria.</p>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
<div class="method">
|
292
|
+
<h4>getDirectory(directoryName)</h4>
|
293
|
+
<p>Public: Returns an array of directories matching the given directoryName.</p>
|
294
|
+
|
295
|
+
<ul>
|
296
|
+
<li>directoryName - A String naming the directory to match.</li>
|
297
|
+
</ul>
|
298
|
+
|
299
|
+
<p>Examples</p>
|
300
|
+
|
301
|
+
<pre><code># Add some files to the tree
|
302
|
+
tree.addFile('/source/main.coffee')
|
303
|
+
tree.addFile('/source/player.coffee')
|
304
|
+
tree.addFile('/directory2/file.coffee')
|
305
|
+
|
306
|
+
# returns an array containing the Directory 'source'
|
307
|
+
tree.getDirectory('source')
|
308
|
+
# => [<Directory>]
|
309
|
+
</code></pre>
|
310
|
+
|
311
|
+
<p>Returns an Array of Directory nodes that match directoryName.</p>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div class="method">
|
315
|
+
<h4>getFile(fileName)</h4>
|
316
|
+
<p>Public: Returns an array of files match the given fileName.</p>
|
317
|
+
|
318
|
+
<ul>
|
319
|
+
<li>fileName - A String naming the files to match.</li>
|
320
|
+
</ul>
|
321
|
+
|
322
|
+
<p>Examples</p>
|
323
|
+
|
324
|
+
<pre><code># Add some files to the tree
|
325
|
+
tree.addFile('/source/main.coffee')
|
326
|
+
tree.addFile('/source/player.coffee')
|
327
|
+
tree.addFile('/directory2/main.coffee')
|
328
|
+
|
329
|
+
# returns an array containing both the files named main.
|
330
|
+
tree.getFile('main')
|
331
|
+
# => [<File>, <File>]
|
332
|
+
|
333
|
+
# return an array containing the file named player.
|
334
|
+
tree.getFile('player')
|
335
|
+
# => [<File>]
|
336
|
+
</code></pre>
|
337
|
+
|
338
|
+
<p>Returns an Array of File nodes that match fileName.</p>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="method">
|
342
|
+
<h4>getFiles(directoryName)</h4>
|
343
|
+
<p>Public: Returns an array of files contained within the directory
|
344
|
+
matching directoryName.</p>
|
345
|
+
|
346
|
+
<ul>
|
347
|
+
<li>directoryName - A String naming the directory to look inside.</li>
|
348
|
+
</ul>
|
349
|
+
|
350
|
+
<p>Examples</p>
|
351
|
+
|
352
|
+
<pre><code># Add some files to the tree
|
353
|
+
tree.addFile('/source/main.coffee')
|
354
|
+
tree.addFile('/source/player.coffee')
|
355
|
+
tree.addFile('/directory2/main.coffee')
|
356
|
+
|
357
|
+
# returns an array containing the files 'player.coffee' and 'main.coffee'
|
358
|
+
tree.getFiles('source')
|
359
|
+
# => [<File>, <File>]
|
360
|
+
</code></pre>
|
361
|
+
|
362
|
+
<p>Returns an Array of File nodes that are contained in the
|
363
|
+
Directory matching directoryName.</p>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
<div class="method">
|
367
|
+
<h4>toAscii(collection, indentation, output)</h4>
|
368
|
+
<p>Internal: A String representation of the filetree.</p>
|
369
|
+
|
370
|
+
<ul>
|
371
|
+
<li>collection - A NodeCollection object describing which folder to start at.</li>
|
372
|
+
<li>indentation - A Number describing how many spaces to indent the next filetree element (default: 0).</li>
|
373
|
+
<li>output - A String representing the current filetree output (default: "\n").</li>
|
374
|
+
</ul>
|
375
|
+
|
376
|
+
<p>Examples</p>
|
377
|
+
|
378
|
+
<pre><code># Add some files to the tree
|
379
|
+
tree.addFile('/source/main.coffee')
|
380
|
+
tree.addFile('/source/player.coffee')
|
381
|
+
tree.addFile('/directory2/main.coffee')
|
382
|
+
|
383
|
+
tree.toAscii()
|
384
|
+
# => "
|
385
|
+
-directory2
|
386
|
+
-main.coffee
|
387
|
+
-source
|
388
|
+
-main.coffee
|
389
|
+
-player.coffee
|
390
|
+
"
|
391
|
+
</code></pre>
|
392
|
+
|
393
|
+
<p>Returns a String representation of the sorted nodes of the file tree.</p>
|
394
|
+
</div>
|
395
|
+
|
396
|
+
<div class="method">
|
397
|
+
<h4>getModelFromClick(e)</h4>
|
398
|
+
<p>Internal: Look up a model based on the cid of the clicked view element.</p>
|
399
|
+
|
400
|
+
<p>Returns the Node corresponding to the view element that the user clicked on.</p>
|
401
|
+
</div>
|
402
|
+
|
403
|
+
<div class="method">
|
404
|
+
<h4>openDirectory(e)</h4>
|
405
|
+
<p>Internal: Toggle the directory icon and display the contents of the clicked Directory.</p>
|
406
|
+
</div>
|
407
|
+
|
408
|
+
<div class="method">
|
409
|
+
<h4>openFile(e)</h4>
|
410
|
+
<p>Internal: Trigger the 'openFile' event, passing in the file corresponding
|
411
|
+
to the view element that the user clicked.</p>
|
412
|
+
</div>
|
413
|
+
|
414
|
+
<div class="method">
|
415
|
+
<h4>render()</h4>
|
416
|
+
<p>Internal: Call render on each of the nodes underneath the root node.
|
417
|
+
Also calls sort on each of the subcollections.</p>
|
418
|
+
</div>
|
419
|
+
|
420
|
+
</div>
|
421
|
+
|
422
|
+
</div>
|
423
|
+
</div>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
</div>
|
427
|
+
|
428
|
+
|
429
|
+
</div>
|
430
|
+
</div>
|
431
|
+
</body>
|
432
|
+
</html>
|
data/lib/version.rb
ADDED
Binary file
|
Binary file
|