bone_tree 0.5.6 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +26 -3
- data/Gemfile +5 -12
- data/Rakefile +7 -9
- data/bone_tree.gemspec +30 -14
- data/config.rb +8 -0
- data/lib/assets/javascripts/bone_tree.js +277 -981
- data/lib/assets/stylesheets/bone_tree.css +108 -0
- data/lib/bone_tree/rails.rb +5 -0
- data/lib/bone_tree/sprockets.rb +3 -0
- data/lib/{version.rb → bone_tree/version.rb} +1 -1
- data/lib/bone_tree.rb +11 -6
- data/source/index.html.haml +10 -382
- data/source/javascripts/{_backbone.js → backbone.js} +282 -142
- data/source/javascripts/bone_tree/models/directory.js.coffee +109 -0
- data/source/javascripts/bone_tree/models/file.js.coffee +12 -0
- data/source/javascripts/bone_tree/models/node.js.coffee +24 -0
- data/source/javascripts/bone_tree/models/settings.js.coffee +5 -0
- data/source/javascripts/bone_tree/{_namespace.js.coffee → namespace.js.coffee} +1 -1
- data/source/javascripts/bone_tree/views/directory.js.coffee +56 -0
- data/source/javascripts/bone_tree/views/file.js.coffee +25 -0
- data/source/javascripts/bone_tree/views/tree.js.coffee +87 -0
- data/source/javascripts/bone_tree.js.coffee +2 -1
- data/source/stylesheets/bone_tree.css.sass +0 -38
- data/spec/javascripts/directory_spec.coffee +26 -0
- data/spec/javascripts/helpers/spec_helper.coffee +3 -4
- data/spec/javascripts/sorting_spec.coffee +12 -0
- data/spec/javascripts/support/jasmine.yml +6 -4
- metadata +143 -36
- data/Gemfile.lock +0 -190
- data/docs/index.html +0 -222
- data/docs/resources/base.css +0 -70
- data/docs/resources/index.css +0 -20
- data/docs/resources/module.css +0 -24
- data/docs/source/javascripts/bone_tree/_namespace.js.html +0 -45
- data/docs/source/javascripts/bone_tree/models/_directory.js.html +0 -126
- data/docs/source/javascripts/bone_tree/models/_file.js.html +0 -112
- data/docs/source/javascripts/bone_tree/models/_nodes.js.html +0 -174
- data/docs/source/javascripts/bone_tree/models/_settings.js.html +0 -75
- data/docs/source/javascripts/bone_tree/views/_directory.js.html +0 -94
- data/docs/source/javascripts/bone_tree/views/_file.js.html +0 -82
- data/docs/source/javascripts/bone_tree/views/_menu.js.html +0 -110
- data/docs/source/javascripts/bone_tree/views/_tree.js.html +0 -432
- data/source/javascripts/_jquery.min.js +0 -5
- data/source/javascripts/_underscore.js +0 -999
- data/source/javascripts/bone_tree/models/_directory.js.coffee +0 -63
- data/source/javascripts/bone_tree/models/_file.js.coffee +0 -55
- data/source/javascripts/bone_tree/models/_nodes.js.coffee +0 -117
- data/source/javascripts/bone_tree/models/_settings.js.coffee +0 -25
- data/source/javascripts/bone_tree/views/_directory.js.coffee +0 -73
- data/source/javascripts/bone_tree/views/_file.js.coffee +0 -51
- data/source/javascripts/bone_tree/views/_menu.js.coffee +0 -97
- data/source/javascripts/bone_tree/views/_tree.js.coffee +0 -498
- data/spec/javascripts/directory_view_spec.coffee +0 -91
- data/spec/javascripts/file_view_spec.coffee +0 -70
- data/spec/javascripts/menu_view_spec.coffee +0 -42
- data/spec/javascripts/nodes_spec.coffee +0 -37
- data/spec/javascripts/tree_view_spec.coffee +0 -39
@@ -1,37 +0,0 @@
|
|
1
|
-
#= require bone_tree/_namespace
|
2
|
-
#= require bone_tree/models/_nodes
|
3
|
-
|
4
|
-
describe 'BoneTree.Models.Node', ->
|
5
|
-
beforeEach ->
|
6
|
-
{Models} = BoneTree
|
7
|
-
|
8
|
-
@file = new Models.Node
|
9
|
-
nodeType: 'file'
|
10
|
-
name: 'config'
|
11
|
-
extension: 'json'
|
12
|
-
|
13
|
-
@directory = new Models.Node
|
14
|
-
nodeType: 'directory'
|
15
|
-
name: 'src'
|
16
|
-
|
17
|
-
it 'should return the correct constantized type', ->
|
18
|
-
expect(@file.constantize()).toEqual('File')
|
19
|
-
expect(@directory.constantize()).toEqual('Directory')
|
20
|
-
|
21
|
-
it 'should return the full name with extension when appropriate', ->
|
22
|
-
expect(@file.nameWithExtension()).toEqual('config.json')
|
23
|
-
expect(@directory.nameWithExtension()).toEqual('src')
|
24
|
-
|
25
|
-
it 'should return just the fileName when no extension is present', ->
|
26
|
-
@file = new BoneTree.Models.Node
|
27
|
-
nodeType: 'file'
|
28
|
-
name: 'something'
|
29
|
-
|
30
|
-
expect(@file.nameWithExtension()).toEqual('something')
|
31
|
-
|
32
|
-
@anotherFile = new BoneTree.Models.Node
|
33
|
-
nodeType: 'file'
|
34
|
-
name: 'main'
|
35
|
-
extension: ''
|
36
|
-
|
37
|
-
expect(@anotherFile.nameWithExtension()).toEqual('main')
|
@@ -1,39 +0,0 @@
|
|
1
|
-
#= require bone_tree/_namespace
|
2
|
-
#= require bone_tree/views/_tree
|
3
|
-
|
4
|
-
describe "BoneTree.Views.Tree", ->
|
5
|
-
beforeEach ->
|
6
|
-
setFixtures("<div id='test'></div>")
|
7
|
-
|
8
|
-
@tree = new BoneTree.Views.Tree
|
9
|
-
|
10
|
-
$('#test').append @tree.render().el
|
11
|
-
|
12
|
-
afterEach ->
|
13
|
-
@tree.remove()
|
14
|
-
$('#test').empty()
|
15
|
-
|
16
|
-
describe "rendering", ->
|
17
|
-
it "should render the correct DOM elements", ->
|
18
|
-
expect($('#test .tree')).toExist()
|
19
|
-
expect($('#test .tree').length).toEqual(1)
|
20
|
-
|
21
|
-
describe "configuration", ->
|
22
|
-
it "should pass options through to the settings object", ->
|
23
|
-
@tree = new BoneTree.Views.Tree
|
24
|
-
confirmDeletes: true
|
25
|
-
|
26
|
-
expect(@tree.settings.get('confirmDeletes')).toBeTruthy()
|
27
|
-
|
28
|
-
@tree = new BoneTree.Views.Tree
|
29
|
-
showExtensions: true
|
30
|
-
|
31
|
-
expect(@tree.settings.get('showExtensions')).toBeTruthy()
|
32
|
-
|
33
|
-
describe 'API', ->
|
34
|
-
it 'should be able to find files by their path', ->
|
35
|
-
@tree = new BoneTree.Views.Tree
|
36
|
-
|
37
|
-
srcMain = @tree.file('src/main.coffee', {added: true})
|
38
|
-
|
39
|
-
expect(@tree.file('src/main.coffee')).toEqual(srcMain)
|