simple_update_field 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.creole CHANGED
@@ -23,12 +23,14 @@ based resource calls.
23
23
  === View Side
24
24
  * There are 3 custom attributes that will be used. An Example follows
25
25
  {{{
26
+ <div class='phrase'>
26
27
  <span editable-resource-attribute="text"
27
28
  editable-resource-model="<%=phrase.class.model_name.downcase%>"
28
29
  editable-resource-uri="<%=url_for(phrase)%>"
29
30
  class="text">
30
31
  <%= phrase.text %>
31
32
  </span>
33
+ </div>
32
34
  }}}
33
35
  ==== The 3 custom attributes are :
34
36
  ## editable-resource-attribute
@@ -44,7 +46,8 @@ based resource calls.
44
46
  {{{
45
47
  <span editable-resource-attribute="name"
46
48
  editable-resource-model="animal"
47
- editable-resource-uri="<%=url_for(animal)%>">
49
+ editable-resource-uri="<%=url_for(animal)%>"
50
+ class="animal-name">
48
51
  <%= animal.name %>
49
52
  </span>
50
53
  }}}
@@ -74,6 +77,29 @@ end
74
77
  * The combination of having a resource 'end-point', and telling the span what the end point is, and what the model, and attribute are will be enough to save changes to the database.
75
78
  * You can invoke the simple update field by clicking on the text you may wish to add CSS styling for hover to indicate to the user that this is an interactive part of the display
76
79
 
80
+ === Javascript Integration
81
+
82
+ There are 2 steps to integration with javascript.
83
+
84
+ * The first step is to modify application.js to include the name of the javascript file
85
+ {{{
86
+ //= require simple_update_field
87
+ }}}
88
+ * The second step is to invoke the the Simple Update Field on the appropriate elements
89
+ ** A CSS selector of the jQuery style is assumed.
90
+ ## For the above Phrase view code this could work :
91
+ {{{
92
+ $(document).ready(function() {
93
+ SimpleUpdateField('.phrase .text')
94
+ })
95
+ }}}
96
+ ## For the above Animals view code this could work :
97
+ {{{
98
+ $(document).ready(function() {
99
+ SimpleUpdateField('.animal-name')
100
+ })
101
+ }}}
102
+
77
103
 
78
104
  == Roadmap
79
105
 
@@ -82,7 +108,7 @@ end
82
108
 
83
109
  == Recent Changes
84
110
 
85
- * integrated rails test harness into gem
111
+ * Left out test harness https://github.com/blazingcloud/simple_update_field-jasmine-harness
86
112
 
87
113
  === Contributing to simple_update_field
88
114
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "simple_update_field"
8
- s.version = "1.1.0"
8
+ s.version = "1.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"]
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  "simple_update_field.gemspec",
30
30
  "spec/simple_update_field_spec.rb",
31
31
  "spec/spec_helper.rb",
32
- "vendor/assets/javascripts/editable_list.js"
32
+ "vendor/assets/javascripts/simple_update_field.js"
33
33
  ]
34
34
  s.homepage = "http://github.com/blazingcloud/simple_update_field"
35
35
  s.licenses = ["MIT"]
@@ -1,4 +1,4 @@
1
- Editable = function(selector) {
1
+ SimpleUpdateField = function(selector) {
2
2
  var self = this
3
3
  self.selector = selector
4
4
 
@@ -36,7 +36,7 @@ Editable = function(selector) {
36
36
  }
37
37
  var is_rollback_changes = function() {
38
38
  if (self.last_keydown_event) {
39
- if (self.last_keydown_event.keyCode == Editable.ESC_KEY) {
39
+ if (self.last_keydown_event.keyCode == SimpleUpdateField.ESC_KEY) {
40
40
  return true
41
41
  }
42
42
  }
@@ -44,10 +44,10 @@ Editable = function(selector) {
44
44
  }
45
45
  var is_blur_tab_redirect = function () {
46
46
  if (self.last_keydown_event) {
47
- if (self.last_keydown_event.keyCode == Editable.TAB_KEY) {
47
+ if (self.last_keydown_event.keyCode == SimpleUpdateField.TAB_KEY) {
48
48
  return true
49
49
  }
50
- if (self.last_keydown_event.keyCode == Editable.ENTER_KEY) {
50
+ if (self.last_keydown_event.keyCode == SimpleUpdateField.ENTER_KEY) {
51
51
  return true
52
52
  }
53
53
  }
@@ -163,6 +163,6 @@ Editable = function(selector) {
163
163
  }()
164
164
  return self;
165
165
  }
166
- Editable.TAB_KEY = 9 // tab is #9
167
- Editable.ENTER_KEY = 13 // enter is #13
168
- Editable.ESC_KEY = 27 // enter is #13
166
+ SimpleUpdateField.TAB_KEY = 9 // tab is #9
167
+ SimpleUpdateField.ENTER_KEY = 13 // enter is #13
168
+ 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: 1.1.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70352525074880 !ruby/object:Gem::Requirement
16
+ requirement: &70164641191780 !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: *70352525074880
24
+ version_requirements: *70164641191780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &70352525072500 !ruby/object:Gem::Requirement
27
+ requirement: &70164641188880 !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: *70352525072500
35
+ version_requirements: *70164641188880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70352525070640 !ruby/object:Gem::Requirement
38
+ requirement: &70164641186320 !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: *70352525070640
46
+ version_requirements: *70164641186320
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &70352525067840 !ruby/object:Gem::Requirement
49
+ requirement: &70164641165080 !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: *70352525067840
57
+ version_requirements: *70164641165080
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
@@ -76,7 +76,7 @@ files:
76
76
  - simple_update_field.gemspec
77
77
  - spec/simple_update_field_spec.rb
78
78
  - spec/spec_helper.rb
79
- - vendor/assets/javascripts/editable_list.js
79
+ - vendor/assets/javascripts/simple_update_field.js
80
80
  homepage: http://github.com/blazingcloud/simple_update_field
81
81
  licenses:
82
82
  - MIT
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  segments:
94
94
  - 0
95
- hash: -417061757656223822
95
+ hash: 2576101730221014213
96
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements: