simple_update_field 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/Gemfile +0 -19
  2. data/Gemfile.lock +0 -150
  3. data/README.creole +102 -0
  4. data/Rakefile +3 -9
  5. data/VERSION +1 -1
  6. data/lib/simple_update_field.rb +0 -8
  7. data/simple_update_field.gemspec +7 -81
  8. data/spec/{lib/simple_update_field_spec.rb → simple_update_field_spec.rb} +2 -1
  9. data/spec/spec_helper.rb +8 -28
  10. metadata +16 -162
  11. data/.rvmrc +0 -1
  12. data/README.rdoc +0 -25
  13. data/app/assets/images/rails.png +0 -0
  14. data/app/assets/javascripts/application.js +0 -14
  15. data/app/assets/stylesheets/application.css +0 -7
  16. data/app/controllers/application_controller.rb +0 -3
  17. data/app/controllers/phrases_controller.rb +0 -12
  18. data/app/helpers/application_helper.rb +0 -2
  19. data/app/mailers/.gitkeep +0 -0
  20. data/app/models/.gitkeep +0 -0
  21. data/app/models/phrase.rb +0 -4
  22. data/app/views/layouts/application.html.erb +0 -14
  23. data/app/views/phrases/_phrase.html.erb +0 -8
  24. data/app/views/phrases/index.html.erb +0 -1
  25. data/config.ru +0 -4
  26. data/config/application.rb +0 -54
  27. data/config/boot.rb +0 -6
  28. data/config/database.yml +0 -25
  29. data/config/environment.rb +0 -5
  30. data/config/environments/development.rb +0 -30
  31. data/config/environments/production.rb +0 -60
  32. data/config/environments/test.rb +0 -42
  33. data/config/initializers/backtrace_silencers.rb +0 -7
  34. data/config/initializers/inflections.rb +0 -10
  35. data/config/initializers/mime_types.rb +0 -5
  36. data/config/initializers/secret_token.rb +0 -7
  37. data/config/initializers/session_store.rb +0 -8
  38. data/config/initializers/wrap_parameters.rb +0 -14
  39. data/config/locales/en.yml +0 -5
  40. data/config/routes.rb +0 -4
  41. data/db/migrate/20120213182817_create_phrases.rb +0 -9
  42. data/db/schema.rb +0 -22
  43. data/db/seeds.rb +0 -7
  44. data/lib/assets/.gitkeep +0 -0
  45. data/lib/tasks/.gitkeep +0 -0
  46. data/lib/tasks/admin.rake +0 -9
  47. data/lib/tasks/jasmine.rake +0 -8
  48. data/script/rails +0 -6
  49. data/spec/controllers/phrases_controller_spec.rb +0 -22
  50. data/spec/javascripts/editable_list_spec.js +0 -411
  51. data/spec/javascripts/helpers/mock-ajax.js +0 -207
  52. data/spec/javascripts/spec.css +0 -3
  53. data/spec/javascripts/spec.js +0 -2
  54. data/spec/models/phrase_spec.rb +0 -11
  55. data/spec/routing/phrase_spec.rb +0 -12
  56. data/spec/routing/root_spec.rb +0 -7
  57. data/spec/views/_phrase.html.erb_spec.rb +0 -9
  58. data/spec/views/index.html.erb_spec.rb +0 -10
data/Gemfile CHANGED
@@ -1,27 +1,8 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- group :assets do
4
- gem 'sass-rails'
5
- gem 'coffee-rails'
6
- gem 'uglifier'
7
- end
8
-
9
3
  group :development do
10
4
  gem "rspec", "~> 2.8.0"
11
5
  gem "rdoc", "~> 3.12"
12
6
  gem "bundler", "~> 1.1.0"
13
7
  gem "jeweler", "~> 1.8.3"
14
-
15
- gem 'rails', '3.1.0'
16
-
17
- gem 'sqlite3'
18
- gem 'jquery-rails'
19
-
20
- gem 'rspec-rails'
21
- gem 'autotest'
22
- gem 'capybara'
23
- gem 'jasminerice'
24
- gem 'guard-jasmine'
25
-
26
- gem 'faker'
27
8
  end
data/Gemfile.lock CHANGED
@@ -1,119 +1,14 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- ZenTest (4.7.0)
5
- actionmailer (3.1.0)
6
- actionpack (= 3.1.0)
7
- mail (~> 2.3.0)
8
- actionpack (3.1.0)
9
- activemodel (= 3.1.0)
10
- activesupport (= 3.1.0)
11
- builder (~> 3.0.0)
12
- erubis (~> 2.7.0)
13
- i18n (~> 0.6)
14
- rack (~> 1.3.2)
15
- rack-cache (~> 1.0.3)
16
- rack-mount (~> 0.8.2)
17
- rack-test (~> 0.6.1)
18
- sprockets (~> 2.0.0)
19
- activemodel (3.1.0)
20
- activesupport (= 3.1.0)
21
- bcrypt-ruby (~> 3.0.0)
22
- builder (~> 3.0.0)
23
- i18n (~> 0.6)
24
- activerecord (3.1.0)
25
- activemodel (= 3.1.0)
26
- activesupport (= 3.1.0)
27
- arel (~> 2.2.1)
28
- tzinfo (~> 0.3.29)
29
- activeresource (3.1.0)
30
- activemodel (= 3.1.0)
31
- activesupport (= 3.1.0)
32
- activesupport (3.1.0)
33
- multi_json (~> 1.0)
34
- arel (2.2.3)
35
- autotest (4.4.6)
36
- ZenTest (>= 4.4.1)
37
- bcrypt-ruby (3.0.1)
38
- builder (3.0.0)
39
- capybara (1.1.2)
40
- mime-types (>= 1.16)
41
- nokogiri (>= 1.3.3)
42
- rack (>= 1.0.0)
43
- rack-test (>= 0.5.4)
44
- selenium-webdriver (~> 2.0)
45
- xpath (~> 0.1.4)
46
- childprocess (0.3.1)
47
- ffi (~> 1.0.6)
48
- coffee-rails (3.1.1)
49
- coffee-script (>= 2.2.0)
50
- railties (~> 3.1.0)
51
- coffee-script (2.2.0)
52
- coffee-script-source
53
- execjs
54
- coffee-script-source (1.2.0)
55
4
  diff-lcs (1.1.3)
56
- erubis (2.7.0)
57
- execjs (1.3.0)
58
- multi_json (~> 1.0)
59
- faker (1.0.1)
60
- i18n (~> 0.4)
61
- ffi (1.0.11)
62
5
  git (1.2.5)
63
- guard (1.0.1)
64
- ffi (>= 0.5.0)
65
- thor (~> 0.14.6)
66
- guard-jasmine (1.1.0)
67
- childprocess
68
- guard (>= 0.8.3)
69
- multi_json
70
- thor
71
- haml (3.1.4)
72
- hike (1.2.1)
73
- i18n (0.6.0)
74
- jasminerice (0.0.8)
75
- haml
76
6
  jeweler (1.8.3)
77
7
  bundler (~> 1.0)
78
8
  git (>= 1.2.5)
79
9
  rake
80
10
  rdoc
81
- jquery-rails (1.0.19)
82
- railties (~> 3.0)
83
- thor (~> 0.14)
84
11
  json (1.6.5)
85
- mail (2.3.3)
86
- i18n (>= 0.4.0)
87
- mime-types (~> 1.16)
88
- treetop (~> 1.4.8)
89
- mime-types (1.18)
90
- multi_json (1.2.0)
91
- nokogiri (1.5.2)
92
- polyglot (0.3.3)
93
- rack (1.3.6)
94
- rack-cache (1.0.3)
95
- rack (>= 0.4)
96
- rack-mount (0.8.3)
97
- rack (>= 1.0.0)
98
- rack-ssl (1.3.2)
99
- rack
100
- rack-test (0.6.1)
101
- rack (>= 1.0)
102
- rails (3.1.0)
103
- actionmailer (= 3.1.0)
104
- actionpack (= 3.1.0)
105
- activerecord (= 3.1.0)
106
- activeresource (= 3.1.0)
107
- activesupport (= 3.1.0)
108
- bundler (~> 1.0)
109
- railties (= 3.1.0)
110
- railties (3.1.0)
111
- actionpack (= 3.1.0)
112
- activesupport (= 3.1.0)
113
- rack-ssl (~> 1.3.2)
114
- rake (>= 0.8.7)
115
- rdoc (~> 3.4)
116
- thor (~> 0.14.6)
117
12
  rake (0.9.2.2)
118
13
  rdoc (3.12)
119
14
  json (~> 1.4)
@@ -125,57 +20,12 @@ GEM
125
20
  rspec-expectations (2.8.0)
126
21
  diff-lcs (~> 1.1.2)
127
22
  rspec-mocks (2.8.0)
128
- rspec-rails (2.8.1)
129
- actionpack (>= 3.0)
130
- activesupport (>= 3.0)
131
- railties (>= 3.0)
132
- rspec (~> 2.8.0)
133
- rubyzip (0.9.6.1)
134
- sass (3.1.15)
135
- sass-rails (3.1.6)
136
- actionpack (~> 3.1.0)
137
- railties (~> 3.1.0)
138
- sass (>= 3.1.10)
139
- tilt (~> 1.3.2)
140
- selenium-webdriver (2.20.0)
141
- childprocess (>= 0.2.5)
142
- ffi (~> 1.0)
143
- multi_json (~> 1.0)
144
- rubyzip
145
- sprockets (2.0.3)
146
- hike (~> 1.2)
147
- rack (~> 1.0)
148
- tilt (~> 1.1, != 1.3.0)
149
- sqlite3 (1.3.5)
150
- thor (0.14.6)
151
- tilt (1.3.3)
152
- treetop (1.4.10)
153
- polyglot
154
- polyglot (>= 0.3.1)
155
- tzinfo (0.3.32)
156
- uglifier (1.2.4)
157
- execjs (>= 0.3.0)
158
- multi_json (>= 1.0.2)
159
- xpath (0.1.4)
160
- nokogiri (~> 1.3)
161
23
 
162
24
  PLATFORMS
163
25
  ruby
164
26
 
165
27
  DEPENDENCIES
166
- autotest
167
28
  bundler (~> 1.1.0)
168
- capybara
169
- coffee-rails
170
- faker
171
- guard-jasmine
172
- jasminerice
173
29
  jeweler (~> 1.8.3)
174
- jquery-rails
175
- rails (= 3.1.0)
176
30
  rdoc (~> 3.12)
177
31
  rspec (~> 2.8.0)
178
- rspec-rails
179
- sass-rails
180
- sqlite3
181
- uglifier
data/README.creole ADDED
@@ -0,0 +1,102 @@
1
+ == simple_update_field
2
+
3
+ Rails text field helper for inplace-editing of text with keybindings
4
+ to move between each simple_update_field.
5
+
6
+ simple_update_field is implemented internally with jquery
7
+
8
+ == Installation Guide for Rails 3+
9
+
10
+ If you are using a version of rails before JQuery became the default - please integrate the gem 'jquery-rails'
11
+
12
+ In the installation guide you will see the following terms: phrase, PhrasesController, Phrase, text - my examples
13
+ assume that I am working with a Phrase resource with a :string field named 'text'. The PhrasesController handles rails rest
14
+ based resource calls.
15
+
16
+
17
+
18
+ * Edit your Gemfile to include the following
19
+ {{{
20
+ gem "simple_update_field"
21
+ }}}
22
+ * You will need to re-start a running server for the Gemfile change to take effect
23
+ === View Side
24
+ * There are 3 custom attributes that will be used. An Example follows
25
+ {{{
26
+ <span editable-resource-attribute="text"
27
+ editable-resource-model="<%=phrase.class.model_name.downcase%>"
28
+ editable-resource-uri="<%=url_for(phrase)%>"
29
+ class="text">
30
+ <%= phrase.text %>
31
+ </span>
32
+ }}}
33
+ ==== The 3 custom attributes are :
34
+ ## editable-resource-attribute
35
+ *** this is the name one of the model attributes that you want to change ie : 'name', 'text', 'phone_number'
36
+ *** this will be used with the editable-resource-model to name the parameter
37
+ ## editable-resource-model
38
+ *** this is a lowercase name of the model class that you are planning on changing
39
+ *** this will be sent to the server as part of the post-variable ie: model_name_here[attribute_name_here]=VALUE
40
+ ## editable-resource-uri
41
+ *** this is the destination to send the post-variable that is described by the above.
42
+ ==== Example of all 3 attributes
43
+ * With resources 'Animals' (Model : Animal & Controller : AnimalsController) with the attribute 'name' and an instance of Animal 'animal'
44
+ {{{
45
+ <span editable-resource-attribute="name"
46
+ editable-resource-model="animal"
47
+ editable-resource-uri="<%=url_for(animal)%>">
48
+ <%= animal.name %>
49
+ </span>
50
+ }}}
51
+ === Resource Side
52
+ * You will need a controller with an update action written in the typical rails resource-style
53
+ ## The typical rails resource style tends towards having a the resource payload named by the model and as part of the general request params
54
+ {{{
55
+ class PhrasesController < ApplicationController
56
+ def update
57
+ Phrase.
58
+ find(params[:id]).
59
+ update_attributes(params[:phrase])
60
+ head :ok # assume success
61
+ end
62
+ end
63
+ }}}
64
+ * With an update action in your controller - you will also need a route for it
65
+ ## edit your config/routes.rb file to specify that there is an update action
66
+ *** in the example there are only two actions :
67
+ {{{
68
+ resources :phrases, :only => [:index,:update]
69
+ }}}
70
+ *** or simply use the default actions :
71
+ {{{
72
+ resources :phrases
73
+ }}}
74
+ * 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
+ * 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
+
77
+
78
+ == Roadmap
79
+
80
+ * form field helper
81
+ * error handling of ajax call
82
+
83
+ == Recent Changes
84
+
85
+ * integrated rails test harness into gem
86
+
87
+ === Contributing to simple_update_field
88
+
89
+ # Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
90
+ # Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
91
+ # Fork the project.
92
+ # Start a feature/bugfix branch.
93
+ # Commit and push until you are happy with your contribution.
94
+ # Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
95
+ # Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
96
+
97
+ === Copyright
98
+ Authored by Curtis Schofield
99
+
100
+ Copyright (c) 2012 Blazing Cloud. See LICENSE.txt for
101
+ further details.
102
+
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler'
5
+
5
6
  begin
6
7
  Bundler.setup(:default, :development)
7
8
  rescue Bundler::BundlerError => e
@@ -11,17 +12,13 @@ rescue Bundler::BundlerError => e
11
12
  end
12
13
  require 'rake'
13
14
 
14
- # RAILS
15
- require File.expand_path('../config/application', __FILE__)
16
- EditableList::Application.load_tasks
17
-
18
15
  require 'jeweler'
19
16
  Jeweler::Tasks.new do |gem|
20
17
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
21
18
  gem.name = "simple_update_field"
22
- gem.homepage = "http://github.com/robotarmy/simple_update_field"
19
+ gem.homepage = "http://github.com/blazingcloud/simple_update_field"
23
20
  gem.license = "MIT"
24
- gem.summary = %Q{turn a resource attribute into an inplace editable field}
21
+ gem.summary = %Q{turn a rails resource's attribute into an inplace editable field}
25
22
  gem.description = %Q{Your resources text attributes will gain inplace update ability with keybindings for quick editing}
26
23
  gem.email = "curtis@ram9.cc"
27
24
  gem.authors = ["Curtis Schofield"]
@@ -39,7 +36,6 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
39
36
  spec.pattern = 'spec/**/*_spec.rb'
40
37
  spec.rcov = true
41
38
  end
42
-
43
39
  task :default => :spec
44
40
 
45
41
  require 'rdoc/task'
@@ -51,5 +47,3 @@ Rake::RDocTask.new do |rdoc|
51
47
  rdoc.rdoc_files.include('README*')
52
48
  rdoc.rdoc_files.include('lib/**/*.rb')
53
49
  end
54
-
55
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -1,11 +1,3 @@
1
- begin
2
- Object.const_get('Rails')
3
- rescue
4
- module Rails
5
- class Engine
6
- end
7
- end
8
- end
9
1
  module SimpleUpdateField
10
2
  class Engine < ::Rails::Engine
11
3
  # let rails know to include the javascript
@@ -5,84 +5,37 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "simple_update_field"
8
- s.version = "1.0.0"
8
+ s.version = "1.1.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-03-29"
12
+ s.date = "2012-04-25"
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 = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.creole"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
- ".rvmrc",
23
22
  "Gemfile",
24
23
  "Gemfile.lock",
25
24
  "LICENSE.txt",
26
- "README.rdoc",
25
+ "README.creole",
27
26
  "Rakefile",
28
27
  "VERSION",
29
- "app/assets/images/rails.png",
30
- "app/assets/javascripts/application.js",
31
- "app/assets/stylesheets/application.css",
32
- "app/controllers/application_controller.rb",
33
- "app/controllers/phrases_controller.rb",
34
- "app/helpers/application_helper.rb",
35
- "app/mailers/.gitkeep",
36
- "app/models/.gitkeep",
37
- "app/models/phrase.rb",
38
- "app/views/layouts/application.html.erb",
39
- "app/views/phrases/_phrase.html.erb",
40
- "app/views/phrases/index.html.erb",
41
- "config.ru",
42
- "config/application.rb",
43
- "config/boot.rb",
44
- "config/database.yml",
45
- "config/environment.rb",
46
- "config/environments/development.rb",
47
- "config/environments/production.rb",
48
- "config/environments/test.rb",
49
- "config/initializers/backtrace_silencers.rb",
50
- "config/initializers/inflections.rb",
51
- "config/initializers/mime_types.rb",
52
- "config/initializers/secret_token.rb",
53
- "config/initializers/session_store.rb",
54
- "config/initializers/wrap_parameters.rb",
55
- "config/locales/en.yml",
56
- "config/routes.rb",
57
- "db/migrate/20120213182817_create_phrases.rb",
58
- "db/schema.rb",
59
- "db/seeds.rb",
60
- "lib/assets/.gitkeep",
61
28
  "lib/simple_update_field.rb",
62
- "lib/tasks/.gitkeep",
63
- "lib/tasks/admin.rake",
64
- "lib/tasks/jasmine.rake",
65
- "script/rails",
66
29
  "simple_update_field.gemspec",
67
- "spec/controllers/phrases_controller_spec.rb",
68
- "spec/javascripts/editable_list_spec.js",
69
- "spec/javascripts/helpers/mock-ajax.js",
70
- "spec/javascripts/spec.css",
71
- "spec/javascripts/spec.js",
72
- "spec/lib/simple_update_field_spec.rb",
73
- "spec/models/phrase_spec.rb",
74
- "spec/routing/phrase_spec.rb",
75
- "spec/routing/root_spec.rb",
30
+ "spec/simple_update_field_spec.rb",
76
31
  "spec/spec_helper.rb",
77
- "spec/views/_phrase.html.erb_spec.rb",
78
- "spec/views/index.html.erb_spec.rb",
79
32
  "vendor/assets/javascripts/editable_list.js"
80
33
  ]
81
- s.homepage = "http://github.com/robotarmy/simple_update_field"
34
+ s.homepage = "http://github.com/blazingcloud/simple_update_field"
82
35
  s.licenses = ["MIT"]
83
36
  s.require_paths = ["lib"]
84
37
  s.rubygems_version = "1.8.10"
85
- s.summary = "turn a resource attribute into an inplace editable field"
38
+ s.summary = "turn a rails resource's attribute into an inplace editable field"
86
39
 
87
40
  if s.respond_to? :specification_version then
88
41
  s.specification_version = 3
@@ -92,44 +45,17 @@ Gem::Specification.new do |s|
92
45
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
93
46
  s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
94
47
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
95
- s.add_development_dependency(%q<rails>, ["= 3.1.0"])
96
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
97
- s.add_development_dependency(%q<jquery-rails>, [">= 0"])
98
- s.add_development_dependency(%q<rspec-rails>, [">= 0"])
99
- s.add_development_dependency(%q<autotest>, [">= 0"])
100
- s.add_development_dependency(%q<capybara>, [">= 0"])
101
- s.add_development_dependency(%q<jasminerice>, [">= 0"])
102
- s.add_development_dependency(%q<guard-jasmine>, [">= 0"])
103
- s.add_development_dependency(%q<faker>, [">= 0"])
104
48
  else
105
49
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
106
50
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
107
51
  s.add_dependency(%q<bundler>, ["~> 1.1.0"])
108
52
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
109
- s.add_dependency(%q<rails>, ["= 3.1.0"])
110
- s.add_dependency(%q<sqlite3>, [">= 0"])
111
- s.add_dependency(%q<jquery-rails>, [">= 0"])
112
- s.add_dependency(%q<rspec-rails>, [">= 0"])
113
- s.add_dependency(%q<autotest>, [">= 0"])
114
- s.add_dependency(%q<capybara>, [">= 0"])
115
- s.add_dependency(%q<jasminerice>, [">= 0"])
116
- s.add_dependency(%q<guard-jasmine>, [">= 0"])
117
- s.add_dependency(%q<faker>, [">= 0"])
118
53
  end
119
54
  else
120
55
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
121
56
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
122
57
  s.add_dependency(%q<bundler>, ["~> 1.1.0"])
123
58
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
124
- s.add_dependency(%q<rails>, ["= 3.1.0"])
125
- s.add_dependency(%q<sqlite3>, [">= 0"])
126
- s.add_dependency(%q<jquery-rails>, [">= 0"])
127
- s.add_dependency(%q<rspec-rails>, [">= 0"])
128
- s.add_dependency(%q<autotest>, [">= 0"])
129
- s.add_dependency(%q<capybara>, [">= 0"])
130
- s.add_dependency(%q<jasminerice>, [">= 0"])
131
- s.add_dependency(%q<guard-jasmine>, [">= 0"])
132
- s.add_dependency(%q<faker>, [">= 0"])
133
59
  end
134
60
  end
135
61