edit_mode 0.0.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.
Files changed (94) hide show
  1. data/.gitignore +23 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +29 -0
  4. data/Guardfile +19 -0
  5. data/LICENSE +22 -0
  6. data/README.md +135 -0
  7. data/Rakefile +8 -0
  8. data/edit_mode.gemspec +31 -0
  9. data/lib/assets/javascripts/edit_mode/best_in_place.js.coffee +25 -0
  10. data/lib/assets/javascripts/edit_mode/best_in_place.js.coffee~ +26 -0
  11. data/lib/assets/javascripts/edit_mode/edit_mode_group.js.coffee +43 -0
  12. data/lib/assets/javascripts/edit_mode/initial_auto_hide.js.coffee +8 -0
  13. data/lib/assets/javascripts/edit_mode/make_modal.js.coffee +28 -0
  14. data/lib/assets/javascripts/edit_mode/show_only_in_edit_mode.js.coffee +22 -0
  15. data/lib/assets/javascripts/edit_mode/tool_buttons.js.coffee +21 -0
  16. data/lib/assets/javascripts/edit_mode.js +2 -0
  17. data/lib/assets/stylesheets/edit_mode/initial_auto_hide.css.sass +3 -0
  18. data/lib/assets/stylesheets/edit_mode/modal.css.sass +17 -0
  19. data/lib/assets/stylesheets/edit_mode.css +4 -0
  20. data/lib/assets/stylesheets/edit_mode.css~ +4 -0
  21. data/lib/edit_mode/engine.rb +7 -0
  22. data/lib/edit_mode/helper.rb +19 -0
  23. data/lib/edit_mode/railtie.rb +7 -0
  24. data/lib/edit_mode/version.rb +3 -0
  25. data/lib/edit_mode.rb +9 -0
  26. data/spec/helpers/edit_mode_helpers_spec.rb +26 -0
  27. data/spec/integration/buttons_spec.rb +69 -0
  28. data/spec/integration/show_only_in_edit_mode_spec.rb +24 -0
  29. data/spec/spec_helper.rb +22 -0
  30. data/test_app/.gitignore +15 -0
  31. data/test_app/Gemfile +56 -0
  32. data/test_app/README.md +135 -0
  33. data/test_app/Rakefile +7 -0
  34. data/test_app/app/assets/images/rails.png +0 -0
  35. data/test_app/app/assets/images/screenshot.png +0 -0
  36. data/test_app/app/assets/javascripts/activate_best_in_place.js +4 -0
  37. data/test_app/app/assets/javascripts/application.js +18 -0
  38. data/test_app/app/assets/stylesheets/#application.css# +14 -0
  39. data/test_app/app/assets/stylesheets/application.css +14 -0
  40. data/test_app/app/assets/stylesheets/modifications.css.sass +9 -0
  41. data/test_app/app/assets/stylesheets/nifty.css +79 -0
  42. data/test_app/app/controllers/application_controller.rb +3 -0
  43. data/test_app/app/controllers/root_controller.rb +11 -0
  44. data/test_app/app/controllers/users_controller.rb +44 -0
  45. data/test_app/app/helpers/application_helper.rb +2 -0
  46. data/test_app/app/helpers/error_messages_helper.rb +23 -0
  47. data/test_app/app/helpers/layout_helper.rb +22 -0
  48. data/test_app/app/helpers/users_helper.rb +2 -0
  49. data/test_app/app/mailers/.gitkeep +0 -0
  50. data/test_app/app/models/.gitkeep +0 -0
  51. data/test_app/app/models/user.rb +3 -0
  52. data/test_app/app/views/layouts/application.html.erb +19 -0
  53. data/test_app/app/views/users/_form.html.erb +16 -0
  54. data/test_app/app/views/users/edit.html.erb +8 -0
  55. data/test_app/app/views/users/index.html.erb +29 -0
  56. data/test_app/app/views/users/index.html.erb~ +21 -0
  57. data/test_app/app/views/users/new.html.erb +5 -0
  58. data/test_app/app/views/users/show.html.erb +54 -0
  59. data/test_app/app/views/users/show.html.erb~ +50 -0
  60. data/test_app/config/application.rb +59 -0
  61. data/test_app/config/boot.rb +6 -0
  62. data/test_app/config/database.yml +25 -0
  63. data/test_app/config/environment.rb +5 -0
  64. data/test_app/config/environments/development.rb +37 -0
  65. data/test_app/config/environments/production.rb +67 -0
  66. data/test_app/config/environments/test.rb +37 -0
  67. data/test_app/config/initializers/backtrace_silencers.rb +7 -0
  68. data/test_app/config/initializers/inflections.rb +15 -0
  69. data/test_app/config/initializers/mime_types.rb +5 -0
  70. data/test_app/config/initializers/secret_token.rb +7 -0
  71. data/test_app/config/initializers/session_store.rb +8 -0
  72. data/test_app/config/initializers/wrap_parameters.rb +14 -0
  73. data/test_app/config/locales/en.yml +5 -0
  74. data/test_app/config/routes.rb +62 -0
  75. data/test_app/config.ru +4 -0
  76. data/test_app/db/migrate/20120607231941_create_users.rb +14 -0
  77. data/test_app/db/schema.rb +24 -0
  78. data/test_app/db/seeds.rb +7 -0
  79. data/test_app/lib/assets/.gitkeep +0 -0
  80. data/test_app/lib/tasks/.gitkeep +0 -0
  81. data/test_app/public/404.html +26 -0
  82. data/test_app/public/422.html +26 -0
  83. data/test_app/public/500.html +25 -0
  84. data/test_app/public/favicon.ico +0 -0
  85. data/test_app/public/robots.txt +5 -0
  86. data/test_app/public/stylesheets/application.css +75 -0
  87. data/test_app/script/rails +6 -0
  88. data/test_app/test/fixtures/users.yml +9 -0
  89. data/test_app/test/functional/users_controller_test.rb +54 -0
  90. data/test_app/test/unit/user_test.rb +7 -0
  91. data/test_app/vendor/assets/javascripts/.gitkeep +0 -0
  92. data/test_app/vendor/assets/stylesheets/.gitkeep +0 -0
  93. data/test_app/vendor/plugins/.gitkeep +0 -0
  94. metadata +232 -0
@@ -0,0 +1,75 @@
1
+ body {
2
+ background-color: #4B7399;
3
+ font-family: Verdana, Helvetica, Arial;
4
+ font-size: 14px;
5
+ }
6
+
7
+ a img {
8
+ border: none;
9
+ }
10
+
11
+ a {
12
+ color: #0000FF;
13
+ }
14
+
15
+ .clear {
16
+ clear: both;
17
+ height: 0;
18
+ overflow: hidden;
19
+ }
20
+
21
+ #container {
22
+ width: 75%;
23
+ margin: 0 auto;
24
+ background-color: #FFF;
25
+ padding: 20px 40px;
26
+ border: solid 1px black;
27
+ margin-top: 20px;
28
+ }
29
+
30
+ #flash_notice, #flash_error, #flash_alert {
31
+ padding: 5px 8px;
32
+ margin: 10px 0;
33
+ }
34
+
35
+ #flash_notice {
36
+ background-color: #CFC;
37
+ border: solid 1px #6C6;
38
+ }
39
+
40
+ #flash_error, #flash_alert {
41
+ background-color: #FCC;
42
+ border: solid 1px #C66;
43
+ }
44
+
45
+ .fieldWithErrors {
46
+ display: inline;
47
+ }
48
+
49
+ .error_messages {
50
+ width: 400px;
51
+ border: 2px solid #CF0000;
52
+ padding: 0px;
53
+ padding-bottom: 12px;
54
+ margin-bottom: 20px;
55
+ background-color: #f0f0f0;
56
+ font-size: 12px;
57
+ }
58
+
59
+ .error_messages h2 {
60
+ text-align: left;
61
+ font-weight: bold;
62
+ padding: 5px 10px;
63
+ font-size: 12px;
64
+ margin: 0;
65
+ background-color: #c00;
66
+ color: #fff;
67
+ }
68
+
69
+ .error_messages p {
70
+ margin: 8px 10px;
71
+ }
72
+
73
+ .error_messages ul {
74
+ margin: 0;
75
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ one:
2
+ first_name: MyString
3
+ last_name: MyString
4
+ date_of_birth: 2012-06-08
5
+
6
+ two:
7
+ first_name: MyString
8
+ last_name: MyString
9
+ date_of_birth: 2012-06-08
@@ -0,0 +1,54 @@
1
+ require 'test_helper'
2
+
3
+ class UsersControllerTest < ActionController::TestCase
4
+ def test_index
5
+ get :index
6
+ assert_template 'index'
7
+ end
8
+
9
+ def test_show
10
+ get :show, :id => User.first
11
+ assert_template 'show'
12
+ end
13
+
14
+ def test_new
15
+ get :new
16
+ assert_template 'new'
17
+ end
18
+
19
+ def test_create_invalid
20
+ User.any_instance.stubs(:valid?).returns(false)
21
+ post :create
22
+ assert_template 'new'
23
+ end
24
+
25
+ def test_create_valid
26
+ User.any_instance.stubs(:valid?).returns(true)
27
+ post :create
28
+ assert_redirected_to user_url(assigns(:user))
29
+ end
30
+
31
+ def test_edit
32
+ get :edit, :id => User.first
33
+ assert_template 'edit'
34
+ end
35
+
36
+ def test_update_invalid
37
+ User.any_instance.stubs(:valid?).returns(false)
38
+ put :update, :id => User.first
39
+ assert_template 'edit'
40
+ end
41
+
42
+ def test_update_valid
43
+ User.any_instance.stubs(:valid?).returns(true)
44
+ put :update, :id => User.first
45
+ assert_redirected_to user_url(assigns(:user))
46
+ end
47
+
48
+ def test_destroy
49
+ user = User.first
50
+ delete :destroy, :id => user
51
+ assert_redirected_to users_url
52
+ assert !User.exists?(user.id)
53
+ end
54
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ def test_should_be_valid
5
+ assert User.new.valid?
6
+ end
7
+ end
File without changes
File without changes
File without changes
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: edit_mode
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sebastian Fiedlschuster
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - !ruby/object:Gem::Dependency
31
+ name: jquery-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec-rails
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 2.8.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.8.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: nokogiri
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.5.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: capybara
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: The edit mode is activated by pressing an 'edit' button on a show view.
95
+ This shows additional editing tools and switches on the best_in_place form fields.
96
+ When editing is finished, use 'save' or 'cancel' buttons to quit the edit mode and
97
+ return to a normal show view. Several editing groups per page are supported. Thus,
98
+ you can have several 'boxes' to edit on a page.
99
+ email:
100
+ - sebastian@fiedlschuster.de
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - .gitignore
106
+ - .rspec
107
+ - Gemfile
108
+ - Guardfile
109
+ - LICENSE
110
+ - README.md
111
+ - Rakefile
112
+ - edit_mode.gemspec
113
+ - lib/assets/javascripts/edit_mode.js
114
+ - lib/assets/javascripts/edit_mode/best_in_place.js.coffee
115
+ - lib/assets/javascripts/edit_mode/best_in_place.js.coffee~
116
+ - lib/assets/javascripts/edit_mode/edit_mode_group.js.coffee
117
+ - lib/assets/javascripts/edit_mode/initial_auto_hide.js.coffee
118
+ - lib/assets/javascripts/edit_mode/make_modal.js.coffee
119
+ - lib/assets/javascripts/edit_mode/show_only_in_edit_mode.js.coffee
120
+ - lib/assets/javascripts/edit_mode/tool_buttons.js.coffee
121
+ - lib/assets/stylesheets/edit_mode.css
122
+ - lib/assets/stylesheets/edit_mode.css~
123
+ - lib/assets/stylesheets/edit_mode/initial_auto_hide.css.sass
124
+ - lib/assets/stylesheets/edit_mode/modal.css.sass
125
+ - lib/edit_mode.rb
126
+ - lib/edit_mode/engine.rb
127
+ - lib/edit_mode/helper.rb
128
+ - lib/edit_mode/railtie.rb
129
+ - lib/edit_mode/version.rb
130
+ - spec/helpers/edit_mode_helpers_spec.rb
131
+ - spec/integration/buttons_spec.rb
132
+ - spec/integration/show_only_in_edit_mode_spec.rb
133
+ - spec/spec_helper.rb
134
+ - test_app/.gitignore
135
+ - test_app/Gemfile
136
+ - test_app/README.md
137
+ - test_app/Rakefile
138
+ - test_app/app/assets/images/rails.png
139
+ - test_app/app/assets/images/screenshot.png
140
+ - test_app/app/assets/javascripts/activate_best_in_place.js
141
+ - test_app/app/assets/javascripts/application.js
142
+ - test_app/app/assets/stylesheets/#application.css#
143
+ - test_app/app/assets/stylesheets/application.css
144
+ - test_app/app/assets/stylesheets/modifications.css.sass
145
+ - test_app/app/assets/stylesheets/nifty.css
146
+ - test_app/app/controllers/application_controller.rb
147
+ - test_app/app/controllers/root_controller.rb
148
+ - test_app/app/controllers/users_controller.rb
149
+ - test_app/app/helpers/application_helper.rb
150
+ - test_app/app/helpers/error_messages_helper.rb
151
+ - test_app/app/helpers/layout_helper.rb
152
+ - test_app/app/helpers/users_helper.rb
153
+ - test_app/app/mailers/.gitkeep
154
+ - test_app/app/models/.gitkeep
155
+ - test_app/app/models/user.rb
156
+ - test_app/app/views/layouts/application.html.erb
157
+ - test_app/app/views/users/_form.html.erb
158
+ - test_app/app/views/users/edit.html.erb
159
+ - test_app/app/views/users/index.html.erb
160
+ - test_app/app/views/users/index.html.erb~
161
+ - test_app/app/views/users/new.html.erb
162
+ - test_app/app/views/users/show.html.erb
163
+ - test_app/app/views/users/show.html.erb~
164
+ - test_app/config.ru
165
+ - test_app/config/application.rb
166
+ - test_app/config/boot.rb
167
+ - test_app/config/database.yml
168
+ - test_app/config/environment.rb
169
+ - test_app/config/environments/development.rb
170
+ - test_app/config/environments/production.rb
171
+ - test_app/config/environments/test.rb
172
+ - test_app/config/initializers/backtrace_silencers.rb
173
+ - test_app/config/initializers/inflections.rb
174
+ - test_app/config/initializers/mime_types.rb
175
+ - test_app/config/initializers/secret_token.rb
176
+ - test_app/config/initializers/session_store.rb
177
+ - test_app/config/initializers/wrap_parameters.rb
178
+ - test_app/config/locales/en.yml
179
+ - test_app/config/routes.rb
180
+ - test_app/db/migrate/20120607231941_create_users.rb
181
+ - test_app/db/schema.rb
182
+ - test_app/db/seeds.rb
183
+ - test_app/lib/assets/.gitkeep
184
+ - test_app/lib/tasks/.gitkeep
185
+ - test_app/public/404.html
186
+ - test_app/public/422.html
187
+ - test_app/public/500.html
188
+ - test_app/public/favicon.ico
189
+ - test_app/public/robots.txt
190
+ - test_app/public/stylesheets/application.css
191
+ - test_app/script/rails
192
+ - test_app/test/fixtures/users.yml
193
+ - test_app/test/functional/users_controller_test.rb
194
+ - test_app/test/unit/user_test.rb
195
+ - test_app/vendor/assets/javascripts/.gitkeep
196
+ - test_app/vendor/assets/stylesheets/.gitkeep
197
+ - test_app/vendor/plugins/.gitkeep
198
+ homepage: https://github.com/fiedl/edit_mode
199
+ licenses: []
200
+ post_install_message:
201
+ rdoc_options: []
202
+ require_paths:
203
+ - lib
204
+ required_ruby_version: !ruby/object:Gem::Requirement
205
+ none: false
206
+ requirements:
207
+ - - ! '>='
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ segments:
211
+ - 0
212
+ hash: -1073518765
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
214
+ none: false
215
+ requirements:
216
+ - - ! '>='
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ segments:
220
+ - 0
221
+ hash: -1073518765
222
+ requirements: []
223
+ rubyforge_project:
224
+ rubygems_version: 1.8.23
225
+ signing_key:
226
+ specification_version: 3
227
+ summary: Toggle an edit mode on a show view. Think of it as a grouped in-place editing.
228
+ test_files:
229
+ - spec/helpers/edit_mode_helpers_spec.rb
230
+ - spec/integration/buttons_spec.rb
231
+ - spec/integration/show_only_in_edit_mode_spec.rb
232
+ - spec/spec_helper.rb