the_sortable_tree 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -5
- data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/hashchange.js.coffee +0 -0
- data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/initializer.js.coffee +0 -0
- data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/jquery.cookie.coffee +0 -0
- data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/restorable.js.coffee +0 -0
- data/app/assets/javascripts/{jquery.ui.nestedSortable.js → the_sortable_tree/jquery.ui.nestedSortable.js} +0 -0
- data/app/assets/javascripts/the_sortable_tree/sortable_ui/base.js.coffee +87 -0
- data/app/assets/javascripts/{sortable_tree → the_sortable_tree/sortable_ui}/initializer.js.coffee +14 -11
- data/app/assets/stylesheets/the_sortable_tree/expandable_tree.sass +23 -0
- data/app/assets/stylesheets/the_sortable_tree/sortable_ui/base.sass +36 -0
- data/app/assets/stylesheets/the_sortable_tree/tree.sass +35 -0
- data/app/helpers/render_expandable_tree_helper.rb +3 -3
- data/app/helpers/render_sortable_tree_helper.rb +30 -12
- data/app/helpers/render_tree_helper.rb +6 -5
- data/app/helpers/the_sortable_tree_helper.rb +3 -3
- data/gem_version.rb +1 -1
- data/spec/dummy_app/Gemfile +6 -3
- data/spec/dummy_app/README.md +26 -36
- data/spec/dummy_app/app/assets/javascripts/application.js +9 -13
- data/spec/dummy_app/app/assets/stylesheets/application.css +8 -9
- data/spec/dummy_app/app/views/admin/pages/index.html.haml +1 -3
- data/spec/dummy_app/app/views/admin/pages/manage.html.haml +2 -2
- data/spec/dummy_app/app/views/admin/pages/namespaced_link.html.haml +1 -1
- data/spec/dummy_app/app/views/admin/pages/node_manage.html.haml +1 -1
- data/spec/dummy_app/app/views/article_categories/index.html.haml +1 -1
- data/spec/dummy_app/app/views/article_categories/manage.html.haml +1 -1
- data/spec/dummy_app/app/views/inventory/categories/index.html.haml +1 -2
- data/spec/dummy_app/app/views/inventory/categories/manage.html.haml +1 -1
- data/spec/dummy_app/app/views/layouts/application.html.erb +5 -1
- data/spec/dummy_app/app/views/pages/expand.html.haml +1 -1
- data/spec/dummy_app/app/views/pages/expand_node.html.haml +1 -1
- data/spec/dummy_app/app/views/pages/index.html.haml +1 -2
- data/spec/dummy_app/app/views/pages/manage.html.haml +7 -6
- data/spec/dummy_app/app/views/pages/nested_options.html.haml +3 -2
- data/spec/dummy_app/app/views/welcome/index.html.haml +30 -29
- data/spec/dummy_app/bin/bundler +17 -0
- data/spec/dummy_app/bin/coderay +17 -0
- data/spec/dummy_app/bin/erubis +17 -0
- data/spec/dummy_app/bin/haml +17 -0
- data/spec/dummy_app/bin/html2haml +17 -0
- data/spec/dummy_app/bin/htmldiff +17 -0
- data/spec/dummy_app/bin/ldiff +17 -0
- data/spec/dummy_app/bin/nokogiri +17 -0
- data/spec/dummy_app/bin/pry +17 -0
- data/spec/dummy_app/bin/rackup +17 -0
- data/spec/dummy_app/bin/rails +17 -0
- data/spec/dummy_app/bin/rake +17 -0
- data/spec/dummy_app/bin/rspec +17 -0
- data/spec/dummy_app/bin/ruby_parse +17 -0
- data/spec/dummy_app/bin/ruby_parse_extract_error +17 -0
- data/spec/dummy_app/bin/sass +17 -0
- data/spec/dummy_app/bin/sass-convert +17 -0
- data/spec/dummy_app/bin/scss +17 -0
- data/spec/dummy_app/bin/sprockets +17 -0
- data/spec/dummy_app/bin/thor +17 -0
- data/spec/dummy_app/bin/tilt +17 -0
- metadata +55 -121
- data/app/assets/stylesheets/expandable_tree.scss +0 -26
- data/app/assets/stylesheets/nested_options.scss +0 -25
- data/app/assets/stylesheets/sortable_tree.scss +0 -108
- data/app/assets/stylesheets/tree.scss +0 -35
- data/app/views/sortable/client/_tree.html.erb +0 -9
- data/app/views/tree/client/_tree.html.erb +0 -23
- data/spec/dummy_app/Gemfile.lock +0 -210
- data/spec/dummy_app/_test/fixtures/admin/pages.yml +0 -7
- data/spec/dummy_app/_test/fixtures/article_categories.yml +0 -9
- data/spec/dummy_app/_test/fixtures/comments.yml +0 -13
- data/spec/dummy_app/_test/fixtures/inventory/categories.yml +0 -9
- data/spec/dummy_app/_test/functional/inventory/category_controller_test.rb +0 -14
- data/spec/dummy_app/_test/performance/browsing_test.rb +0 -12
- data/spec/dummy_app/_test/test_helper.rb +0 -13
- data/spec/dummy_app/_test/unit/admin/page_test.rb +0 -7
- data/spec/dummy_app/_test/unit/article_category_test.rb +0 -7
- data/spec/dummy_app/_test/unit/comment_test.rb +0 -7
- data/spec/dummy_app/_test/unit/helpers/inventory/category_helper_test.rb +0 -4
- data/spec/dummy_app/_test/unit/inventory/category_test.rb +0 -7
- data/spec/dummy_app/config/database.yml +0 -7
- data/spec/dummy_app/db/development.db +0 -0
- data/spec/dummy_app/db/test.db +0 -0
- data/spec/dummy_app/doc/README_FOR_APP +0 -2
- data/spec/dummy_app/script/rails +0 -6
- data/spec/dummy_app/spec/build_tree_helper.rb +0 -39
- data/spec/dummy_app/spec/spec_helper.rb +0 -52
- data/spec/dummy_app/spec/views/pages/index.html.haml_spec.rb +0 -48
- data/spec/old_tests/controlllers/controller_mixin_spec.rb +0 -49
- data/spec/old_tests/dummy/README.rdoc +0 -261
- data/spec/old_tests/dummy/Rakefile +0 -7
- data/spec/old_tests/dummy/app/assets/javascripts/application.js +0 -15
- data/spec/old_tests/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/old_tests/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/old_tests/dummy/app/controllers/tests_controller.rb +0 -3
- data/spec/old_tests/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/old_tests/dummy/config.ru +0 -4
- data/spec/old_tests/dummy/config/application.rb +0 -56
- data/spec/old_tests/dummy/config/boot.rb +0 -10
- data/spec/old_tests/dummy/config/database.yml +0 -25
- data/spec/old_tests/dummy/config/environment.rb +0 -5
- data/spec/old_tests/dummy/config/environments/development.rb +0 -37
- data/spec/old_tests/dummy/config/environments/production.rb +0 -67
- data/spec/old_tests/dummy/config/environments/test.rb +0 -37
- data/spec/old_tests/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/old_tests/dummy/config/initializers/inflections.rb +0 -15
- data/spec/old_tests/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/old_tests/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/old_tests/dummy/config/initializers/session_store.rb +0 -8
- data/spec/old_tests/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/old_tests/dummy/config/locales/en.yml +0 -5
- data/spec/old_tests/dummy/config/routes.rb +0 -3
- data/spec/old_tests/dummy/db/test.sqlite3 +0 -0
- data/spec/old_tests/dummy/log/test.log +0 -4
- data/spec/old_tests/dummy/public/404.html +0 -26
- data/spec/old_tests/dummy/public/422.html +0 -26
- data/spec/old_tests/dummy/public/500.html +0 -25
- data/spec/old_tests/dummy/public/favicon.ico +0 -0
- data/spec/old_tests/dummy/script/rails +0 -6
- data/spec/old_tests/spec_helper.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9a1e92c0db44cdbc90f1344c2d1f7305a446d8e
|
4
|
+
data.tar.gz: 005ba075ce0edf667517399825b7d59ea8543718
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15866be81f3f1f94239c952da6be4e1bfaa94523bf659fd62b1556252ebc28d82260a72377ef74068c77fb402820a970f024c9c972556d0b26e1e1a0ebf24ce4
|
7
|
+
data.tar.gz: cfdda79927461e1d99c3bb389debb11c154a70ff54b8ea1924d06c7552b3759e4a3a7701d2dd4da45ffc16838c6b445868203a6521429cf77c3ec0f4e864cfc3
|
data/README.md
CHANGED
@@ -63,8 +63,16 @@ Sortable GUI require JQuery libs
|
|
63
63
|
Add next JS only for Sortable GUI
|
64
64
|
|
65
65
|
```ruby
|
66
|
-
//= require jquery.ui.nestedSortable
|
67
|
-
//= require
|
66
|
+
//= require the_sortable_tree/jquery.ui.nestedSortable
|
67
|
+
//= require the_sortable_tree/sortable_ui/base
|
68
|
+
|
69
|
+
// with Turbolinks
|
70
|
+
$ ->
|
71
|
+
TheSortableTree.SortableUI.init()
|
72
|
+
|
73
|
+
// with Turbolinks
|
74
|
+
$(document).on "ready page:load", ->
|
75
|
+
TheSortableTree.SortableUI.init()
|
68
76
|
```
|
69
77
|
|
70
78
|
#### Stylesheets
|
@@ -75,8 +83,14 @@ Add next JS only for Sortable GUI
|
|
75
83
|
*= require tree
|
76
84
|
*= require sortable_tree
|
77
85
|
*= require nested_options
|
86
|
+
|
87
|
+
*= the_sortable_tree/sortable_ui/base
|
78
88
|
```
|
79
89
|
|
90
|
+
```
|
91
|
+
ol.the-sortable-tree.the-sortable-tree--list(data={ max_levels: 5, rebuild_url: rebuild_hubs_url })
|
92
|
+
= sortable_tree @hubs
|
93
|
+
```
|
80
94
|
### Extend your Routes for Sortable GUI
|
81
95
|
|
82
96
|
```ruby
|
@@ -96,8 +110,9 @@ end
|
|
96
110
|
|
97
111
|
```ruby
|
98
112
|
class Page < ActiveRecord::Base
|
99
|
-
|
100
|
-
|
113
|
+
acts_as_nested_set scope: :user
|
114
|
+
include ::TheSortableTree::Scopes
|
115
|
+
|
101
116
|
# any code here
|
102
117
|
end
|
103
118
|
```
|
@@ -106,7 +121,7 @@ end
|
|
106
121
|
|
107
122
|
```ruby
|
108
123
|
class PagesController < ApplicationController
|
109
|
-
include TheSortableTreeController::Rebuild
|
124
|
+
include ::TheSortableTreeController::Rebuild
|
110
125
|
|
111
126
|
def manage
|
112
127
|
@pages = Page.nested_set.select('id, title, content, parent_id').all
|
@@ -263,6 +278,8 @@ Try to create view helpers for:
|
|
263
278
|
1. [mjsarfatti/nestedSortable](https://github.com/mjsarfatti/nestedSortable)
|
264
279
|
2. [iconza](http://iconza.com)
|
265
280
|
|
281
|
+
`this line fot testing with submodules`
|
282
|
+
|
266
283
|
## The MIT License (MIT)
|
267
284
|
|
268
285
|
Copyright 2009-2013 Ilya N. Zykin (the-teacher), Mikhail Dieterle (Mik-die), Matthew Clark
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,87 @@
|
|
1
|
+
@TheSortableTree ||= {}
|
2
|
+
@TheSortableTree.SortableUI = do ->
|
3
|
+
init: ->
|
4
|
+
sortable_tree = $('.the-sortable-tree')
|
5
|
+
return false if sortable_tree.length is 0
|
6
|
+
|
7
|
+
rebuild_url = sortable_tree.data('rebuild_url') || sortable_tree.data('rebuild-url')
|
8
|
+
max_levels = sortable_tree.data('max_levels') || sortable_tree.data('max-levels')
|
9
|
+
|
10
|
+
############################################
|
11
|
+
# Initialize Sortable Tree
|
12
|
+
############################################
|
13
|
+
sortable_tree.nestedSortable
|
14
|
+
# nested sortable plugin options
|
15
|
+
tabSize: 25
|
16
|
+
listType: 'ol'
|
17
|
+
disableNesting: 'the-sortable-tree--no-nest'
|
18
|
+
listClass: 'the-sortable-tree--nested-set'
|
19
|
+
errorClass: 'the-sortable-tree--sortable-error'
|
20
|
+
maxLevels: max_levels
|
21
|
+
|
22
|
+
# JQ sortable optopns
|
23
|
+
|
24
|
+
placeholder: 'the-sortable-tree--placeholder'
|
25
|
+
handle: '.the-sortable-tree--handler'
|
26
|
+
toleranceElement: '> div'
|
27
|
+
|
28
|
+
items: 'li'
|
29
|
+
helper: 'clone'
|
30
|
+
tolerance: 'pointer'
|
31
|
+
|
32
|
+
revert: 250
|
33
|
+
opacity: 0.6
|
34
|
+
forcePlaceholderSize: true
|
35
|
+
|
36
|
+
# JQ sortable Callbacks
|
37
|
+
#
|
38
|
+
# create: ->
|
39
|
+
# start: ->
|
40
|
+
# activate: ->
|
41
|
+
# over: ->
|
42
|
+
# sort: ->
|
43
|
+
# change: ->
|
44
|
+
# sort: ->
|
45
|
+
# beforeStop: ->
|
46
|
+
# # => AJAX
|
47
|
+
# update: ->
|
48
|
+
# deactivate: ->
|
49
|
+
# out: ->
|
50
|
+
# stop: ->
|
51
|
+
# receive: ->
|
52
|
+
# remove: ->
|
53
|
+
|
54
|
+
############################################
|
55
|
+
# Sortable Update Event
|
56
|
+
############################################
|
57
|
+
sortable_tree.on "sortupdate", (event, ui) =>
|
58
|
+
item = ui.item
|
59
|
+
attr_name = 'node-id'
|
60
|
+
item_id = item.data(attr_name)
|
61
|
+
prev_id = item.prev().data(attr_name)
|
62
|
+
next_id = item.next().data(attr_name)
|
63
|
+
parent_id = item.parent().parent().data(attr_name)
|
64
|
+
|
65
|
+
TheSortableTree.SortableUI.rebuild_sortable_tree(rebuild_url, item_id, parent_id, prev_id, next_id)
|
66
|
+
|
67
|
+
true
|
68
|
+
|
69
|
+
rebuild_sortable_tree: (rebuild_url, item_id, parent_id, prev_id, next_id) ->
|
70
|
+
$.ajax
|
71
|
+
type: 'POST'
|
72
|
+
dataType: 'script'
|
73
|
+
url: rebuild_url
|
74
|
+
data:
|
75
|
+
id: item_id
|
76
|
+
parent_id: parent_id
|
77
|
+
prev_id: prev_id
|
78
|
+
next_id: next_id
|
79
|
+
|
80
|
+
beforeSend: (xhr) ->
|
81
|
+
$('.the-sortable-tree--handler').css { opacity: 0 }
|
82
|
+
|
83
|
+
success: (data, status, xhr) ->
|
84
|
+
$('.the-sortable-tree--handler').css { opacity: 1 }
|
85
|
+
|
86
|
+
error: (xhr, status, error) ->
|
87
|
+
log error
|
data/app/assets/javascripts/{sortable_tree → the_sortable_tree/sortable_ui}/initializer.js.coffee
RENAMED
@@ -10,18 +10,18 @@
|
|
10
10
|
next_id: next_id
|
11
11
|
|
12
12
|
beforeSend: (xhr) ->
|
13
|
-
$('.
|
13
|
+
$('.the_sortable_tree-handler').hide()
|
14
14
|
|
15
15
|
success: (data, status, xhr) ->
|
16
|
-
$('.
|
16
|
+
$('.the_sortable_tree-handler').show()
|
17
17
|
|
18
18
|
error: (xhr, status, error) ->
|
19
19
|
console.log error
|
20
20
|
|
21
21
|
@init_sortable_tree = ->
|
22
|
-
sortable_tree = $('
|
22
|
+
sortable_tree = $('.the_sortable_tree')
|
23
23
|
return false if sortable_tree.length is 0
|
24
|
-
|
24
|
+
|
25
25
|
rebuild_url = sortable_tree.data('rebuild_url') || sortable_tree.data('rebuild-url')
|
26
26
|
max_levels = sortable_tree.data('max_levels') || sortable_tree.data('max-levels')
|
27
27
|
|
@@ -29,15 +29,17 @@
|
|
29
29
|
# Initialize Sortable Tree
|
30
30
|
############################################
|
31
31
|
sortable_tree.nestedSortable
|
32
|
-
items:
|
33
|
-
|
34
|
-
|
32
|
+
items: '.the_sortable_tree-item'
|
33
|
+
handle: '.the_sortable_tree-handler'
|
34
|
+
placeholder: 'the_sortable_tree-placeholder'
|
35
|
+
listClass: 'the_sortable_tree-nested_set'
|
36
|
+
|
35
37
|
tolerance: 'pointer'
|
38
|
+
helper: 'clone'
|
36
39
|
maxLevels: max_levels
|
37
40
|
revert: 250
|
38
41
|
tabSize: 25
|
39
42
|
opacity: 0.6
|
40
|
-
placeholder: 'placeholder'
|
41
43
|
disableNesting: 'no-nest'
|
42
44
|
toleranceElement: '> div'
|
43
45
|
forcePlaceholderSize: true
|
@@ -46,15 +48,16 @@
|
|
46
48
|
# Sortable Update Event
|
47
49
|
############################################
|
48
50
|
sortable_tree.on "sortupdate", (event, ui) =>
|
49
|
-
item
|
51
|
+
item = ui.item
|
50
52
|
attr_name = 'node-id'
|
53
|
+
|
51
54
|
item_id = item.data(attr_name)
|
52
55
|
prev_id = item.prev().data(attr_name)
|
53
56
|
next_id = item.next().data(attr_name)
|
54
57
|
parent_id = item.parent().parent().data(attr_name)
|
55
|
-
|
58
|
+
|
56
59
|
rebuild_sortable_tree(rebuild_url, item_id, parent_id, prev_id, next_id)
|
57
60
|
|
58
61
|
true
|
59
62
|
|
60
|
-
$ -> init_sortable_tree()
|
63
|
+
$ -> init_sortable_tree()
|
@@ -0,0 +1,23 @@
|
|
1
|
+
.sortable_tree
|
2
|
+
&.expandable
|
3
|
+
h4
|
4
|
+
margin-left: 50px
|
5
|
+
|
6
|
+
.expand
|
7
|
+
float: left
|
8
|
+
cursor: pointer
|
9
|
+
|
10
|
+
border: 1px solid lightgray
|
11
|
+
color: lightgray
|
12
|
+
|
13
|
+
font-size: 13px
|
14
|
+
font-weight: normal
|
15
|
+
line-height: 13px
|
16
|
+
text-align: center
|
17
|
+
|
18
|
+
width: 13px
|
19
|
+
height: 13px
|
20
|
+
margin: 3px 10px 0 0
|
21
|
+
|
22
|
+
&.empty
|
23
|
+
display: none !important
|
@@ -0,0 +1,36 @@
|
|
1
|
+
.tst
|
2
|
+
margin: 0
|
3
|
+
padding: 0
|
4
|
+
|
5
|
+
&-reset
|
6
|
+
*
|
7
|
+
margin: 0
|
8
|
+
padding: 0
|
9
|
+
|
10
|
+
&-item
|
11
|
+
position: relative
|
12
|
+
margin: 0 0 10px 10px
|
13
|
+
|
14
|
+
&-item_content
|
15
|
+
background: #eef
|
16
|
+
border-radius: 3px
|
17
|
+
|
18
|
+
&-handler
|
19
|
+
cursor: move
|
20
|
+
|
21
|
+
&-placeholder
|
22
|
+
margin-left: 10px
|
23
|
+
margin-bottom: 10px
|
24
|
+
border-radius: 3px
|
25
|
+
background: #4ed740
|
26
|
+
|
27
|
+
&-sortable_error
|
28
|
+
background: red
|
29
|
+
|
30
|
+
&-nested_set
|
31
|
+
margin: 10px 0 0 10px
|
32
|
+
border-left: 1px dashed #bbb
|
33
|
+
list-style: none outside none
|
34
|
+
|
35
|
+
.tst-item
|
36
|
+
margin: 0 0 10px 10px
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.tst_tree
|
2
|
+
margin: 0
|
3
|
+
padding: 0
|
4
|
+
|
5
|
+
*
|
6
|
+
margin: 0
|
7
|
+
padding: 0
|
8
|
+
|
9
|
+
&-list
|
10
|
+
margin: 0 0 0 13px
|
11
|
+
padding: 0 0 0 15px
|
12
|
+
border-left: 1px dashed gray
|
13
|
+
list-style: none outside none
|
14
|
+
|
15
|
+
&-item
|
16
|
+
margin-bottom: 5px
|
17
|
+
position: relative
|
18
|
+
list-style: none outside none
|
19
|
+
|
20
|
+
&-link
|
21
|
+
color: black
|
22
|
+
font-size: 14px
|
23
|
+
|
24
|
+
&:hover
|
25
|
+
color: black
|
26
|
+
background: #ddd
|
27
|
+
|
28
|
+
&-item_content
|
29
|
+
padding: 5px
|
30
|
+
background: #eee
|
31
|
+
margin-bottom: 5px
|
32
|
+
border-radius: 3px
|
33
|
+
|
34
|
+
&:hover
|
35
|
+
background: #ddd
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# or use h.html_escape(node.content)
|
8
8
|
# for escape potentially dangerous content
|
9
9
|
module RenderExpandableTreeHelper
|
10
|
-
module Render
|
10
|
+
module Render
|
11
11
|
class << self
|
12
12
|
attr_accessor :h, :options
|
13
13
|
|
@@ -53,10 +53,10 @@ module RenderExpandableTreeHelper
|
|
53
53
|
|
54
54
|
def children
|
55
55
|
unless options[:children].blank?
|
56
|
-
"<ol class='nested_set'>#{ options[:children] }</ol>"
|
56
|
+
"<ol class='the_sortable_tree-nested_set'>#{ options[:children] }</ol>"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
end
|
61
61
|
end
|
62
|
-
end
|
62
|
+
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# or use h.html_escape(node.content)
|
8
8
|
# for escape potentially dangerous content
|
9
9
|
module RenderSortableTreeHelper
|
10
|
-
module Render
|
10
|
+
module Render
|
11
11
|
class << self
|
12
12
|
attr_accessor :h, :options
|
13
13
|
|
@@ -16,24 +16,43 @@ module RenderSortableTreeHelper
|
|
16
16
|
node = options[:node]
|
17
17
|
|
18
18
|
"
|
19
|
-
<li data-node-id='#{ node.id }'>
|
20
|
-
<div class='
|
21
|
-
<
|
22
|
-
|
23
|
-
|
19
|
+
<li data-node-id='#{ node.id }' class='the_sortable_tree-item'>
|
20
|
+
<div class='ptz_table w100p p5 the_sortable_tree-item_content'>
|
21
|
+
<div class='ptz_tr'>
|
22
|
+
<div class='ptz_td vam w30'>
|
23
|
+
#{ handler }
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class='ptz_td vam'>
|
27
|
+
#{ show_link }
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class='ptz_td vam br-off w10 pr5'>
|
31
|
+
#{ controls }
|
32
|
+
</div>
|
33
|
+
</div>
|
24
34
|
</div>
|
35
|
+
|
25
36
|
#{ children }
|
26
37
|
</li>
|
27
38
|
"
|
28
39
|
end
|
29
40
|
|
41
|
+
def handler
|
42
|
+
"<div class='the_sortable_tree-handler p5'>
|
43
|
+
<i class='fa fa-arrows fs16'></i>
|
44
|
+
</div>"
|
45
|
+
end
|
46
|
+
|
30
47
|
def show_link
|
31
48
|
node = options[:node]
|
32
49
|
ns = options[:namespace]
|
33
50
|
url = h.url_for(:controller => options[:klass].pluralize, :action => :show, :id => node)
|
34
51
|
title_field = options[:title]
|
35
52
|
|
36
|
-
"<
|
53
|
+
"<div class='fs15'>
|
54
|
+
#{ h.link_to(node.send(title_field), url) }
|
55
|
+
</div>"
|
37
56
|
end
|
38
57
|
|
39
58
|
def controls
|
@@ -43,16 +62,15 @@ module RenderSortableTreeHelper
|
|
43
62
|
destroy_path = h.url_for(:controller => options[:klass].pluralize, :action => :destroy, :id => node)
|
44
63
|
|
45
64
|
"
|
46
|
-
<
|
47
|
-
|
48
|
-
|
49
|
-
</div>
|
65
|
+
<a href='#{ edit_path }'>
|
66
|
+
<i class='fa fa-edit fs20'></i>
|
67
|
+
</a>
|
50
68
|
"
|
51
69
|
end
|
52
70
|
|
53
71
|
def children
|
54
72
|
unless options[:children].blank?
|
55
|
-
"<ol class='nested_set'>#{ options[:children] }</ol>"
|
73
|
+
"<ol class='the_sortable_tree-nested_set'>#{ options[:children] }</ol>"
|
56
74
|
end
|
57
75
|
end
|
58
76
|
|
@@ -16,8 +16,8 @@ module RenderTreeHelper
|
|
16
16
|
|
17
17
|
node = options[:node]
|
18
18
|
"
|
19
|
-
<li>
|
20
|
-
<div class='
|
19
|
+
<li class='tst_tree-item'>
|
20
|
+
<div class='tst_tree-item_content'>
|
21
21
|
#{ show_link }
|
22
22
|
</div>
|
23
23
|
#{ children }
|
@@ -30,16 +30,17 @@ module RenderTreeHelper
|
|
30
30
|
ns = options[:namespace]
|
31
31
|
url = h.url_for(ns + [node])
|
32
32
|
title_field = options[:title]
|
33
|
+
klass = 'tst_tree-link'
|
33
34
|
|
34
|
-
"<h4>#{ h.link_to(node.send(title_field), url) }</h4>"
|
35
|
+
"<h4>#{ h.link_to(node.send(title_field), url, class: klass) }</h4>"
|
35
36
|
end
|
36
37
|
|
37
38
|
def children
|
38
39
|
unless options[:children].blank?
|
39
|
-
"<ol>#{ options[:children] }</ol>"
|
40
|
+
"<ol class='tst_tree-list'>#{ options[:children] }</ol>"
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
44
|
end
|
44
45
|
end
|
45
|
-
end
|
46
|
+
end
|