simple_update_field 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/simple_update_field.gemspec +2 -2
- data/vendor/assets/javascripts/simple_update_field.js +23 -15
- metadata +11 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
data/simple_update_field.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "simple_update_field"
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.2.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-
|
12
|
+
s.date = "2012-05-04"
|
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,3 +1,4 @@
|
|
1
|
+
//1
|
1
2
|
SimpleUpdateField = function(selector) {
|
2
3
|
var self = this
|
3
4
|
/*
|
@@ -40,6 +41,7 @@ SimpleUpdateField = function(selector) {
|
|
40
41
|
clicked_node.text("")
|
41
42
|
clicked_node.append(input_node)
|
42
43
|
install_edit_complete_notions(input_node)
|
44
|
+
uninstall_edit_notions(clicked_node)
|
43
45
|
input_node.focus();
|
44
46
|
}
|
45
47
|
var is_rollback_changes = function() {
|
@@ -66,20 +68,13 @@ SimpleUpdateField = function(selector) {
|
|
66
68
|
var next_position = parseInt(element.attr('editable-index')) +1
|
67
69
|
var next_editable = $(selector).filter('[editable-index='+next_position+']')
|
68
70
|
if (next_editable.size() == 0) {
|
69
|
-
next_editable = $(selector).filter('[editable-index=
|
71
|
+
next_editable = $(selector).filter('[editable-index=0]')
|
70
72
|
}
|
71
73
|
next_editable.trigger('click.editable')
|
72
74
|
}else {
|
73
75
|
throw 'Expected to find custom attribute editable-index'
|
74
76
|
}
|
75
77
|
}
|
76
|
-
var rollback_edit_event = function(event) {
|
77
|
-
var finished_input_node = $(this)
|
78
|
-
|
79
|
-
finished_input_node.parent().text(finished_input_node.data('original-text')) // the input we create had a memo about it's original text
|
80
|
-
finished_input_node.remove() // remove the input field that we created such that the node is unchanged
|
81
|
-
|
82
|
-
}
|
83
78
|
var commit_to_remote_resource = function(input_node) {
|
84
79
|
uri = input_node.attr('editable-resource-uri')
|
85
80
|
name = input_node.attr('editable-resource-model')
|
@@ -98,6 +93,18 @@ SimpleUpdateField = function(selector) {
|
|
98
93
|
}
|
99
94
|
}
|
100
95
|
|
96
|
+
var editable_restoration = function(element,text_value) {
|
97
|
+
element.text(text_value)
|
98
|
+
install_edit_notions(element)
|
99
|
+
}
|
100
|
+
|
101
|
+
var rollback_edit_event = function(event) {
|
102
|
+
var finished_input_node = $(this)
|
103
|
+
var parent = finished_input_node.parent();
|
104
|
+
|
105
|
+
editable_restoration(parent,finished_input_node.data('original-text')) // the input we create had a memo about it's original text
|
106
|
+
}
|
107
|
+
|
101
108
|
var complete_edit_event = function(event) {
|
102
109
|
|
103
110
|
var finished_input_node = $(this)
|
@@ -105,12 +112,7 @@ SimpleUpdateField = function(selector) {
|
|
105
112
|
|
106
113
|
commit_if_changed(finished_input_node)
|
107
114
|
|
108
|
-
|
109
|
-
parent.text(finished_input_node.val())
|
110
|
-
|
111
|
-
// remove the input field that we created
|
112
|
-
// such that the node is unchanged
|
113
|
-
finished_input_node.remove()
|
115
|
+
editable_restoration(parent,finished_input_node.val())
|
114
116
|
|
115
117
|
// If tab key was hit during the edit phase
|
116
118
|
// we want to redirect this blur to be a
|
@@ -136,6 +138,12 @@ SimpleUpdateField = function(selector) {
|
|
136
138
|
})
|
137
139
|
}
|
138
140
|
|
141
|
+
var uninstall_edit_notions = function(selector) {
|
142
|
+
$(selector).unbind('click.editable')
|
143
|
+
$(selector).unbind('mouseover.editable')
|
144
|
+
$(selector).unbind('mouseout.editable')
|
145
|
+
}
|
146
|
+
|
139
147
|
var install_edit_complete_notions = function (selector) {
|
140
148
|
|
141
149
|
$(selector).bind('keydown.editable',function(e) {
|
@@ -156,7 +164,7 @@ SimpleUpdateField = function(selector) {
|
|
156
164
|
}
|
157
165
|
var annotate_editable_with_position = function(selector) {
|
158
166
|
$(selector).each(function(i,el) {
|
159
|
-
$(el).attr('editable-index',i
|
167
|
+
$(el).attr('editable-index',i)
|
160
168
|
})
|
161
169
|
}
|
162
170
|
|
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.
|
4
|
+
version: 2.2.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-
|
12
|
+
date: 2012-05-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70198250446640 !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: *
|
24
|
+
version_requirements: *70198250446640
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &70198250445360 !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: *
|
35
|
+
version_requirements: *70198250445360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70198250443680 !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: *
|
46
|
+
version_requirements: *70198250443680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70198250442160 !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: *
|
57
|
+
version_requirements: *70198250442160
|
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:
|
95
|
+
hash: -1261042367084871670
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|