compass-jquery-plugin 0.3.0.beta.14 → 0.3.0.beta.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.loadpath +5 -5
  2. data/.project +18 -18
  3. data/README.textile +19 -1
  4. data/VERSION.yml +1 -1
  5. data/compass-jquery-plugin.gemspec +42 -7
  6. data/gem_tasks/jrails.rake +1 -1
  7. data/gem_tasks/jstree.rake +96 -0
  8. data/gem_tasks/rubygems.rake +1 -1
  9. data/lib/jquery/flash_messages.rb +45 -45
  10. data/lib/jquery/jstree/jstree.rb +116 -0
  11. data/lib/jquery/jstree.rb +7 -0
  12. data/templates/dynatree/jquery.ui/dynatree.aero/ltWait.gif +0 -0
  13. data/templates/dynatree/manifest.rb +146 -147
  14. data/templates/jqgrid/i18n/jqgrid/locale-gl.js +126 -0
  15. data/templates/jqgrid/i18n/jqgrid/locale-gl.min.js +7 -0
  16. data/templates/jqgrid/jquery.jqGrid.js +11565 -11572
  17. data/templates/jqgrid/jquery.jqGrid.min.js +472 -473
  18. data/templates/jqgrid/manifest.rb +70 -72
  19. data/templates/jqical/jquery.jqical.js +7907 -7321
  20. data/templates/jqical/jquery.jqical.min.js +209 -185
  21. data/templates/jqical/jquery.ui/jqical.scss +940 -941
  22. data/templates/jrails/config/initializers/jrails.rb +1 -0
  23. data/templates/jrails/jquery.hotkeys.js +99 -0
  24. data/templates/jrails/jquery.hotkeys.min.js +3 -0
  25. data/templates/jrails/manifest.rb +2 -0
  26. data/templates/jstree/config/initializers/jstree.rb +8 -0
  27. data/templates/jstree/jquery.jstree.js +3664 -0
  28. data/templates/jstree/jquery.jstree.min.js +174 -0
  29. data/templates/jstree/jquery.ui/jstree.aero/clicked.png +0 -0
  30. data/templates/jstree/jquery.ui/jstree.aero/d.gif +0 -0
  31. data/templates/jstree/jquery.ui/jstree.aero/d.png +0 -0
  32. data/templates/jstree/jquery.ui/jstree.aero/hovered.png +0 -0
  33. data/templates/jstree/jquery.ui/jstree.aero/throbber.gif +0 -0
  34. data/templates/jstree/jquery.ui/jstree.aero.scss +209 -0
  35. data/templates/jstree/jquery.ui/jstree.aqua/clicked.png +0 -0
  36. data/templates/jstree/jquery.ui/jstree.aqua/d.gif +0 -0
  37. data/templates/jstree/jquery.ui/jstree.aqua/d.png +0 -0
  38. data/templates/jstree/jquery.ui/jstree.aqua/hovered.png +0 -0
  39. data/templates/jstree/jquery.ui/jstree.aqua/throbber.gif +0 -0
  40. data/templates/jstree/jquery.ui/jstree.aqua.scss +214 -0
  41. data/templates/jstree/jquery.ui/jstree.chrystal/d.gif +0 -0
  42. data/templates/jstree/jquery.ui/jstree.chrystal/d.png +0 -0
  43. data/templates/jstree/jquery.ui/jstree.chrystal/throbber.gif +0 -0
  44. data/templates/jstree/jquery.ui/jstree.chrystal.scss +205 -0
  45. data/templates/jstree/jquery.ui/jstree.classic/d.png +0 -0
  46. data/templates/jstree/jquery.ui/jstree.classic/dot_for_ie.gif +0 -0
  47. data/templates/jstree/jquery.ui/jstree.classic/throbber.gif +0 -0
  48. data/templates/jstree/jquery.ui/jstree.classic.scss +148 -0
  49. data/templates/jstree/jquery.ui/jstree.default/d.gif +0 -0
  50. data/templates/jstree/jquery.ui/jstree.default/d.png +0 -0
  51. data/templates/jstree/jquery.ui/jstree.default/throbber.gif +0 -0
  52. data/templates/jstree/jquery.ui/jstree.default-rtl/d.gif +0 -0
  53. data/templates/jstree/jquery.ui/jstree.default-rtl/d.png +0 -0
  54. data/templates/jstree/jquery.ui/jstree.default-rtl/dots.gif +0 -0
  55. data/templates/jstree/jquery.ui/jstree.default-rtl/throbber.gif +0 -0
  56. data/templates/jstree/jquery.ui/jstree.default-rtl.scss +228 -0
  57. data/templates/jstree/jquery.ui/jstree.default.scss +189 -0
  58. data/templates/jstree/manifest.rb +35 -0
  59. metadata +44 -9
  60. data/templates/dynatree/jquery.ui/dynatree.aero/ltWait.ani +0 -0
  61. data/templates/jqgrid/i18n/jqgrid/locale-dk.js +0 -128
  62. data/templates/jqgrid/i18n/jqgrid/locale-dk.min.js +0 -6
  63. data/templates/jqgrid/i18n/jqgrid/locale-sp.js +0 -128
  64. data/templates/jqgrid/i18n/jqgrid/locale-sp.min.js +0 -7
data/.loadpath CHANGED
@@ -1,5 +1,5 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <loadpath>
3
- <pathentry path="" type="src"/>
4
- <pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/>
5
- </loadpath>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <loadpath>
3
+ <pathentry path="" type="src"/>
4
+ <pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/>
5
+ </loadpath>
data/.project CHANGED
@@ -1,18 +1,18 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>compass-jquery-plugin</name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- <buildCommand>
9
- <name>org.rubypeople.rdt.core.rubybuilder</name>
10
- <arguments>
11
- </arguments>
12
- </buildCommand>
13
- </buildSpec>
14
- <natures>
15
- <nature>org.rubypeople.rdt.core.rubynature</nature>
16
- <nature>org.radrails.rails.core.railsnature</nature>
17
- </natures>
18
- </projectDescription>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>compass-jquery-plugin</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.rubypeople.rdt.core.rubybuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>org.rubypeople.rdt.core.rubynature</nature>
16
+ <nature>org.radrails.rails.core.railsnature</nature>
17
+ </natures>
18
+ </projectDescription>
data/README.textile CHANGED
@@ -9,6 +9,7 @@ h2. Description
9
9
  A Sass-based Meta-Framework for Compass that allows you to mix and match any of the following:
10
10
 
11
11
  * jRails with jQuery 1.4.2 and jQuery.UI 1.8.4 including themes
12
+ * jquery.jstree.js V1.0rc2
12
13
  * jquery.dynatree.js V0.5.3
13
14
  * jquery.ribbon.js
14
15
  * jquery.jqGrid.js V3.8 Beta (with minor changes to make in RESTful)
@@ -37,7 +38,7 @@ To use the localized stylesheets and javacripts for jQuery include (using the ra
37
38
  alternatively you can include:
38
39
  <pre>
39
40
  = stylesheet_link_tag "compiled/jquery.ui/[theme].css", :media => 'screen, projection'
40
- = javascript_include_tag :jquery_142 (or :jquery_132)
41
+ = javascript_include_tag :jquery_142
41
42
  = javascript_include_tag :jrails
42
43
  = raw jrails_javascripts(I18n.locale)</pre>
43
44
 
@@ -59,6 +60,22 @@ To use the localized stylesheets and javacripts include:
59
60
  = stylesheet_link_tag 'compiled/jquery.ui/dynatree.[skin].css', :media => 'screen, projection'
60
61
  = javascript_include_tag :dynatree</pre>
61
62
 
63
+ h3. jQuery jsTree Plugin
64
+
65
+ Use compass to install the jQuery jsTree javascript library into your project.
66
+
67
+ <pre>compass install [-r jquery] jquery/jstree <project name></pre>
68
+
69
+ You will find all the stylesheets in easy-to-read Sass format at:
70
+
71
+ <pre>stylesheets/jquery.ui</pre>
72
+
73
+ To use the localized stylesheets and javacripts include:
74
+
75
+ <pre>
76
+ = stylesheet_link_tag 'compiled/jquery.ui/jstree.[theme].css', :media => 'screen, projection'
77
+ = javascript_include_tag :jstree</pre>
78
+
62
79
  h3. jQuery Ribbon Plugin
63
80
 
64
81
  Use compass to install the jQuery Ribbon javascript library into your project.
@@ -163,6 +180,7 @@ h3. jQuery Plugins included
163
180
  * Fabrizio Balliano and Fabrizio Balliano for <b>"jQuery Layout Plugin":http://www.fabrizioballiano.net/</b>
164
181
  * John Reisig et. al. for <b>"jQuery Form Plugin":http://malsup.com/jquery/form/</b>
165
182
  * Martin Wendt for <b>"jQuery Dynatree Plugin":http://www.wwwendt.de</b>
183
+ * Ivan Bozhanov for <b>"jQuery jsTree Plugin":http://jstree.com/</b>
166
184
  * Mikael Soederstroem for <b>"jQuery Ribbon Plugin":http://jqueryribbon.codeplex.com/</b>
167
185
  * Tony Tomov for <b>"jQuery Grid Plugin":http://www.trirand.com/blog/</b>
168
186
  * David Kaneda for <b>"jQTouch":http://www.jqtouch.com/</b>
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :commit: beta.14
2
+ :commit: beta.16
3
3
  :patch: 0
4
4
  :minor: 3
5
5
  :major: 0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{compass-jquery-plugin}
8
- s.version = "0.3.0.beta.14"
8
+ s.version = "0.3.0.beta.16"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kosmas Schuetz"]
12
- s.date = %q{2010-08-15}
12
+ s.date = %q{2010-09-14}
13
13
  s.description = %q{A compass plugin that integrates jRails, jQuery, jQuery UI and Themes, jqGrid and more into the Compass Sass framework.}
14
14
  s.email = %q{kosmas.schuetz@gmx.com}
15
15
  s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  "gem_tasks/jqical.rake",
32
32
  "gem_tasks/jqtouch.rake",
33
33
  "gem_tasks/jrails.rake",
34
+ "gem_tasks/jstree.rake",
34
35
  "gem_tasks/ribbon.rake",
35
36
  "gem_tasks/rubygems.rake",
36
37
  "gem_tasks/secret_sauce.rake",
@@ -59,6 +60,8 @@ Gem::Specification.new do |s|
59
60
  "lib/jquery/jquery_auto_complete.rb",
60
61
  "lib/jquery/jquery_selector_assertions.rb",
61
62
  "lib/jquery/jrails.rb",
63
+ "lib/jquery/jstree.rb",
64
+ "lib/jquery/jstree/jstree.rb",
62
65
  "lib/jquery/ribbon.rb",
63
66
  "lib/jquery/secret_sauce.rb",
64
67
  "lib/jquery/secret_sauce/controller/ui_dialog_controls.rb",
@@ -100,7 +103,6 @@ Gem::Specification.new do |s|
100
103
  "templates/dynatree/jquery.ui/dynatree.aero/folder_page.png",
101
104
  "templates/dynatree/jquery.ui/dynatree.aero/ltDoc.png",
102
105
  "templates/dynatree/jquery.ui/dynatree.aero/ltError.png",
103
- "templates/dynatree/jquery.ui/dynatree.aero/ltWait.ani",
104
106
  "templates/dynatree/jquery.ui/dynatree.aero/ltWait.gif",
105
107
  "templates/dynatree/jquery.ui/dynatree.aero/move_here.png",
106
108
  "templates/dynatree/jquery.ui/dynatree.aero/rbChecked.png",
@@ -233,8 +235,6 @@ Gem::Specification.new do |s|
233
235
  "templates/jqgrid/i18n/jqgrid/locale-da.min.js",
234
236
  "templates/jqgrid/i18n/jqgrid/locale-de.js",
235
237
  "templates/jqgrid/i18n/jqgrid/locale-de.min.js",
236
- "templates/jqgrid/i18n/jqgrid/locale-dk.js",
237
- "templates/jqgrid/i18n/jqgrid/locale-dk.min.js",
238
238
  "templates/jqgrid/i18n/jqgrid/locale-el.js",
239
239
  "templates/jqgrid/i18n/jqgrid/locale-el.min.js",
240
240
  "templates/jqgrid/i18n/jqgrid/locale-en.js",
@@ -247,6 +247,8 @@ Gem::Specification.new do |s|
247
247
  "templates/jqgrid/i18n/jqgrid/locale-fi.min.js",
248
248
  "templates/jqgrid/i18n/jqgrid/locale-fr.js",
249
249
  "templates/jqgrid/i18n/jqgrid/locale-fr.min.js",
250
+ "templates/jqgrid/i18n/jqgrid/locale-gl.js",
251
+ "templates/jqgrid/i18n/jqgrid/locale-gl.min.js",
250
252
  "templates/jqgrid/i18n/jqgrid/locale-he.js",
251
253
  "templates/jqgrid/i18n/jqgrid/locale-he.min.js",
252
254
  "templates/jqgrid/i18n/jqgrid/locale-hu.js",
@@ -273,8 +275,6 @@ Gem::Specification.new do |s|
273
275
  "templates/jqgrid/i18n/jqgrid/locale-ru.min.js",
274
276
  "templates/jqgrid/i18n/jqgrid/locale-sk.js",
275
277
  "templates/jqgrid/i18n/jqgrid/locale-sk.min.js",
276
- "templates/jqgrid/i18n/jqgrid/locale-sp.js",
277
- "templates/jqgrid/i18n/jqgrid/locale-sp.min.js",
278
278
  "templates/jqgrid/i18n/jqgrid/locale-sv.js",
279
279
  "templates/jqgrid/i18n/jqgrid/locale-sv.min.js",
280
280
  "templates/jqgrid/i18n/jqgrid/locale-tr.js",
@@ -738,6 +738,8 @@ Gem::Specification.new do |s|
738
738
  "templates/jrails/jquery.farbtastic.min.js",
739
739
  "templates/jrails/jquery.haml.js",
740
740
  "templates/jrails/jquery.haml.min.js",
741
+ "templates/jrails/jquery.hotkeys.js",
742
+ "templates/jrails/jquery.hotkeys.min.js",
741
743
  "templates/jrails/jquery.metadata.js",
742
744
  "templates/jrails/jquery.metadata.min.js",
743
745
  "templates/jrails/jquery.pngFix.js",
@@ -1197,6 +1199,39 @@ Gem::Specification.new do |s|
1197
1199
  "templates/jrails/jrails.min.js",
1198
1200
  "templates/jrails/manifest.rb",
1199
1201
  "templates/jrails/partials/_flash_messages.scss",
1202
+ "templates/jstree/config/initializers/jstree.rb",
1203
+ "templates/jstree/jquery.jstree.js",
1204
+ "templates/jstree/jquery.jstree.min.js",
1205
+ "templates/jstree/jquery.ui/jstree.aero.scss",
1206
+ "templates/jstree/jquery.ui/jstree.aero/clicked.png",
1207
+ "templates/jstree/jquery.ui/jstree.aero/d.gif",
1208
+ "templates/jstree/jquery.ui/jstree.aero/d.png",
1209
+ "templates/jstree/jquery.ui/jstree.aero/hovered.png",
1210
+ "templates/jstree/jquery.ui/jstree.aero/throbber.gif",
1211
+ "templates/jstree/jquery.ui/jstree.aqua.scss",
1212
+ "templates/jstree/jquery.ui/jstree.aqua/clicked.png",
1213
+ "templates/jstree/jquery.ui/jstree.aqua/d.gif",
1214
+ "templates/jstree/jquery.ui/jstree.aqua/d.png",
1215
+ "templates/jstree/jquery.ui/jstree.aqua/hovered.png",
1216
+ "templates/jstree/jquery.ui/jstree.aqua/throbber.gif",
1217
+ "templates/jstree/jquery.ui/jstree.chrystal.scss",
1218
+ "templates/jstree/jquery.ui/jstree.chrystal/d.gif",
1219
+ "templates/jstree/jquery.ui/jstree.chrystal/d.png",
1220
+ "templates/jstree/jquery.ui/jstree.chrystal/throbber.gif",
1221
+ "templates/jstree/jquery.ui/jstree.classic.scss",
1222
+ "templates/jstree/jquery.ui/jstree.classic/d.png",
1223
+ "templates/jstree/jquery.ui/jstree.classic/dot_for_ie.gif",
1224
+ "templates/jstree/jquery.ui/jstree.classic/throbber.gif",
1225
+ "templates/jstree/jquery.ui/jstree.default-rtl.scss",
1226
+ "templates/jstree/jquery.ui/jstree.default-rtl/d.gif",
1227
+ "templates/jstree/jquery.ui/jstree.default-rtl/d.png",
1228
+ "templates/jstree/jquery.ui/jstree.default-rtl/dots.gif",
1229
+ "templates/jstree/jquery.ui/jstree.default-rtl/throbber.gif",
1230
+ "templates/jstree/jquery.ui/jstree.default.scss",
1231
+ "templates/jstree/jquery.ui/jstree.default/d.gif",
1232
+ "templates/jstree/jquery.ui/jstree.default/d.png",
1233
+ "templates/jstree/jquery.ui/jstree.default/throbber.gif",
1234
+ "templates/jstree/manifest.rb",
1200
1235
  "templates/ribbon/config/initializers/ribbon.rb",
1201
1236
  "templates/ribbon/jquery.ribbon.js",
1202
1237
  "templates/ribbon/jquery.ribbon.min.js",
@@ -100,7 +100,7 @@ namespace :build do
100
100
  end
101
101
  manifest.print "javascript 'jquery-1.4.2.min.js'\n"
102
102
 
103
- # jQuery 1.4 Comapt 1.3
103
+ # jQuery 1.4 Compat 1.3
104
104
 
105
105
  ['compat-1.3'].each do |path|
106
106
  Dir.foreach File.join(JQUERY_SRC, path) do |file|
@@ -0,0 +1,96 @@
1
+ require 'fileutils'
2
+ require 'lib/handle_js_files'
3
+
4
+ # Compass generator for JSTREE
5
+ JSTREE_SRC = File.join(GEM_ROOT, 'src', 'jstree')
6
+ JSTREE_SRC_THEMES = File.join(JSTREE_SRC, 'themes')
7
+
8
+ JSTREE_DEST_TEMPLATES = File.join(GEM_ROOT, 'templates', 'jstree')
9
+ JSTREE_DEST_THEMES = File.join(JSTREE_DEST_TEMPLATES, 'jquery.ui')
10
+ JSTREE_DEST_IMAGES = File.join(JSTREE_DEST_TEMPLATES, 'jquery.ui')
11
+
12
+ JSTREE_MESSAGE1 = "# Generated by compass-jquery-plugin/gem-tasks/jstree.rake\n# Install with: compass install jquery/jstree\n\n"
13
+ JSTREE_MESSAGE2 = "// Generated by compass-jquery-plugin/gem-tasks/jstree.rake\n\n"
14
+
15
+ all_scripts = [
16
+ 'js/jquery.jstree.js',
17
+ 'js/jstree.core.js',
18
+ 'js/plugins/ui.js',
19
+ 'js/plugins/crrm.js',
20
+ 'js/plugins/themes.js',
21
+ 'js/plugins/hotkeys.js',
22
+ 'js/plugins/json_data.js',
23
+ 'js/plugins/languages.js',
24
+ 'js/plugins/cookies.js',
25
+ 'js/plugins/sort.js',
26
+ 'js/plugins/dnd.js',
27
+ 'js/plugins/checkbox.js',
28
+ 'js/plugins/xml_data.js',
29
+ 'js/plugins/search.js',
30
+ 'js/plugins/contextmenu.js',
31
+ 'js/plugins/types.js',
32
+ 'js/plugins/html_data.js',
33
+ 'js/plugins/themeroller.js',
34
+ 'js/plugins/unique.js',
35
+ 'js/plugins/radio.js'
36
+ ].collect {|filename| File.read(File.join(JSTREE_SRC, filename))}.join "\n\n"
37
+
38
+ namespace :build do
39
+ desc 'Build the stylesheets and templates for jstree.'
40
+ task :jstree do
41
+
42
+ FileUtils.remove_dir JSTREE_DEST_TEMPLATES if File.exists? JSTREE_DEST_TEMPLATES
43
+ FileUtils.mkdir_p(File.join(JSTREE_DEST_TEMPLATES, 'config', 'initializers'))
44
+
45
+ open File.join(JSTREE_DEST_TEMPLATES, 'manifest.rb'), 'w' do |manifest|
46
+ manifest.print JSTREE_MESSAGE1
47
+
48
+ open File.join(JSTREE_DEST_TEMPLATES, 'config', 'initializers', 'jstree.rb'), 'w' do |f|
49
+ f.print(File.read(File.join(JSTREE_SRC, 'config', 'initializers', 'jstree.rb')))
50
+ end
51
+ manifest.print "file 'config/initializers/jstree.rb'\n"
52
+
53
+ open File.join(JSTREE_DEST_TEMPLATES, 'jquery.jstree.js'), 'w' do |f|
54
+ f.print concat_files(all_scripts)
55
+ end
56
+ manifest.print "javascript 'jquery.jstree.js'\n"
57
+
58
+ open File.join(JSTREE_DEST_TEMPLATES, 'jquery.jstree.min.js'), 'w' do |f|
59
+ f.print compress_js(all_scripts, "google")
60
+ end
61
+ manifest.print "javascript 'jquery.jstree.min.js'\n"
62
+
63
+ # jQuery jsTree Skins
64
+
65
+ FileUtils.mkdir_p(JSTREE_DEST_THEMES)
66
+
67
+ Dir.foreach JSTREE_SRC_THEMES do |theme|
68
+ next if /^\./ =~ theme
69
+
70
+ # Convert the stylesheet
71
+
72
+ Dir.foreach File.join(JSTREE_SRC_THEMES, "#{theme}") do |file|
73
+ next unless /\.css$/ =~ file
74
+ css = File.read File.join(JSTREE_SRC_THEMES, "#{theme}", file)
75
+ sass = ''
76
+ IO.popen("sass-convert -F css -T scss", 'r+') { |f| f.print(css); f.close_write; sass = f.read }
77
+ open File.join(JSTREE_DEST_THEMES, "jstree.#{theme}.scss"), 'w' do |f|
78
+ f.write JSTREE_MESSAGE2 + sass
79
+ end
80
+ manifest.print "stylesheet 'jquery.ui/jstree.#{theme}.scss', :media => 'screen, projection'\n"
81
+ end
82
+
83
+ # Copy the theme images directory
84
+ src_dir = File.join(JSTREE_SRC_THEMES, theme, 'images')
85
+ dest_dir = File.join(JSTREE_DEST_IMAGES, "jstree.#{theme}")
86
+ FileUtils.mkdir_p dest_dir
87
+
88
+ Dir.foreach(src_dir) do |image|
89
+ next if /^\./ =~ image
90
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
91
+ manifest.print "image 'jquery.ui/jstree.#{theme}/#{image}'\n"
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -1,6 +1,6 @@
1
1
  desc 'Build all stylesheets and templates.'
2
2
 
3
3
  namespace :build do
4
- task :all => ["build:jrails", "build:dynatree", "build:jqgrid", "build:secret_sauce", "build:ribbon", "build:jqtouch", "build:jqical"] do
4
+ task :all => ["build:jrails", "build:dynatree", "build:jstree", "build:jqgrid", "build:secret_sauce", "build:ribbon", "build:jqtouch", "build:jqical"] do
5
5
  end
6
6
  end
@@ -1,45 +1,45 @@
1
- module FlashMessages
2
- module ControllerMethods
3
- TYPES = [:success, :notice, :warning, :error]
4
-
5
- TYPES.each do |type|
6
- define_method(type) do |msg|
7
- flash[type] = msg
8
- end
9
-
10
- define_method("#{type}_now") do |msg|
11
- flash.now[type] = msg
12
- end
13
- end
14
- end
15
-
16
- module Display
17
- # def flash_messages
18
- # returning html = String.new do
19
- # flash.each do |css_class, message|
20
- # html << content_tag(:div, content_tag(:div, nil, :class => :icon) + message, :class => css_class)
21
- # end
22
- # end
23
- # end
24
-
25
- FLASH_NOTICE_KEYS = [:error, :warning, :notice, :success]
26
-
27
- def flash_messages
28
- return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
29
- formatted_messages = messages.map do |type|
30
- content_tag(:div, nil, :class => type.to_s) do
31
- message_for_item(flash[type], flash["#{type}_item".to_sym])
32
- end
33
- end
34
- formatted_messages.join
35
- end
36
-
37
- def message_for_item(message, item = nil)
38
- if item.is_a?(Array)
39
- content_tag(:div, nil, :class => :icon) + message % link_to(*item)
40
- else
41
- content_tag(:div, nil, :class => :icon) + message % item
42
- end
43
- end
44
- end
45
- end
1
+ module FlashMessages
2
+ module ControllerMethods
3
+ TYPES = [:success, :notice, :warning, :error]
4
+
5
+ TYPES.each do |type|
6
+ define_method(type) do |msg|
7
+ flash[type] = msg
8
+ end
9
+
10
+ define_method("#{type}_now") do |msg|
11
+ flash.now[type] = msg
12
+ end
13
+ end
14
+ end
15
+
16
+ module Display
17
+ # def flash_messages
18
+ # returning html = String.new do
19
+ # flash.each do |css_class, message|
20
+ # html << content_tag(:div, content_tag(:div, nil, :class => :icon) + message, :class => css_class)
21
+ # end
22
+ # end
23
+ # end
24
+
25
+ FLASH_NOTICE_KEYS = [:error, :warning, :notice, :success]
26
+
27
+ def flash_messages
28
+ return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
29
+ formatted_messages = messages.map do |type|
30
+ content_tag(:div, nil, :class => type.to_s) do
31
+ message_for_item(flash[type], flash["#{type}_item".to_sym])
32
+ end
33
+ end
34
+ formatted_messages.join
35
+ end
36
+
37
+ def message_for_item(message, item = nil)
38
+ if item.is_a?(Array)
39
+ content_tag(:div, nil, :class => :icon) + message % link_to(*item)
40
+ else
41
+ content_tag(:div, nil, :class => :icon) + message % item
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,116 @@
1
+ class JsTree < ActiveRecord::Base
2
+ def self.get_children(id)
3
+ result = Array.new
4
+ if id == "1"
5
+ node = find_by_title("ROOT")
6
+ else
7
+ node = find(id)
8
+ end
9
+ children = node.children
10
+ if id != 0
11
+ children.each do |child|
12
+ result << {
13
+ :attr => {:id => "node_#{child.id.to_s}", :rel => child.ntype},
14
+ :data => child.title,
15
+ :state => (child.right - child.left) > 1 ? "closed" : ""
16
+ }
17
+ end
18
+ end
19
+ return result
20
+ end
21
+
22
+ def self.search(search_str)
23
+ result = Array.new
24
+ nodes = find(:all, :conditions => "title LIKE '%#{search_str}%'")
25
+ if nodes
26
+ nodes.each do |node|
27
+ result << "#node_#{node.id.to_s}"
28
+ end
29
+ end
30
+ return result
31
+ end
32
+
33
+ def self.create_node(params)
34
+ if params[:id].to_i > 0
35
+ parent = find(params[:id])
36
+ else
37
+ parent = find_by_title("ROOT")
38
+ end
39
+ node = DemoTree.new()
40
+ node.parent_id = parent.id
41
+ node.position = params[:position]
42
+ node.left = parent[:right]
43
+ node.right = node.left + 1
44
+ node.level = parent.level + 1
45
+ node.title = params[:title]
46
+ node.ntype = params[:type]
47
+ if node.save
48
+ node.ancestors.each do |ancestor|
49
+ ancestor.right += 2
50
+ ancestor.save
51
+ end
52
+ update_all("left = left + 2, right = right + 2", "left >= #{node.right}")
53
+ result = { :status => 1, :id => node.id }
54
+ else
55
+ result = { :status => 0 }
56
+ end
57
+ return result
58
+ end
59
+
60
+ def self.remove_node(id)
61
+ node = find(id)
62
+ left = node.left
63
+ right = node.right
64
+ dif = right - left + 1
65
+ pid = node.parent_id
66
+ pos = node.position
67
+
68
+ # deleting node and its children
69
+ node.delete_branch
70
+ # shift left indexes of nodes right of the node
71
+ update_all("left = left - #{dif}", "left > #{right}")
72
+ # shift right indexes of nodes right of the node and the node's parents
73
+ update_all("right = right - #{dif}", "right > #{left}")
74
+ # Update position of siblings below the deleted node
75
+ update_all("position = position -1", "parent_id = #{pid} AND position > #{pos}")
76
+ result = { :status => 1 }
77
+ return result
78
+ end
79
+
80
+ def self.rename_node(params)
81
+ node = find(params[:id])
82
+ node.title = params[:title]
83
+ if node.save
84
+ return { :status => 1 }
85
+ end
86
+ end
87
+
88
+ def self.copy_children(id, node)
89
+ node.children.each do |child|
90
+ result = copy_node(id, child)
91
+ copy_children(result[:id], child)
92
+ end
93
+ end
94
+
95
+ def self.copy_node(id, node)
96
+ params = {}
97
+ params[:id] = id
98
+ params[:position] = node.position
99
+ params[:title] = node.title
100
+ params[:type] = node.ntype
101
+ create_node(params)
102
+ end
103
+
104
+ def self.move_node(params)
105
+ node_old = find(params[:id])
106
+ result = copy_node(params[:ref], node_old)
107
+ copy_children(result[:id], node_old)
108
+ if params[:copy] == "1"
109
+ result = { :status => 1, :id => result[:id] }
110
+ else
111
+ remove_node(params[:id])
112
+ result = { :status => 1, :id => "1" }
113
+ end
114
+ return result
115
+ end
116
+ end
@@ -0,0 +1,7 @@
1
+ module ActionView
2
+ module Helpers
3
+
4
+ end
5
+ end
6
+
7
+ require 'jquery/jstree/jstree'