blacklight_range_limit 1.2.0 → 1.2.1

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.
@@ -11,7 +11,9 @@ The plugin defines the following options:
11
11
  Selection support is enabled by setting the mode to one of "x", "y" or
12
12
  "xy". In "x" mode, the user will only be able to specify the x range,
13
13
  similarly for "y" mode. For "xy", the selection becomes a rectangle
14
- where both ranges can be specified. "color" is color of the selection.
14
+ where both ranges can be specified. "color" is color of the selection
15
+ (if you need to change the color later on, you can get to it with
16
+ plot.getOptions().selection.color).
15
17
 
16
18
  When selection support is enabled, a "plotselected" event will be
17
19
  emitted on the DOM element you passed into the plot function. The
@@ -79,11 +81,13 @@ The plugin allso adds the following methods to the plot object:
79
81
  // make this plugin much slimmer.
80
82
  var savedhandlers = {};
81
83
 
84
+ var mouseUpHandler = null;
85
+
82
86
  function onMouseMove(e) {
83
87
  if (selection.active) {
84
- plot.getPlaceholder().trigger("plotselecting", [ getSelection() ]);
85
-
86
88
  updateSelection(e);
89
+
90
+ plot.getPlaceholder().trigger("plotselecting", [ getSelection() ]);
87
91
  }
88
92
  }
89
93
 
@@ -107,18 +111,24 @@ The plugin allso adds the following methods to the plot object:
107
111
  setSelectionPos(selection.first, e);
108
112
 
109
113
  selection.active = true;
114
+
115
+ // this is a bit silly, but we have to use a closure to be
116
+ // able to whack the same handler again
117
+ mouseUpHandler = function (e) { onMouseUp(e); };
110
118
 
111
- $(document).one("mouseup", onMouseUp);
119
+ $(document).one("mouseup", mouseUpHandler);
112
120
  }
113
121
 
114
122
  function onMouseUp(e) {
123
+ mouseUpHandler = null;
124
+
115
125
  // revert drag stuff for old-school browsers
116
126
  if (document.onselectstart !== undefined)
117
127
  document.onselectstart = savedhandlers.onselectstart;
118
128
  if (document.ondrag !== undefined)
119
129
  document.ondrag = savedhandlers.ondrag;
120
130
 
121
- // no more draggy-dee-drag
131
+ // no more dragging
122
132
  selection.active = false;
123
133
  updateSelection(e);
124
134
 
@@ -197,13 +207,12 @@ The plugin allso adds the following methods to the plot object:
197
207
  }
198
208
  }
199
209
 
200
- // taken from markings support
210
+ // function taken from markings support in Flot
201
211
  function extractRange(ranges, coord) {
202
- var axis, from, to, axes, key;
212
+ var axis, from, to, key, axes = plot.getAxes();
203
213
 
204
- axes = plot.getUsedAxes();
205
- for (i = 0; i < axes.length; ++i) {
206
- axis = axes[i];
214
+ for (var k in axes) {
215
+ axis = axes[k];
207
216
  if (axis.direction == coord) {
208
217
  key = coord + axis.n + "axis";
209
218
  if (!ranges[key] && axis.n == 1)
@@ -233,7 +242,6 @@ The plugin allso adds the following methods to the plot object:
233
242
  return { from: from, to: to, axis: axis };
234
243
  }
235
244
 
236
-
237
245
  function setSelection(ranges, preventEvent) {
238
246
  var axis, range, o = plot.getOptions();
239
247
 
@@ -277,11 +285,10 @@ The plugin allso adds the following methods to the plot object:
277
285
 
278
286
  plot.hooks.bindEvents.push(function(plot, eventHolder) {
279
287
  var o = plot.getOptions();
280
- if (o.selection.mode != null)
288
+ if (o.selection.mode != null) {
281
289
  eventHolder.mousemove(onMouseMove);
282
-
283
- if (o.selection.mode != null)
284
290
  eventHolder.mousedown(onMouseDown);
291
+ }
285
292
  });
286
293
 
287
294
 
@@ -312,6 +319,15 @@ The plugin allso adds the following methods to the plot object:
312
319
  ctx.restore();
313
320
  }
314
321
  });
322
+
323
+ plot.hooks.shutdown.push(function (plot, eventHolder) {
324
+ eventHolder.unbind("mousemove", onMouseMove);
325
+ eventHolder.unbind("mousedown", onMouseDown);
326
+
327
+ if (mouseUpHandler)
328
+ $(document).unbind("mouseup", mouseUpHandler);
329
+ });
330
+
315
331
  }
316
332
 
317
333
  $.plot.plugins.push({
@@ -323,6 +339,6 @@ The plugin allso adds the following methods to the plot object:
323
339
  }
324
340
  },
325
341
  name: 'selection',
326
- version: '1.0'
342
+ version: '1.1'
327
343
  });
328
344
  })(jQuery);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_range_limit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
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: 2011-12-16 00:00:00.000000000 Z
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2169256060 !ruby/object:Gem::Requirement
16
+ requirement: &180018940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2169256060
24
+ version_requirements: *180018940
25
+ - !ruby/object:Gem::Dependency
26
+ name: jquery-rails
27
+ requirement: &180018400 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *180018400
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: blacklight
27
- requirement: &2169255380 !ruby/object:Gem::Requirement
38
+ requirement: &180036880 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ~>
@@ -32,7 +43,62 @@ dependencies:
32
43
  version: '3.2'
33
44
  type: :runtime
34
45
  prerelease: false
35
- version_requirements: *2169255380
46
+ version_requirements: *180036880
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &180036060 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *180036060
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec-rails
60
+ requirement: &180035060 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *180035060
69
+ - !ruby/object:Gem::Dependency
70
+ name: capybara
71
+ requirement: &180034360 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *180034360
80
+ - !ruby/object:Gem::Dependency
81
+ name: sqlite3
82
+ requirement: &180033660 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *180033660
91
+ - !ruby/object:Gem::Dependency
92
+ name: launchy
93
+ requirement: &180032900 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *180032900
36
102
  description:
37
103
  email:
38
104
  - blacklight-development@googlegroups.com
@@ -41,6 +107,7 @@ extensions: []
41
107
  extra_rdoc_files: []
42
108
  files:
43
109
  - .gitignore
110
+ - Gemfile
44
111
  - MIT-LICENSE
45
112
  - README.rdoc
46
113
  - Rakefile
@@ -48,9 +115,6 @@ files:
48
115
  - app/assets/javascripts/blacklight_range_limit.js
49
116
  - app/assets/javascripts/blacklight_range_limit/range_limit_distro_facets.js
50
117
  - app/assets/javascripts/blacklight_range_limit/range_limit_slider.js
51
- - app/assets/javascripts/flot/excanvas.min.js
52
- - app/assets/javascripts/flot/jquery.flot.js
53
- - app/assets/javascripts/flot/jquery.flot.selection.js
54
118
  - app/assets/stylesheets/blacklight_range_limit.css.scss
55
119
  - app/assets/stylesheets/blacklight_range_limit/blacklight_range_limit.css
56
120
  - app/helpers/range_limit_helper.rb
@@ -68,6 +132,21 @@ files:
68
132
  - lib/blacklight_range_limit/view_helper_override.rb
69
133
  - lib/generators/blacklight_range_limit/assets_generator.rb
70
134
  - lib/generators/blacklight_range_limit/blacklight_range_limit_generator.rb
135
+ - spec/acceptance/blacklight_range_limit_spec.rb
136
+ - spec/integration/blacklight_stub_spec.rb
137
+ - spec/internal/app/controllers/application_controller.rb
138
+ - spec/internal/app/models/solr_document.rb
139
+ - spec/internal/config/database.yml
140
+ - spec/internal/config/routes.rb
141
+ - spec/internal/config/solr.yml
142
+ - spec/internal/db/combustion_test.sqlite
143
+ - spec/internal/db/schema.rb
144
+ - spec/internal/log/.gitignore
145
+ - spec/internal/public/favicon.ico
146
+ - spec/spec_helper.rb
147
+ - vendor/assets/javascripts/flot/excanvas.min.js
148
+ - vendor/assets/javascripts/flot/jquery.flot.js
149
+ - vendor/assets/javascripts/flot/jquery.flot.selection.js
71
150
  homepage: http://projectblacklight.org/
72
151
  licenses: []
73
152
  post_install_message:
@@ -88,8 +167,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
167
  version: '0'
89
168
  requirements: []
90
169
  rubyforge_project: blacklight
91
- rubygems_version: 1.8.10
170
+ rubygems_version: 1.8.15
92
171
  signing_key:
93
172
  specification_version: 3
94
173
  summary: Blacklight Range Limit plugin
95
- test_files: []
174
+ test_files:
175
+ - spec/acceptance/blacklight_range_limit_spec.rb
176
+ - spec/integration/blacklight_stub_spec.rb
177
+ - spec/internal/app/controllers/application_controller.rb
178
+ - spec/internal/app/models/solr_document.rb
179
+ - spec/internal/config/database.yml
180
+ - spec/internal/config/routes.rb
181
+ - spec/internal/config/solr.yml
182
+ - spec/internal/db/combustion_test.sqlite
183
+ - spec/internal/db/schema.rb
184
+ - spec/internal/log/.gitignore
185
+ - spec/internal/public/favicon.ico
186
+ - spec/spec_helper.rb