jstree_rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/lib/jstree_rails/version.rb +1 -1
- data/lib/jstree_rails/viewers.rb +12 -7
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/lib/jstree_rails/version.rb
CHANGED
data/lib/jstree_rails/viewers.rb
CHANGED
@@ -4,7 +4,7 @@ module JsTreeRails
|
|
4
4
|
include RailsJavaScriptHelpers
|
5
5
|
|
6
6
|
def jstree(dom_id, options={})
|
7
|
-
("<div id=\"#{dom_id.sub(/^#/, '')}\"></div>" +
|
7
|
+
("<div id=\"#{dom_id.sub(/^#/, '')}\" class=\"jstree-rails\"></div>" +
|
8
8
|
javascript_tag{
|
9
9
|
"jQuery(function(){
|
10
10
|
jQuery('#{format_id(dom_id)}').jstree(
|
@@ -16,14 +16,19 @@ module JsTreeRails
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Send entire tree structure (-1 forces entire tree. update to make configurable)
|
19
|
-
def jstree_send_link(name, dom_id, url_or_path,
|
20
|
-
|
19
|
+
def jstree_send_link(name, dom_id, url_or_path, link_args={}, ajax_args={})
|
20
|
+
built_ajax_args = {
|
21
|
+
:type => link_args.delete(:method) || 'post',
|
22
|
+
:data => {
|
23
|
+
:data => RawJS.new("jQuery(#{format_type_to_js(format_id(dom_id))}).jstree('get_json', -1)")
|
24
|
+
}
|
25
|
+
}.merge(ajax_args)
|
26
|
+
link_to_function(name, link_args) do |page|
|
21
27
|
page << "
|
22
28
|
jQuery.ajax(
|
23
|
-
#{format_type_to_js(url_or_path)},
|
24
|
-
|
25
|
-
|
26
|
-
})"
|
29
|
+
#{format_type_to_js(url_or_path)},
|
30
|
+
#{format_type_to_js(built_ajax_args)}
|
31
|
+
)"
|
27
32
|
end
|
28
33
|
end
|
29
34
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jstree_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Roberts
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-12 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|