simple_update_field 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -169,6 +169,7 @@ $(document).ready(function() {
169
169
  * error handling of ajax call
170
170
 
171
171
  == Recent Changes
172
+ * Only one active simple update field at a time, even across select groups
172
173
  * before_update callback - return true to continue , false to stop
173
174
  * Only commit changed fields to the remote-resource-uri
174
175
  * Trim leading and trailng whitespace of entered data or original text data
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.4.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "simple_update_field"
8
- s.version = "2.3.0"
8
+ s.version = "2.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Curtis Schofield"]
12
- s.date = "2012-05-09"
12
+ s.date = "2012-05-14"
13
13
  s.description = "Your resources text attributes will gain inplace update ability with keybindings for quick editing"
14
14
  s.email = "curtis@ram9.cc"
15
15
  s.extra_rdoc_files = [
@@ -1,5 +1,9 @@
1
1
  //1
2
2
  SimpleUpdateField = function(selector, options) {
3
+ SimpleUpdateField.current_active = ( SimpleUpdateField.current_active || null )
4
+ SimpleUpdateField.TAB_KEY = 9 // tab is #9
5
+ SimpleUpdateField.ENTER_KEY = 13 // enter is #13
6
+ SimpleUpdateField.ESC_KEY = 27 // enter is #13
3
7
  var self = this
4
8
  /*
5
9
  * This is used internally to track what key has been
@@ -36,8 +40,17 @@ SimpleUpdateField = function(selector, options) {
36
40
  }
37
41
 
38
42
  var begin_edit_event = function(event) {
39
- var clicked_node = $(this);
40
- var input_node = create_input_from(clicked_node);
43
+ var clicked_node = $(this)
44
+
45
+ if(SimpleUpdateField.current_active) {
46
+ SimpleUpdateField.current_active.removeClass('suf-editable-active')
47
+ SimpleUpdateField.current_active.children('input').trigger('complete.editable')
48
+ }
49
+
50
+ SimpleUpdateField.current_active = clicked_node
51
+
52
+ var input_node = create_input_from(clicked_node)
53
+ clicked_node.addClass('suf-editable-active')
41
54
  clicked_node.text("")
42
55
  clicked_node.append(input_node)
43
56
  install_edit_complete_notions(input_node)
@@ -144,7 +157,6 @@ SimpleUpdateField = function(selector, options) {
144
157
  }
145
158
 
146
159
  var install_edit_notions = function(selector) {
147
-
148
160
  $(selector).bind('click.editable',begin_edit_event)
149
161
  $(selector).bind('mouseover.editable',function() {
150
162
  $(this).addClass('editable-hover')
@@ -203,6 +215,7 @@ SimpleUpdateField = function(selector, options) {
203
215
  }
204
216
 
205
217
  var install = function() {
218
+ $(selector).addClass('suf-editable')
206
219
  install_edit_notions(selector)
207
220
  annotate_editable_with_position(selector)
208
221
  annotate_with_resource_errors(selector)
@@ -210,6 +223,3 @@ SimpleUpdateField = function(selector, options) {
210
223
  }()
211
224
  return self;
212
225
  }
213
- SimpleUpdateField.TAB_KEY = 9 // tab is #9
214
- SimpleUpdateField.ENTER_KEY = 13 // enter is #13
215
- SimpleUpdateField.ESC_KEY = 27 // enter is #13
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_update_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
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-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70104163814740 !ruby/object:Gem::Requirement
16
+ requirement: &70154241846720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70104163814740
24
+ version_requirements: *70154241846720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &70104163813460 !ruby/object:Gem::Requirement
27
+ requirement: &70154241846040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70104163813460
35
+ version_requirements: *70154241846040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70104163812080 !ruby/object:Gem::Requirement
38
+ requirement: &70154241845400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.1.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70104163812080
46
+ version_requirements: *70154241845400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &70104163810880 !ruby/object:Gem::Requirement
49
+ requirement: &70154241844720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.8.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70104163810880
57
+ version_requirements: *70154241844720
58
58
  description: Your resources text attributes will gain inplace update ability with
59
59
  keybindings for quick editing
60
60
  email: curtis@ram9.cc
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  segments:
94
94
  - 0
95
- hash: 4112278823148699834
95
+ hash: 1882842675022545685
96
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements: