jstree-rails-4 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39662753ed3b5136fbe9e4a21c239eaeee0b3929
4
- data.tar.gz: 2f44137ee87f3162ff615b515b577120a7974d3e
3
+ metadata.gz: 637c3e2030c64578c72668ab8339dec3e696ac7d
4
+ data.tar.gz: 2b738a880fa41dbfd500dce03593238d72a5ac60
5
5
  SHA512:
6
- metadata.gz: ffc5309ad0fe5e7b4b49086683fbba0ca40944a0754e3161b40c017bc6b68bf373589690d39a0c19da42ce0d44307b08a0bf2fbf242af8c3afcbd0f9fda07795
7
- data.tar.gz: 21e4df01dfced0d9b5abd7a5b670407af0d0d53bac802722cf9cad975aae16a134299cf15fcb818755de7d1acdaf8f6c6ed94e81d1d84134867c7d2d9e931224
6
+ metadata.gz: 665ee89eeca36314c2a004a9607a943ce852114b08ae8207028a141c1cb0d8fb0e58a2d89d4545f56d3986e5ec101aeff7b91e0a7c9cd8b9f6a5f539e8d8538e
7
+ data.tar.gz: d63e91d381c838e53672f7a508350a670df3bcd522026abaf32315a1d815f161a689bb5dbc4c1053551ffa83a259f8e4cb1dfc1cd0690a5ad1626e603d458f84
data/Gemfile CHANGED
File without changes
@@ -0,0 +1,108 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jstree-rails-4 (3.1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (4.2.1)
10
+ actionpack (= 4.2.1)
11
+ actionview (= 4.2.1)
12
+ activejob (= 4.2.1)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 1.0, >= 1.0.5)
15
+ actionpack (4.2.1)
16
+ actionview (= 4.2.1)
17
+ activesupport (= 4.2.1)
18
+ rack (~> 1.6)
19
+ rack-test (~> 0.6.2)
20
+ rails-dom-testing (~> 1.0, >= 1.0.5)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
22
+ actionview (4.2.1)
23
+ activesupport (= 4.2.1)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
28
+ activejob (4.2.1)
29
+ activesupport (= 4.2.1)
30
+ globalid (>= 0.3.0)
31
+ activemodel (4.2.1)
32
+ activesupport (= 4.2.1)
33
+ builder (~> 3.1)
34
+ activerecord (4.2.1)
35
+ activemodel (= 4.2.1)
36
+ activesupport (= 4.2.1)
37
+ arel (~> 6.0)
38
+ activesupport (4.2.1)
39
+ i18n (~> 0.7)
40
+ json (~> 1.7, >= 1.7.7)
41
+ minitest (~> 5.1)
42
+ thread_safe (~> 0.3, >= 0.3.4)
43
+ tzinfo (~> 1.1)
44
+ arel (6.0.0)
45
+ builder (3.2.2)
46
+ erubis (2.7.0)
47
+ globalid (0.3.5)
48
+ activesupport (>= 4.1.0)
49
+ httpclient (2.6.0.1)
50
+ i18n (0.7.0)
51
+ json (1.8.2)
52
+ loofah (2.0.2)
53
+ nokogiri (>= 1.5.9)
54
+ mail (2.6.3)
55
+ mime-types (>= 1.16, < 3)
56
+ mime-types (2.5)
57
+ mini_portile (0.6.2)
58
+ minitest (5.6.1)
59
+ nokogiri (1.6.6.2)
60
+ mini_portile (~> 0.6.0)
61
+ rack (1.6.0)
62
+ rack-test (0.6.3)
63
+ rack (>= 1.0)
64
+ rails (4.2.1)
65
+ actionmailer (= 4.2.1)
66
+ actionpack (= 4.2.1)
67
+ actionview (= 4.2.1)
68
+ activejob (= 4.2.1)
69
+ activemodel (= 4.2.1)
70
+ activerecord (= 4.2.1)
71
+ activesupport (= 4.2.1)
72
+ bundler (>= 1.3.0, < 2.0)
73
+ railties (= 4.2.1)
74
+ sprockets-rails
75
+ rails-deprecated_sanitizer (1.0.3)
76
+ activesupport (>= 4.2.0.alpha)
77
+ rails-dom-testing (1.0.6)
78
+ activesupport (>= 4.2.0.beta, < 5.0)
79
+ nokogiri (~> 1.6.0)
80
+ rails-deprecated_sanitizer (>= 1.0.1)
81
+ rails-html-sanitizer (1.0.2)
82
+ loofah (~> 2.0)
83
+ railties (4.2.1)
84
+ actionpack (= 4.2.1)
85
+ activesupport (= 4.2.1)
86
+ rake (>= 0.8.7)
87
+ thor (>= 0.18.1, < 2.0)
88
+ rake (10.4.2)
89
+ sprockets (3.0.3)
90
+ rack (~> 1.0)
91
+ sprockets-rails (2.2.4)
92
+ actionpack (>= 3.0)
93
+ activesupport (>= 3.0)
94
+ sprockets (>= 2.8, < 4.0)
95
+ thor (0.19.1)
96
+ thread_safe (0.3.5)
97
+ tzinfo (1.2.2)
98
+ thread_safe (~> 0.1)
99
+
100
+ PLATFORMS
101
+ ruby
102
+
103
+ DEPENDENCIES
104
+ bundler (~> 1.0)
105
+ httpclient (~> 2.2)
106
+ jstree-rails-4!
107
+ rails (>= 3.0)
108
+ thor (~> 0.14)
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  The `jstree-rails-4` gem integrates the `jsTree` jQuery plugin with the Rails asset pipeline.
6
6
 
7
- GemVersion: 1.0.0
7
+ GemVersion: 3.1.1
8
8
 
9
- jsTree Version: 3.0.9
9
+ jsTree Version: 3.1.1
10
10
 
11
11
  ## Usage
12
12
 
data/Rakefile CHANGED
File without changes
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.version = JSTree::Rails::VERSION
7
7
  s.authors = ["Kesha Antonov"]
8
8
  s.email = ["innokenty.longway@gmail.com"]
9
- s.homepage = "https://github.com/argerim/jstree-rails-4"
9
+ s.homepage = "https://github.com/kesha-antonov/jstree-rails-4"
10
10
  s.summary = %q{Integrate jsTree javascript library with Rails asset pipeline}
11
11
  s.description = %q{jsTree is jquery plugin, that provides interactive trees. It is absolutely free, open source and distributed under the MIT license.}
12
12
  s.license = 'MIT'
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_dependency "thor", "~> 0.14"
18
+ s.add_development_dependency "thor", "~> 0.14"
19
19
  s.add_development_dependency "bundler", "~> 1.0"
20
20
  s.add_development_dependency "rails", ">= 3.0"
21
21
  s.add_development_dependency "httpclient", "~> 2.2"
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  module JSTree
2
2
  module Rails
3
- VERSION = "3.1.0"
3
+ VERSION = "3.1.1"
4
4
  end
5
5
  end
File without changes
File without changes
File without changes
@@ -13,7 +13,7 @@
13
13
  }(function ($, undefined) {
14
14
  "use strict";
15
15
  /*!
16
- * jsTree 3.1.0
16
+ * jsTree 3.1.1
17
17
  * http://jstree.com/
18
18
  *
19
19
  * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com)
@@ -71,7 +71,7 @@
71
71
  * specifies the jstree version in use
72
72
  * @name $.jstree.version
73
73
  */
74
- version : '3.1.0',
74
+ version : '3.1.1',
75
75
  /**
76
76
  * holds all the default options used when creating new instances
77
77
  * @name $.jstree.defaults
@@ -711,7 +711,7 @@
711
711
  }
712
712
  if(!this._data.core.ready) {
713
713
  setTimeout($.proxy(function() {
714
- if(!this.get_container_ul().find('.jstree-loading').length) {
714
+ if(this.element && !this.get_container_ul().find('.jstree-loading').length) {
715
715
  this._data.core.ready = true;
716
716
  if(this._data.core.selected.length) {
717
717
  if(this.settings.core.expand_selected_onload) {
@@ -826,7 +826,10 @@
826
826
  .on('focus.jstree', $.proxy(function () {
827
827
  if(+(new Date()) - was_click > 500 && !this._data.core.focused) {
828
828
  was_click = 0;
829
- this.get_node(this.element.attr('aria-activedescendant'), true).find('> .jstree-anchor').focus();
829
+ var act = this.get_node(this.element.attr('aria-activedescendant'), true);
830
+ if(act) {
831
+ act.find('> .jstree-anchor').focus();
832
+ }
830
833
  }
831
834
  }, this))
832
835
  .on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) {
@@ -1468,6 +1471,7 @@
1468
1471
  * @trigger model.jstree, changed.jstree
1469
1472
  */
1470
1473
  _append_json_data : function (dom, data, cb, force_processing) {
1474
+ if(this.element === null) { return; }
1471
1475
  dom = this.get_node(dom);
1472
1476
  dom.children = [];
1473
1477
  dom.children_d = [];
@@ -1761,6 +1765,7 @@
1761
1765
  }
1762
1766
  },
1763
1767
  rslt = function (rslt, worker) {
1768
+ if(this.element === null) { return; }
1764
1769
  this._cnt = rslt.cnt;
1765
1770
  this._model.data = rslt.mod; // breaks the reference in load_node - careful
1766
1771
 
@@ -1927,7 +1932,7 @@
1927
1932
  if(tmp.length) {
1928
1933
  data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel');
1929
1934
  }
1930
- if(data.state.icon) {
1935
+ if(data.state.icon !== undefined) {
1931
1936
  data.icon = data.state.icon;
1932
1937
  }
1933
1938
  if(data.icon === undefined || data.icon === null || data.icon === "") {
@@ -2825,7 +2830,7 @@
2825
2830
  if(p[i] === l) {
2826
2831
  c = !c;
2827
2832
  }
2828
- if(c || p[i] === o || p[i] === l) {
2833
+ if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) {
2829
2834
  this.select_node(p[i], true, false, e);
2830
2835
  }
2831
2836
  else {
@@ -3716,7 +3721,7 @@
3716
3721
  old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
3717
3722
  is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);
3718
3723
  old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1;
3719
- if(old_ins || old_ins._id) {
3724
+ if(old_ins && old_ins._id) {
3720
3725
  obj = old_ins._model.data[obj.id];
3721
3726
  }
3722
3727
 
@@ -3888,7 +3893,7 @@
3888
3893
  old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
3889
3894
  is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);
3890
3895
 
3891
- if(old_ins || old_ins._id) {
3896
+ if(old_ins && old_ins._id) {
3892
3897
  obj = old_ins._model.data[obj.id];
3893
3898
  }
3894
3899
 
@@ -4084,11 +4089,12 @@
4084
4089
  },
4085
4090
  /**
4086
4091
  * put a node in edit mode (input field to rename the node)
4087
- * @name edit(obj [, default_text])
4092
+ * @name edit(obj [, default_text, callback])
4088
4093
  * @param {mixed} obj
4089
- * @param {String} default_text the text to populate the input with (if omitted the node text value is used)
4094
+ * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used)
4095
+ * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node and a status parameter - true if the rename is successful, false otherwise. You can access the node's title using .text
4090
4096
  */
4091
- edit : function (obj, default_text) {
4097
+ edit : function (obj, default_text, callback) {
4092
4098
  var rtl, w, a, s, t, h1, h2, fn, tmp;
4093
4099
  obj = this.get_node(obj);
4094
4100
  if(!obj) { return false; }
@@ -4130,15 +4136,22 @@
4130
4136
  },
4131
4137
  "blur" : $.proxy(function () {
4132
4138
  var i = s.children(".jstree-rename-input"),
4133
- v = i.val();
4139
+ v = i.val(),
4140
+ f = this.settings.core.force_text,
4141
+ nv;
4134
4142
  if(v === "") { v = t; }
4135
4143
  h1.remove();
4136
4144
  s.replaceWith(a);
4137
4145
  s.remove();
4146
+ t = f ? t : $('<div></div>').append($.parseHTML(t)).html();
4138
4147
  this.set_text(obj, t);
4139
- if(this.rename_node(obj, $('<div></div>').text(v)[this.settings.core.force_text ? 'text' : 'html']()) === false) {
4148
+ nv = !!this.rename_node(obj, f ? $('<div></div>').text(v).text() : $('<div></div>').append($.parseHTML(v)).html());
4149
+ if(!nv) {
4140
4150
  this.set_text(obj, t); // move this up? and fix #483
4141
4151
  }
4152
+ if(callback) {
4153
+ callback.call(this, tmp, nv);
4154
+ }
4142
4155
  }, this),
4143
4156
  "keydown" : function (event) {
4144
4157
  var key = event.which;
@@ -4780,6 +4793,7 @@
4780
4793
  * @plugin checkbox
4781
4794
  */
4782
4795
  this._undetermined = function () {
4796
+ if(this.element === null) { return; }
4783
4797
  var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this;
4784
4798
  for(i = 0, j = s.length; i < j; i++) {
4785
4799
  if(m[s[i]] && m[s[i]].parents) {
@@ -6432,6 +6446,13 @@
6432
6446
  * @plugin search
6433
6447
  */
6434
6448
  show_only_matches : false,
6449
+ /**
6450
+ * Indicates if the children of matched element are shown (when show_only_matches is true)
6451
+ * This setting can be changed at runtime when calling the search method. Default is `false`.
6452
+ * @name $.jstree.defaults.search.show_only_matches_children
6453
+ * @plugin search
6454
+ */
6455
+ show_only_matches_children : false,
6435
6456
  /**
6436
6457
  * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`.
6437
6458
  * @name $.jstree.defaults.search.close_opened_onclear
@@ -6462,6 +6483,7 @@
6462
6483
  this._data.search.res = [];
6463
6484
  this._data.search.opn = [];
6464
6485
  this._data.search.som = false;
6486
+ this._data.search.smc = false;
6465
6487
 
6466
6488
  this.element
6467
6489
  .on('before_open.jstree', $.proxy(function (e, data) {
@@ -6478,6 +6500,9 @@
6478
6500
 
6479
6501
  this.element.find(".jstree-node").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
6480
6502
  o = o.add(this._data.search.dom);
6503
+ if(this._data.search.smc) {
6504
+ this._data.search.dom.children(".jstree-children").find(".jstree-node").show();
6505
+ }
6481
6506
  o.parentsUntil(".jstree").addBack().show()
6482
6507
  .filter(".jstree-children").each(function () { $(this).children(".jstree-node:visible").eq(-1).addClass("jstree-last"); });
6483
6508
  }
@@ -6487,6 +6512,9 @@
6487
6512
  if(this._data.search.som) {
6488
6513
  if(data.nodes.length) {
6489
6514
  this.element.find(".jstree-node").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
6515
+ if(this._data.search.smc) {
6516
+ data.nodes.children(".jstree-children").find(".jstree-node").show();
6517
+ }
6490
6518
  data.nodes.parentsUntil(".jstree").addBack().show()
6491
6519
  .filter(".jstree-children").each(function () { $(this).children(".jstree-node:visible").eq(-1).addClass("jstree-last"); });
6492
6520
  }
@@ -6509,7 +6537,7 @@
6509
6537
  * @plugin search
6510
6538
  * @trigger search.jstree
6511
6539
  */
6512
- this.search = function (str, skip_async, show_only_matches, inside, append) {
6540
+ this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) {
6513
6541
  if(str === false || $.trim(str.toString()) === "") {
6514
6542
  return this.clear_search();
6515
6543
  }
@@ -6528,6 +6556,9 @@
6528
6556
  if(show_only_matches === undefined) {
6529
6557
  show_only_matches = s.show_only_matches;
6530
6558
  }
6559
+ if(show_only_matches_children === undefined) {
6560
+ show_only_matches_children = s.show_only_matches_children;
6561
+ }
6531
6562
  if(!skip_async && a !== false) {
6532
6563
  if($.isFunction(a)) {
6533
6564
  return a.call(this, str, $.proxy(function (d) {
@@ -6563,6 +6594,7 @@
6563
6594
  this._data.search.res = [];
6564
6595
  this._data.search.opn = [];
6565
6596
  this._data.search.som = show_only_matches;
6597
+ this._data.search.smc = show_only_matches_children;
6566
6598
  }
6567
6599
 
6568
6600
  f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstree-rails-4
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kesha Antonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.14'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - Gemfile
78
+ - Gemfile.lock
78
79
  - LICENSE
79
80
  - README.md
80
81
  - Rakefile
@@ -92,7 +93,7 @@ files:
92
93
  - vendor/assets/javascripts/jstree.js
93
94
  - vendor/assets/stylesheets/jstree-default-dark.scss
94
95
  - vendor/assets/stylesheets/jstree-default.scss
95
- homepage: https://github.com/argerim/jstree-rails-4
96
+ homepage: https://github.com/kesha-antonov/jstree-rails-4
96
97
  licenses:
97
98
  - MIT
98
99
  metadata: {}