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,438 @@
|
|
1
|
+
- content_for :head do
|
2
|
+
%title Bone Tree
|
3
|
+
|
4
|
+
=javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
|
5
|
+
=javascript_include_tag 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js'
|
6
|
+
=javascript_include_tag "http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.0/backbone-min.js"
|
7
|
+
=javascript_include_tag 'bone_tree'
|
8
|
+
|
9
|
+
.bone_tree.left
|
10
|
+
|
11
|
+
.right
|
12
|
+
%h1 Bone Tree
|
13
|
+
%span.background
|
14
|
+
<a href="http://github.com/mdiebolt/bone_tree"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub"></a>
|
15
|
+
|
16
|
+
%p A browser based filetree written with Backbone.js that supports live updating and reordering of filetree nodes, has a simple, intuitive API, and sports a clean, minimal DOM structure.
|
17
|
+
|
18
|
+
%h3 Features
|
19
|
+
|
20
|
+
%ul.features
|
21
|
+
%li Live update of node names, extension names, file type icons
|
22
|
+
%li Live sorting of nodes when filetree state changes
|
23
|
+
%li Context menu with rename and delete functionality
|
24
|
+
%li Auto create directories that don't exist when files are added to the tree
|
25
|
+
%li Events triggered when a file is opened, renamed, or deleted
|
26
|
+
|
27
|
+
%h3 Events API
|
28
|
+
|
29
|
+
:coderay
|
30
|
+
#!ruby
|
31
|
+
# get a new filetree
|
32
|
+
tree = new BoneTree.Views.Tree
|
33
|
+
|
34
|
+
# add a new file to the directory
|
35
|
+
tree.file('source/main.js', {file: true})
|
36
|
+
|
37
|
+
# this creates the directory source if it doesn't already exist and puts the file main.js inside of it
|
38
|
+
|
39
|
+
tree.bind 'rename', (model, newName) =>
|
40
|
+
# this callback is passed the model that changed and the new name of the node
|
41
|
+
console.log model
|
42
|
+
|
43
|
+
tree.bind 'remove', (model, collection) =>
|
44
|
+
# this callback is passed the model that was removed and the collection it was removed from
|
45
|
+
console.log model
|
46
|
+
|
47
|
+
tree.bind 'openFile', (file) =>
|
48
|
+
# this callback is passed the file that was just clicked on
|
49
|
+
console.log file
|
50
|
+
|
51
|
+
:coffeescript
|
52
|
+
window.tree = new BoneTree.Views.Tree
|
53
|
+
showExtensions: true
|
54
|
+
confirmDeletes: true
|
55
|
+
|
56
|
+
tree.bind 'openFile', (file) ->
|
57
|
+
console.log file
|
58
|
+
|
59
|
+
tree.file('file.coffee', {description: 'A CoffeeScript file'})
|
60
|
+
|
61
|
+
$('.bone_tree').append tree.render().$el
|
62
|
+
|
63
|
+
treeData = JSON.parse('{
|
64
|
+
"name": "Pixteroids",
|
65
|
+
"files": [
|
66
|
+
{
|
67
|
+
"name": "data",
|
68
|
+
"files": [
|
69
|
+
{
|
70
|
+
"name": "asteroid",
|
71
|
+
"contents": "super long JSON string",
|
72
|
+
"extension": "animation",
|
73
|
+
"lang": null,
|
74
|
+
"type": "animation",
|
75
|
+
"size": 645,
|
76
|
+
"mtime": 1310024315,
|
77
|
+
"path": "data/asteroid.animation"
|
78
|
+
}, {
|
79
|
+
"name": "asteroid_large",
|
80
|
+
"contents": "super long JSON string",
|
81
|
+
"extension": "animation",
|
82
|
+
"lang": null,
|
83
|
+
"type": "animation",
|
84
|
+
"size": 1510,
|
85
|
+
"mtime": 1307259412,
|
86
|
+
"path": "data/asteroid_large.animation"
|
87
|
+
}, {
|
88
|
+
"name": "asteroid_small",
|
89
|
+
"contents": "super long JSON string",
|
90
|
+
"extension": "animation",
|
91
|
+
"lang": null,
|
92
|
+
"type": "animation",
|
93
|
+
"size": 794,
|
94
|
+
"mtime": 1307259338,
|
95
|
+
"path": "data/asteroid_small.animation"
|
96
|
+
}, {
|
97
|
+
"name": "bullet",
|
98
|
+
"contents": "super long JSON string",
|
99
|
+
"extension": "animation",
|
100
|
+
"lang": null,
|
101
|
+
"type": "animation",
|
102
|
+
"size": 467,
|
103
|
+
"mtime": 1307427332,
|
104
|
+
"path": "data/bullet.animation"
|
105
|
+
}, {
|
106
|
+
"name": "ship",
|
107
|
+
"contents": "super long JSON string",
|
108
|
+
"extension": "animation",
|
109
|
+
"lang": null,
|
110
|
+
"type": "animation",
|
111
|
+
"size": 2200,
|
112
|
+
"mtime": 1307584720,
|
113
|
+
"path": "data/ship.animation"
|
114
|
+
}
|
115
|
+
]
|
116
|
+
}, {
|
117
|
+
"name": "images",
|
118
|
+
"files": [
|
119
|
+
{
|
120
|
+
"name": "background",
|
121
|
+
"contents": null,
|
122
|
+
"extension": "png",
|
123
|
+
"lang": null,
|
124
|
+
"type": "image",
|
125
|
+
"size": 246772,
|
126
|
+
"mtime": 1306478156,
|
127
|
+
"path": "images/background.png"
|
128
|
+
}, {
|
129
|
+
"name": "black",
|
130
|
+
"contents": null,
|
131
|
+
"extension": "png",
|
132
|
+
"lang": null,
|
133
|
+
"type": "image",
|
134
|
+
"size": 110,
|
135
|
+
"mtime": 1316842913,
|
136
|
+
"path": "images/black.png"
|
137
|
+
}, {
|
138
|
+
"name": "jh",
|
139
|
+
"contents": null,
|
140
|
+
"extension": "png",
|
141
|
+
"lang": null,
|
142
|
+
"type": "image",
|
143
|
+
"size": 200,
|
144
|
+
"mtime": 1313777010,
|
145
|
+
"path": "images/jh.png"
|
146
|
+
}
|
147
|
+
]
|
148
|
+
}, {
|
149
|
+
"name": "lib",
|
150
|
+
"files": [
|
151
|
+
{
|
152
|
+
"name": "gamelib",
|
153
|
+
"contents": "super long JSON string",
|
154
|
+
"extension": "js",
|
155
|
+
"lang": "javascript",
|
156
|
+
"type": "text",
|
157
|
+
"size": 715930,
|
158
|
+
"mtime": 1307870400,
|
159
|
+
"path": "lib/gamelib.js"
|
160
|
+
}, {
|
161
|
+
"name": "playtomic",
|
162
|
+
"contents": "super long JSON string",
|
163
|
+
"extension": "js",
|
164
|
+
"lang": "javascript",
|
165
|
+
"type": "text",
|
166
|
+
"size": 75333,
|
167
|
+
"mtime": 1318021411,
|
168
|
+
"path": "lib/playtomic.js"
|
169
|
+
}, {
|
170
|
+
"name": "playtomic.v1.8.min",
|
171
|
+
"contents": "super long JSON string",
|
172
|
+
"extension": "js",
|
173
|
+
"lang": "javascript",
|
174
|
+
"type": "text",
|
175
|
+
"size": 27346,
|
176
|
+
"mtime": 1318021409,
|
177
|
+
"path": "lib/playtomic.v1.8.min.js"
|
178
|
+
}
|
179
|
+
]
|
180
|
+
}, {
|
181
|
+
"name": "sounds",
|
182
|
+
"files": [
|
183
|
+
{
|
184
|
+
"name": "explode",
|
185
|
+
"contents": "super long JSON string",
|
186
|
+
"extension": "sfs",
|
187
|
+
"lang": null,
|
188
|
+
"type": "sound",
|
189
|
+
"size": 105,
|
190
|
+
"mtime": 1310024363,
|
191
|
+
"path": "sounds/explode.sfs"
|
192
|
+
}, {
|
193
|
+
"name": "explode",
|
194
|
+
"contents": null,
|
195
|
+
"extension": "wav",
|
196
|
+
"lang": null,
|
197
|
+
"type": "binary",
|
198
|
+
"size": 158270,
|
199
|
+
"mtime": 1310024364,
|
200
|
+
"path": "sounds/explode.wav"
|
201
|
+
}, {
|
202
|
+
"name": "kjkj",
|
203
|
+
"contents": null,
|
204
|
+
"extension": "wav",
|
205
|
+
"lang": null,
|
206
|
+
"type": "binary",
|
207
|
+
"size": 189826,
|
208
|
+
"mtime": 1313777037,
|
209
|
+
"path": "sounds/kjkj.wav"
|
210
|
+
}, {
|
211
|
+
"name": "kjkj",
|
212
|
+
"contents": "super long JSON string",
|
213
|
+
"extension": "sfs",
|
214
|
+
"lang": null,
|
215
|
+
"type": "sound",
|
216
|
+
"size": 105,
|
217
|
+
"mtime": 1313777036,
|
218
|
+
"path": "sounds/kjkj.sfs"
|
219
|
+
}, {
|
220
|
+
"name": "pew",
|
221
|
+
"contents": null,
|
222
|
+
"extension": "wav",
|
223
|
+
"lang": null,
|
224
|
+
"type": "binary",
|
225
|
+
"size": 7682,
|
226
|
+
"mtime": 1306994836,
|
227
|
+
"path": "sounds/pew.wav"
|
228
|
+
}, {
|
229
|
+
"name": "pew",
|
230
|
+
"contents": "super long JSON string",
|
231
|
+
"extension": "sfs",
|
232
|
+
"lang": null,
|
233
|
+
"type": "sound",
|
234
|
+
"size": 105,
|
235
|
+
"mtime": 1306994830,
|
236
|
+
"path": "sounds/pew.sfs"
|
237
|
+
}, {
|
238
|
+
"name": "thrust",
|
239
|
+
"contents": "super long JSON string",
|
240
|
+
"extension": "sfs",
|
241
|
+
"lang": null,
|
242
|
+
"type": "sound",
|
243
|
+
"size": 105,
|
244
|
+
"mtime": 1306995050,
|
245
|
+
"path": "sounds/thrust.sfs"
|
246
|
+
}, {
|
247
|
+
"name": "thrust",
|
248
|
+
"contents": null,
|
249
|
+
"extension": "wav",
|
250
|
+
"lang": null,
|
251
|
+
"type": "binary",
|
252
|
+
"size": 26582,
|
253
|
+
"mtime": 1306995056,
|
254
|
+
"path": "sounds/thrust.wav"
|
255
|
+
}
|
256
|
+
]
|
257
|
+
}, {
|
258
|
+
"name": "src",
|
259
|
+
"files": [
|
260
|
+
{
|
261
|
+
"name": "asteroid",
|
262
|
+
"contents": "super long JSON string",
|
263
|
+
"extension": "coffee",
|
264
|
+
"lang": "coffeescript",
|
265
|
+
"type": "text",
|
266
|
+
"size": 2373,
|
267
|
+
"mtime": 1307762048,
|
268
|
+
"path": "src/asteroid.coffee"
|
269
|
+
}, {
|
270
|
+
"name": "base",
|
271
|
+
"contents": "super long JSON string",
|
272
|
+
"extension": "coffee",
|
273
|
+
"lang": "coffeescript",
|
274
|
+
"type": "text",
|
275
|
+
"size": 302,
|
276
|
+
"mtime": 1307711140,
|
277
|
+
"path": "src/base.coffee"
|
278
|
+
}, {
|
279
|
+
"name": "bullet",
|
280
|
+
"contents": "super long JSON string",
|
281
|
+
"extension": "coffee",
|
282
|
+
"lang": "coffeescript",
|
283
|
+
"type": "text",
|
284
|
+
"size": 106,
|
285
|
+
"mtime": 1307712094,
|
286
|
+
"path": "src/bullet.coffee"
|
287
|
+
}, {
|
288
|
+
"name": "main",
|
289
|
+
"contents": "super long JSON string",
|
290
|
+
"extension": "coffee",
|
291
|
+
"lang": "coffeescript",
|
292
|
+
"type": "text",
|
293
|
+
"size": 543,
|
294
|
+
"mtime": 1321258568,
|
295
|
+
"path": "src/main.coffee"
|
296
|
+
}, {
|
297
|
+
"name": "ship",
|
298
|
+
"contents": "super long JSON string",
|
299
|
+
"extension": "coffee",
|
300
|
+
"lang": "coffeescript",
|
301
|
+
"type": "text",
|
302
|
+
"size": 1602,
|
303
|
+
"mtime": 1307783232,
|
304
|
+
"path": "src/ship.coffee"
|
305
|
+
}, {
|
306
|
+
"name": "wrappable",
|
307
|
+
"contents": "super long JSON string",
|
308
|
+
"extension": "coffee",
|
309
|
+
"lang": "coffeescript",
|
310
|
+
"type": "text",
|
311
|
+
"size": 110,
|
312
|
+
"mtime": 1307601644,
|
313
|
+
"path": "src/wrappable.coffee"
|
314
|
+
}
|
315
|
+
]
|
316
|
+
}, {
|
317
|
+
"name": "webstore",
|
318
|
+
"files": [
|
319
|
+
{
|
320
|
+
"name": "images",
|
321
|
+
"files": [
|
322
|
+
{
|
323
|
+
"name": "icon_128",
|
324
|
+
"contents": null,
|
325
|
+
"extension": "png",
|
326
|
+
"lang": null,
|
327
|
+
"type": "image",
|
328
|
+
"size": 7960,
|
329
|
+
"mtime": 1324715561,
|
330
|
+
"path": "webstore/images/icon_128.png"
|
331
|
+
}, {
|
332
|
+
"name": "icon_16",
|
333
|
+
"contents": null,
|
334
|
+
"extension": "png",
|
335
|
+
"lang": null,
|
336
|
+
"type": "image",
|
337
|
+
"size": 892,
|
338
|
+
"mtime": 1324715561,
|
339
|
+
"path": "webstore/images/icon_16.png"
|
340
|
+
}, {
|
341
|
+
"name": "icon_96",
|
342
|
+
"contents": null,
|
343
|
+
"extension": "png",
|
344
|
+
"lang": null,
|
345
|
+
"type": "image",
|
346
|
+
"size": 7164,
|
347
|
+
"mtime": 1324715561,
|
348
|
+
"path": "webstore/images/icon_96.png"
|
349
|
+
}
|
350
|
+
]
|
351
|
+
}, {
|
352
|
+
"name": "jquery.min",
|
353
|
+
"contents": "super long JSON string",
|
354
|
+
"extension": "js",
|
355
|
+
"lang": "javascript",
|
356
|
+
"type": "text",
|
357
|
+
"size": 91341,
|
358
|
+
"mtime": 1324715561,
|
359
|
+
"path": "webstore/jquery.min.js"
|
360
|
+
}, {
|
361
|
+
"name": "main",
|
362
|
+
"contents": "super long JSON string",
|
363
|
+
"extension": "html",
|
364
|
+
"lang": "html",
|
365
|
+
"type": "text",
|
366
|
+
"size": 463,
|
367
|
+
"mtime": 1324715561,
|
368
|
+
"path": "webstore/main.html"
|
369
|
+
}, {
|
370
|
+
"name": "project",
|
371
|
+
"contents": "super long JSON string",
|
372
|
+
"extension": "css",
|
373
|
+
"lang": "css",
|
374
|
+
"type": "text",
|
375
|
+
"size": 3356,
|
376
|
+
"mtime": 1324715561,
|
377
|
+
"path": "webstore/project.css"
|
378
|
+
}
|
379
|
+
]
|
380
|
+
}, {
|
381
|
+
"name": "Documentation",
|
382
|
+
"extension": "documentation",
|
383
|
+
"path": "docs"
|
384
|
+
}, {
|
385
|
+
"name": "Pixteroids",
|
386
|
+
"contents": null,
|
387
|
+
"extension": "js",
|
388
|
+
"lang": "javascript",
|
389
|
+
"type": "binary",
|
390
|
+
"size": 725960,
|
391
|
+
"mtime": 1313777080,
|
392
|
+
"path": "Pixteroids.js"
|
393
|
+
}, {
|
394
|
+
"name": "README",
|
395
|
+
"contents": "super long JSON string",
|
396
|
+
"extension": "",
|
397
|
+
"lang": null,
|
398
|
+
"type": "text",
|
399
|
+
"size": 83,
|
400
|
+
"mtime": 1305349550,
|
401
|
+
"path": "README"
|
402
|
+
}, {
|
403
|
+
"name": "Tutorial",
|
404
|
+
"contents": "http://blog.pixieengine.com/2011/06/asteroids/",
|
405
|
+
"extension": "tutorial",
|
406
|
+
"lang": null,
|
407
|
+
"type": "tutorial",
|
408
|
+
"size": 46,
|
409
|
+
"mtime": 1307864630,
|
410
|
+
"path": "Tutorial.tutorial"
|
411
|
+
}, {
|
412
|
+
"name": "manifest",
|
413
|
+
"contents": "super long JSON string",
|
414
|
+
"extension": "json",
|
415
|
+
"lang": "javascript",
|
416
|
+
"type": "json",
|
417
|
+
"size": 363,
|
418
|
+
"mtime": 1324715561,
|
419
|
+
"path": "manifest.json"
|
420
|
+
}, {
|
421
|
+
"name": "pixie",
|
422
|
+
"contents": "super long JSON string",
|
423
|
+
"extension": "json",
|
424
|
+
"lang": "javascript",
|
425
|
+
"type": "json",
|
426
|
+
"size": 254,
|
427
|
+
"mtime": 1307595452,
|
428
|
+
"path": "pixie.json"
|
429
|
+
}
|
430
|
+
]
|
431
|
+
}')
|
432
|
+
|
433
|
+
tree.addFromJSON treeData, '', (fileName, fileData) ->
|
434
|
+
allowFile = true
|
435
|
+
|
436
|
+
allowFile = false if fileData.type is 'binary'
|
437
|
+
|
438
|
+
return allowFile
|