jump_back 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +15 -0
  4. data/lib/jump_back.rb +6 -0
  5. data/lib/jump_back/engine.rb +12 -0
  6. data/lib/jump_back/redirect_back.rb +41 -0
  7. data/lib/jump_back/return_to_referer.rb +13 -0
  8. data/lib/jump_back/version.rb +3 -0
  9. data/lib/tasks/jump_back_tasks.rake +4 -0
  10. data/spec/controller/application_controller_spec.rb +18 -0
  11. data/spec/controller/tests_controller_spec.rb +122 -0
  12. data/spec/dummy/README.rdoc +28 -0
  13. data/spec/dummy/Rakefile +6 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  17. data/spec/dummy/app/controllers/tests_controller.rb +38 -0
  18. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  19. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  20. data/spec/dummy/app/views/tests/edit.html.erb +3 -0
  21. data/spec/dummy/app/views/tests/index.html.erb +6 -0
  22. data/spec/dummy/app/views/tests/new.html.erb +6 -0
  23. data/spec/dummy/bin/bundle +3 -0
  24. data/spec/dummy/bin/rails +4 -0
  25. data/spec/dummy/bin/rake +4 -0
  26. data/spec/dummy/config.ru +4 -0
  27. data/spec/dummy/config/application.rb +29 -0
  28. data/spec/dummy/config/boot.rb +5 -0
  29. data/spec/dummy/config/database.yml +25 -0
  30. data/spec/dummy/config/environment.rb +5 -0
  31. data/spec/dummy/config/environments/development.rb +37 -0
  32. data/spec/dummy/config/environments/production.rb +78 -0
  33. data/spec/dummy/config/environments/test.rb +39 -0
  34. data/spec/dummy/config/initializers/assets.rb +8 -0
  35. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  37. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  38. data/spec/dummy/config/initializers/inflections.rb +16 -0
  39. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  40. data/spec/dummy/config/initializers/session_store.rb +3 -0
  41. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  42. data/spec/dummy/config/locales/en.yml +23 -0
  43. data/spec/dummy/config/routes.rb +61 -0
  44. data/spec/dummy/config/secrets.yml +22 -0
  45. data/spec/dummy/db/development.sqlite3 +0 -0
  46. data/spec/dummy/db/schema.rb +16 -0
  47. data/spec/dummy/db/test.sqlite3 +0 -0
  48. data/spec/dummy/log/development.log +9 -0
  49. data/spec/dummy/log/test.log +7229 -0
  50. data/spec/dummy/public/404.html +67 -0
  51. data/spec/dummy/public/422.html +67 -0
  52. data/spec/dummy/public/500.html +66 -0
  53. data/spec/dummy/public/favicon.ico +0 -0
  54. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  55. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  56. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  57. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  58. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  59. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  60. data/spec/features/jump_back_feature_spec.rb +38 -0
  61. data/spec/spec_helper.rb +13 -0
  62. metadata +214 -0
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,38 @@
1
+ feature 'jump_back features' do
2
+ describe 'redirect_back' do
3
+ it 'should redirect back' do
4
+ visit new_test_path
5
+ click_button 'New test'
6
+ expect(page).to have_content('New Page')
7
+ end
8
+ end
9
+
10
+ describe 'return_to_referer' do
11
+ it 'should return to saved referer' do
12
+ visit edit_test_path(1)
13
+ click_link 'Go to new page'
14
+ visit tests_path
15
+ click_button 'Update test'
16
+ expect(page).to have_content('Edit Page')
17
+ end
18
+
19
+ it 'should not reset referer if not cleared' do
20
+ visit edit_test_path(1)
21
+ click_link 'Go to new page'
22
+ visit tests_path
23
+ click_link 'Go to new page'
24
+ visit tests_path
25
+ click_button 'Update test'
26
+ expect(page).to have_content('Edit Page')
27
+ end
28
+
29
+ it 'should reset referer if cleared' do
30
+ visit edit_test_path(1)
31
+ click_link 'Go to new page'
32
+ click_link 'Go to edit page'
33
+ visit tests_path
34
+ click_button 'Update test'
35
+ expect(page).to have_content('New Page')
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,13 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
3
+ require 'rspec/rails'
4
+
5
+ Rails.backtrace_cleaner.remove_silencers!
6
+ # Load support files
7
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
8
+ RSpec.configure do |config|
9
+ config.mock_with :rspec
10
+ config.use_transactional_fixtures = true
11
+ config.infer_base_class_for_anonymous_controllers = false
12
+ config.order = "random"
13
+ end
metadata ADDED
@@ -0,0 +1,214 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jump_back
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Peter Debelak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: capybara
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: jump_back helps you redirect to back with a default and simplifies saving
70
+ a referring page for future redirects. See website https://github.com/pdebelak/jump_back
71
+ for details.
72
+ email:
73
+ - pdebelak@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - MIT-LICENSE
79
+ - Rakefile
80
+ - lib/jump_back.rb
81
+ - lib/jump_back/engine.rb
82
+ - lib/jump_back/redirect_back.rb
83
+ - lib/jump_back/return_to_referer.rb
84
+ - lib/jump_back/version.rb
85
+ - lib/tasks/jump_back_tasks.rake
86
+ - spec/controller/application_controller_spec.rb
87
+ - spec/controller/tests_controller_spec.rb
88
+ - spec/dummy/README.rdoc
89
+ - spec/dummy/Rakefile
90
+ - spec/dummy/app/assets/javascripts/application.js
91
+ - spec/dummy/app/assets/stylesheets/application.css
92
+ - spec/dummy/app/controllers/application_controller.rb
93
+ - spec/dummy/app/controllers/tests_controller.rb
94
+ - spec/dummy/app/helpers/application_helper.rb
95
+ - spec/dummy/app/views/layouts/application.html.erb
96
+ - spec/dummy/app/views/tests/edit.html.erb
97
+ - spec/dummy/app/views/tests/index.html.erb
98
+ - spec/dummy/app/views/tests/new.html.erb
99
+ - spec/dummy/bin/bundle
100
+ - spec/dummy/bin/rails
101
+ - spec/dummy/bin/rake
102
+ - spec/dummy/config.ru
103
+ - spec/dummy/config/application.rb
104
+ - spec/dummy/config/boot.rb
105
+ - spec/dummy/config/database.yml
106
+ - spec/dummy/config/environment.rb
107
+ - spec/dummy/config/environments/development.rb
108
+ - spec/dummy/config/environments/production.rb
109
+ - spec/dummy/config/environments/test.rb
110
+ - spec/dummy/config/initializers/assets.rb
111
+ - spec/dummy/config/initializers/backtrace_silencers.rb
112
+ - spec/dummy/config/initializers/cookies_serializer.rb
113
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
114
+ - spec/dummy/config/initializers/inflections.rb
115
+ - spec/dummy/config/initializers/mime_types.rb
116
+ - spec/dummy/config/initializers/session_store.rb
117
+ - spec/dummy/config/initializers/wrap_parameters.rb
118
+ - spec/dummy/config/locales/en.yml
119
+ - spec/dummy/config/routes.rb
120
+ - spec/dummy/config/secrets.yml
121
+ - spec/dummy/db/development.sqlite3
122
+ - spec/dummy/db/schema.rb
123
+ - spec/dummy/db/test.sqlite3
124
+ - spec/dummy/log/development.log
125
+ - spec/dummy/log/test.log
126
+ - spec/dummy/public/404.html
127
+ - spec/dummy/public/422.html
128
+ - spec/dummy/public/500.html
129
+ - spec/dummy/public/favicon.ico
130
+ - spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
131
+ - spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
132
+ - spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
133
+ - spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
134
+ - spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
135
+ - spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
136
+ - spec/features/jump_back_feature_spec.rb
137
+ - spec/spec_helper.rb
138
+ homepage: https://github.com/pdebelak/jump_back
139
+ licenses:
140
+ - MIT
141
+ metadata: {}
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 2.4.4
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: jump_back simplifies redirecting back in rails
162
+ test_files:
163
+ - spec/controller/application_controller_spec.rb
164
+ - spec/controller/tests_controller_spec.rb
165
+ - spec/dummy/app/assets/javascripts/application.js
166
+ - spec/dummy/app/assets/stylesheets/application.css
167
+ - spec/dummy/app/controllers/application_controller.rb
168
+ - spec/dummy/app/controllers/tests_controller.rb
169
+ - spec/dummy/app/helpers/application_helper.rb
170
+ - spec/dummy/app/views/layouts/application.html.erb
171
+ - spec/dummy/app/views/tests/edit.html.erb
172
+ - spec/dummy/app/views/tests/index.html.erb
173
+ - spec/dummy/app/views/tests/new.html.erb
174
+ - spec/dummy/bin/bundle
175
+ - spec/dummy/bin/rails
176
+ - spec/dummy/bin/rake
177
+ - spec/dummy/config/application.rb
178
+ - spec/dummy/config/boot.rb
179
+ - spec/dummy/config/database.yml
180
+ - spec/dummy/config/environment.rb
181
+ - spec/dummy/config/environments/development.rb
182
+ - spec/dummy/config/environments/production.rb
183
+ - spec/dummy/config/environments/test.rb
184
+ - spec/dummy/config/initializers/assets.rb
185
+ - spec/dummy/config/initializers/backtrace_silencers.rb
186
+ - spec/dummy/config/initializers/cookies_serializer.rb
187
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
188
+ - spec/dummy/config/initializers/inflections.rb
189
+ - spec/dummy/config/initializers/mime_types.rb
190
+ - spec/dummy/config/initializers/session_store.rb
191
+ - spec/dummy/config/initializers/wrap_parameters.rb
192
+ - spec/dummy/config/locales/en.yml
193
+ - spec/dummy/config/routes.rb
194
+ - spec/dummy/config/secrets.yml
195
+ - spec/dummy/config.ru
196
+ - spec/dummy/db/development.sqlite3
197
+ - spec/dummy/db/schema.rb
198
+ - spec/dummy/db/test.sqlite3
199
+ - spec/dummy/log/development.log
200
+ - spec/dummy/log/test.log
201
+ - spec/dummy/public/404.html
202
+ - spec/dummy/public/422.html
203
+ - spec/dummy/public/500.html
204
+ - spec/dummy/public/favicon.ico
205
+ - spec/dummy/Rakefile
206
+ - spec/dummy/README.rdoc
207
+ - spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
208
+ - spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
209
+ - spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
210
+ - spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
211
+ - spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
212
+ - spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
213
+ - spec/features/jump_back_feature_spec.rb
214
+ - spec/spec_helper.rb