the_sortable_tree 1.9.2 → 1.9.3

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/README.md CHANGED
@@ -14,7 +14,7 @@ Sortable awesom_nested_set, Drag&Drop GUI for awesom_nested_set, View Helper for
14
14
 
15
15
  ### Capabilities
16
16
 
17
- **Just Tree [default or tree option)**
17
+ **Just Tree [default or tree option]**
18
18
 
19
19
  ![TheSortableTree](https://github.com/the-teacher/the_sortable_tree/raw/master/pic_min.jpg)
20
20
 
@@ -28,6 +28,10 @@ With New Comment form and reply functionality
28
28
 
29
29
  ![TheSortableTree](https://github.com/the-teacher/the_sortable_tree/raw/dev/comments.gif)
30
30
 
31
+ ### LiveDemo and App for testcase creating
32
+
33
+ https://github.com/the-teacher/the_sortable_tree_test_app
34
+
31
35
  ### Install
32
36
 
33
37
  gem 'haml'
@@ -142,13 +146,13 @@ end
142
146
  ### Render your tree
143
147
 
144
148
  ``` ruby
145
- = sortable_tree @pages, :new_url => new_page_path
149
+ = sortable_tree @pages
146
150
  ```
147
151
 
148
152
  ### Render your sortable tree
149
153
 
150
154
  ``` ruby
151
- = sortable_tree @pages, :new_url => new_page_path, :type => :sortable, :max_levels => 4
155
+ = sortable_tree @pages, :type => :sortable, :new_url => new_page_path, :max_levels => 4
152
156
  ```
153
157
 
154
158
  ### Render your comments tree (with New Form and Reply)
@@ -156,12 +160,63 @@ end
156
160
  Plz, read **Comments Doc** before using this
157
161
 
158
162
  ``` ruby
159
- = sortable_tree @comments, :title => :name, :type => :comments
163
+ = sortable_tree @comments, :type => :comments, :title => :name
160
164
  ```
161
165
 
162
166
  ### Comments Doc
163
167
 
164
- Coming soon...
168
+ My comment Model looks like this:
169
+
170
+ ``` ruby
171
+ create_table :comments do |t|
172
+ t.string :name
173
+ t.string :email
174
+
175
+ t.text :raw_content
176
+ t.text :content
177
+ end
178
+ ```
179
+
180
+ For me is very important to have 2 fields for **content**.
181
+
182
+ **raw_content** is unsecure raw content from user (this name using in new comment form).
183
+
184
+ **content** is prepared content once passed by content filters (Textile, Sanitize and others). This field using for rendering.
185
+
186
+ There is base example of my Comment Model.
187
+
188
+ ``` ruby
189
+ class Comment < ActiveRecord::Base
190
+ acts_as_nested_set
191
+ include TheSortableTree::Scopes
192
+ before_save :prepare_content
193
+
194
+ private
195
+
196
+ def prepare_content
197
+ # Any content filters here
198
+ self.content = "<b>#{self.raw_content}</b>"
199
+ end
200
+ end
201
+ ```
202
+
203
+ Plz, read **Comments Options** for modify Render Helper for your purposes.
204
+
205
+ If you have Model like this:
206
+
207
+ ``` ruby
208
+ create_table :comments do |t|
209
+ t.string :topic
210
+ t.string :contacts
211
+ t.text :content
212
+ end
213
+ ```
214
+
215
+ You can call helper with next params:
216
+
217
+ ``` ruby
218
+ = sortable_tree @comments, :type => :comments, :title => :topic, :contacts_field => :contacts, :raw_content_field => :content, :content_field => :content
219
+ ```
165
220
 
166
221
  ### Customization
167
222
 
@@ -220,7 +275,7 @@ If you need to render a part of tree:
220
275
 
221
276
  ``` ruby
222
277
  = @root.inspect
223
- = sortable_tree @pages, :new_url => new_page_path
278
+ = sortable_tree @pages
224
279
  ```
225
280
 
226
281
  If **TheSortableTree** can't correctly define a Name of your Model, just add **sortable_model** into your Controller:
@@ -243,6 +298,19 @@ class Inventory::CategoriesController < ApplicationController
243
298
  end
244
299
  ```
245
300
 
301
+ How can I render a **select/options** menu in form? Should I use TheSortableTree?
302
+
303
+ No. You should not. TheSortableTree is helper for building composite interfaces. Simple dropdown menu can be rendering with Awesome Nested Set Helper **sorted_nested_set_options**
304
+
305
+ There is Example:
306
+
307
+ ```ruby
308
+ - sorted_nested_set_options(Catalog, lambda{ |catalog| catalog.lft }) do |catalog, level|
309
+ - options << content_tag(:option, catalog.title, :value => catalog.id, :class => "level_#{level}")
310
+
311
+ = f.select :catalog_id, options, {}
312
+ ```
313
+
246
314
  ### Comments Options
247
315
 
248
316
  **node_id** - comment's id which should be set as value of hidden field **parend_id** when Reply link pressed (**:id** by default)
@@ -289,12 +357,10 @@ Take files from the gem and put it in your Rails 2 application.
289
357
 
290
358
  And fix errors :) Ha-Ha-Ha! You can ask me if you will do it.
291
359
 
292
- ### LiveDemo and App for testcase creating
293
-
294
- https://github.com/the-teacher/the_sortable_tree_test_app
295
-
296
360
  ### Changelog
297
361
 
362
+ 1.9.3 - Jeffery Utter patch for coffee script
363
+
298
364
  1.9.2 - View Generators updated
299
365
 
300
366
  1.9.1 - Rewrite with coffee => **assets/javascripts/sortable/base.js.coffee**
@@ -319,7 +385,7 @@ Rendered by 50 sec.
319
385
 
320
386
  I think it is good result for rendering by partials.
321
387
 
322
- ### It's can be faster?
388
+ ### Can it be faster?
323
389
 
324
390
  Perhaps. Read next idea to learn more. There is no implementation now, sorry.
325
391
 
@@ -19,7 +19,7 @@ $ ->
19
19
  toleranceElement: '> div'
20
20
 
21
21
  $('ol.sortable').sortable
22
- update: (event, ui) ->
22
+ update: (event, ui) =>
23
23
  parent_id = ui.item.parent().parent().attr('id')
24
24
  item_id = ui.item.attr('id')
25
25
  prev_id = ui.item.prev().attr('id')
@@ -27,7 +27,7 @@ $ ->
27
27
 
28
28
  @rebuild item_id, parent_id, prev_id, next_id
29
29
 
30
- rebuild: (item_id, parent_id, prev_id, next_id) ->
30
+ rebuild: (item_id, parent_id, prev_id, next_id) =>
31
31
  $.ajax
32
32
  type: 'POST'
33
33
  dataType: 'script'
@@ -1,3 +1,3 @@
1
1
  module TheSortableTree
2
- VERSION = "1.9.2"
2
+ VERSION = "1.9.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_sortable_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-09 00:00:00.000000000Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &83556380 !ruby/object:Gem::Requirement
16
+ requirement: &8578180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *83556380
24
+ version_requirements: *8578180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &83556170 !ruby/object:Gem::Requirement
27
+ requirement: &8577760 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *83556170
35
+ version_requirements: *8577760
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &83555940 !ruby/object:Gem::Requirement
38
+ requirement: &8577300 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *83555940
46
+ version_requirements: *8577300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-rails
49
- requirement: &83555730 !ruby/object:Gem::Requirement
49
+ requirement: &8576880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *83555730
57
+ version_requirements: *8576880
58
58
  description: Sortable awesom_nested_set, Drag&Drop GUI for awesom_nested_set, View
59
59
  Helper for nested set, Nested Comments
60
60
  email:
@@ -65,93 +65,93 @@ extra_rdoc_files:
65
65
  - README.md
66
66
  files:
67
67
  - app/controllers/the_sortable_tree_controller.rb
68
+ - app/assets/javascripts/comments/base.js.coffee
69
+ - app/assets/javascripts/sortable/base.js.coffee
70
+ - app/assets/javascripts/jquery.ui.nestedSortable.js
71
+ - app/assets/images/iconza/blue/downloads_folder.png
72
+ - app/assets/images/iconza/blue/edit.png
73
+ - app/assets/images/iconza/blue/move.png
74
+ - app/assets/images/iconza/blue/up.png
75
+ - app/assets/images/iconza/blue/add.png
76
+ - app/assets/images/iconza/blue/down.png
77
+ - app/assets/images/iconza/blue/delete.png
68
78
  - app/assets/images/iconza/red/edit.png
79
+ - app/assets/images/iconza/red/up.png
80
+ - app/assets/images/iconza/red/add.png
81
+ - app/assets/images/iconza/red/newspaper.png
69
82
  - app/assets/images/iconza/red/down.png
70
83
  - app/assets/images/iconza/red/zoom.png
71
84
  - app/assets/images/iconza/red/trash.png
72
- - app/assets/images/iconza/red/newspaper.png
73
85
  - app/assets/images/iconza/red/delete.png
74
- - app/assets/images/iconza/red/up.png
75
- - app/assets/images/iconza/red/add.png
76
- - app/assets/images/iconza/gray/mail.png
77
- - app/assets/images/iconza/gray/edit.png
78
- - app/assets/images/iconza/gray/down.png
79
- - app/assets/images/iconza/gray/delete.png
80
86
  - app/assets/images/iconza/gray/push_pin.png
87
+ - app/assets/images/iconza/gray/edit.png
88
+ - app/assets/images/iconza/gray/lock.png
81
89
  - app/assets/images/iconza/gray/up.png
82
90
  - app/assets/images/iconza/gray/add.png
83
- - app/assets/images/iconza/gray/lock.png
84
- - app/assets/images/iconza/blue/edit.png
85
- - app/assets/images/iconza/blue/down.png
86
- - app/assets/images/iconza/blue/downloads_folder.png
87
- - app/assets/images/iconza/blue/move.png
88
- - app/assets/images/iconza/blue/delete.png
89
- - app/assets/images/iconza/blue/up.png
90
- - app/assets/images/iconza/blue/add.png
91
- - app/assets/stylesheets/tree.css.scss
91
+ - app/assets/images/iconza/gray/down.png
92
+ - app/assets/images/iconza/gray/delete.png
93
+ - app/assets/images/iconza/gray/mail.png
92
94
  - app/assets/stylesheets/comments_tree.css.scss
95
+ - app/assets/stylesheets/tree.css.scss
93
96
  - app/assets/stylesheets/sortable.css.scss
94
- - app/assets/javascripts/comments/base.js.coffee
95
- - app/assets/javascripts/sortable/base.js.coffee
96
- - app/assets/javascripts/jquery.ui.nestedSortable.js
97
+ - app/helpers/the_sortable_tree_helper.rb
98
+ - app/views/comments/base/_new_comment_form.html.haml
97
99
  - app/views/comments/base/_children.html.haml
98
100
  - app/views/comments/base/_node.html.haml
99
- - app/views/comments/base/_tree.html.haml
100
101
  - app/views/comments/base/_comment.html.haml
101
- - app/views/comments/base/_new_comment_form.html.haml
102
+ - app/views/comments/base/_tree.html.haml
103
+ - app/views/sortable/base/_new.html.haml
102
104
  - app/views/sortable/base/_children.html.haml
103
105
  - app/views/sortable/base/_node.html.haml
104
106
  - app/views/sortable/base/_link.html.haml
105
- - app/views/sortable/base/_tree.html.haml
106
- - app/views/sortable/base/_new.html.haml
107
107
  - app/views/sortable/base/_controls.html.haml
108
+ - app/views/sortable/base/_tree.html.haml
108
109
  - app/views/tree/base/_children.html.haml
109
110
  - app/views/tree/base/_node.html.haml
110
111
  - app/views/tree/base/_link.html.haml
111
112
  - app/views/tree/base/_tree.html.haml
112
- - app/helpers/the_sortable_tree_helper.rb
113
- - config/locales/ru.yml
114
113
  - config/locales/en.yml
114
+ - config/locales/ru.yml
115
115
  - lib/the_sortable_tree/version.rb
116
116
  - lib/the_sortable_tree/engine.rb
117
- - lib/tasks/the_sortable_tree.rake
118
117
  - lib/generators/the_sortable_tree/views_generator.rb
118
+ - lib/tasks/the_sortable_tree.rake
119
119
  - lib/the_sortable_tree.rb
120
120
  - MIT-LICENSE
121
121
  - Rakefile
122
122
  - README.md
123
- - spec/controlllers/controller_mixin_spec.rb
124
123
  - spec/spec_helper.rb
125
- - spec/dummy/README.rdoc
126
- - spec/dummy/Rakefile
127
- - spec/dummy/config.ru
128
- - spec/dummy/config/boot.rb
129
- - spec/dummy/config/application.rb
130
- - spec/dummy/config/environment.rb
131
- - spec/dummy/config/locales/en.yml
132
- - spec/dummy/config/initializers/session_store.rb
133
- - spec/dummy/config/initializers/backtrace_silencers.rb
134
- - spec/dummy/config/initializers/mime_types.rb
135
- - spec/dummy/config/initializers/wrap_parameters.rb
136
- - spec/dummy/config/initializers/secret_token.rb
137
- - spec/dummy/config/initializers/inflections.rb
138
- - spec/dummy/config/routes.rb
139
- - spec/dummy/config/environments/development.rb
140
- - spec/dummy/config/environments/test.rb
141
- - spec/dummy/config/environments/production.rb
142
- - spec/dummy/config/database.yml
143
- - spec/dummy/public/500.html
124
+ - spec/controlllers/controller_mixin_spec.rb
144
125
  - spec/dummy/public/404.html
145
126
  - spec/dummy/public/422.html
127
+ - spec/dummy/public/500.html
146
128
  - spec/dummy/public/favicon.ico
129
+ - spec/dummy/Rakefile
147
130
  - spec/dummy/db/test.sqlite3
148
131
  - spec/dummy/log/test.log
149
- - spec/dummy/app/controllers/application_controller.rb
132
+ - spec/dummy/script/rails
150
133
  - spec/dummy/app/controllers/tests_controller.rb
151
- - spec/dummy/app/assets/stylesheets/application.css
134
+ - spec/dummy/app/controllers/application_controller.rb
152
135
  - spec/dummy/app/assets/javascripts/application.js
136
+ - spec/dummy/app/assets/stylesheets/application.css
153
137
  - spec/dummy/app/views/layouts/application.html.erb
154
- - spec/dummy/script/rails
138
+ - spec/dummy/config.ru
139
+ - spec/dummy/config/routes.rb
140
+ - spec/dummy/config/application.rb
141
+ - spec/dummy/config/environments/development.rb
142
+ - spec/dummy/config/environments/test.rb
143
+ - spec/dummy/config/environments/production.rb
144
+ - spec/dummy/config/database.yml
145
+ - spec/dummy/config/environment.rb
146
+ - spec/dummy/config/boot.rb
147
+ - spec/dummy/config/locales/en.yml
148
+ - spec/dummy/config/initializers/mime_types.rb
149
+ - spec/dummy/config/initializers/session_store.rb
150
+ - spec/dummy/config/initializers/wrap_parameters.rb
151
+ - spec/dummy/config/initializers/backtrace_silencers.rb
152
+ - spec/dummy/config/initializers/inflections.rb
153
+ - spec/dummy/config/initializers/secret_token.rb
154
+ - spec/dummy/README.rdoc
155
155
  homepage: https://github.com/the-teacher/the_sortable_tree
156
156
  licenses: []
157
157
  post_install_message:
@@ -178,35 +178,35 @@ specification_version: 3
178
178
  summary: Sortable awesom_nested_set, Drag&Drop GUI for awesom_nested_set, View Helper
179
179
  for nested set, Nested Comments
180
180
  test_files:
181
- - spec/controlllers/controller_mixin_spec.rb
182
181
  - spec/spec_helper.rb
183
- - spec/dummy/README.rdoc
184
- - spec/dummy/Rakefile
185
- - spec/dummy/config.ru
186
- - spec/dummy/config/boot.rb
187
- - spec/dummy/config/application.rb
188
- - spec/dummy/config/environment.rb
189
- - spec/dummy/config/locales/en.yml
190
- - spec/dummy/config/initializers/session_store.rb
191
- - spec/dummy/config/initializers/backtrace_silencers.rb
192
- - spec/dummy/config/initializers/mime_types.rb
193
- - spec/dummy/config/initializers/wrap_parameters.rb
194
- - spec/dummy/config/initializers/secret_token.rb
195
- - spec/dummy/config/initializers/inflections.rb
196
- - spec/dummy/config/routes.rb
197
- - spec/dummy/config/environments/development.rb
198
- - spec/dummy/config/environments/test.rb
199
- - spec/dummy/config/environments/production.rb
200
- - spec/dummy/config/database.yml
201
- - spec/dummy/public/500.html
182
+ - spec/controlllers/controller_mixin_spec.rb
202
183
  - spec/dummy/public/404.html
203
184
  - spec/dummy/public/422.html
185
+ - spec/dummy/public/500.html
204
186
  - spec/dummy/public/favicon.ico
187
+ - spec/dummy/Rakefile
205
188
  - spec/dummy/db/test.sqlite3
206
189
  - spec/dummy/log/test.log
207
- - spec/dummy/app/controllers/application_controller.rb
190
+ - spec/dummy/script/rails
208
191
  - spec/dummy/app/controllers/tests_controller.rb
209
- - spec/dummy/app/assets/stylesheets/application.css
192
+ - spec/dummy/app/controllers/application_controller.rb
210
193
  - spec/dummy/app/assets/javascripts/application.js
194
+ - spec/dummy/app/assets/stylesheets/application.css
211
195
  - spec/dummy/app/views/layouts/application.html.erb
212
- - spec/dummy/script/rails
196
+ - spec/dummy/config.ru
197
+ - spec/dummy/config/routes.rb
198
+ - spec/dummy/config/application.rb
199
+ - spec/dummy/config/environments/development.rb
200
+ - spec/dummy/config/environments/test.rb
201
+ - spec/dummy/config/environments/production.rb
202
+ - spec/dummy/config/database.yml
203
+ - spec/dummy/config/environment.rb
204
+ - spec/dummy/config/boot.rb
205
+ - spec/dummy/config/locales/en.yml
206
+ - spec/dummy/config/initializers/mime_types.rb
207
+ - spec/dummy/config/initializers/session_store.rb
208
+ - spec/dummy/config/initializers/wrap_parameters.rb
209
+ - spec/dummy/config/initializers/backtrace_silencers.rb
210
+ - spec/dummy/config/initializers/inflections.rb
211
+ - spec/dummy/config/initializers/secret_token.rb
212
+ - spec/dummy/README.rdoc