nifty_errorpages 0.0.2
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.
- data/.gitignore +8 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +149 -0
- data/MIT-LICENSE +20 -0
- data/README.md +55 -0
- data/Rakefile +40 -0
- data/app/assets/images/nifty_errorpages/.gitkeep +0 -0
- data/app/assets/javascripts/nifty_errorpages/application.js +15 -0
- data/app/assets/stylesheets/nifty_errorpages/application.css +13 -0
- data/app/assets/stylesheets/nifty_errorpages/errors.css +19 -0
- data/app/controllers/nifty_errorpages/application_controller.rb +4 -0
- data/app/controllers/nifty_errorpages/errors_controller.rb +28 -0
- data/app/helpers/nifty_errorpages/application_helper.rb +9 -0
- data/app/views/layouts/nifty_errorpages/application.html.erb +14 -0
- data/app/views/nifty_errorpages/errors/404.html.erb +4 -0
- data/app/views/nifty_errorpages/errors/422.html.erb +4 -0
- data/app/views/nifty_errorpages/errors/500.html.erb +4 -0
- data/config/initializers/nifty_errorpages.rb +3 -0
- data/config/routes.rb +3 -0
- data/lib/generators/nifty_errorpages/all/all_generator.rb +20 -0
- data/lib/generators/nifty_errorpages/controllers/controllers_generator.rb +18 -0
- data/lib/generators/nifty_errorpages/helpers/helpers_generator.rb +18 -0
- data/lib/generators/nifty_errorpages/views/views_generator.rb +18 -0
- data/lib/nifty_errorpages.rb +4 -0
- data/lib/nifty_errorpages/engine.rb +5 -0
- data/lib/nifty_errorpages/version.rb +3 -0
- data/lib/tasks/nifty_errorpages_tasks.rake +4 -0
- data/nifty_errorpages.gemspec +29 -0
- data/script/rails +8 -0
- data/spec/dummy/.rspec +1 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/articles.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/articles.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/articles_controller.rb +92 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/articles_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/article.rb +3 -0
- data/spec/dummy/app/views/articles/_form.html.erb +25 -0
- data/spec/dummy/app/views/articles/edit.html.erb +6 -0
- data/spec/dummy/app/views/articles/index.html.erb +25 -0
- data/spec/dummy/app/views/articles/new.html.erb +5 -0
- data/spec/dummy/app/views/articles/show.html.erb +15 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +59 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/db/migrate/20130423132043_create_articles.rb +10 -0
- data/spec/dummy/db/schema.rb +23 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/assets/application-155203b7144128c2047da6377a6f613e.js +17 -0
- data/spec/dummy/public/assets/application-155203b7144128c2047da6377a6f613e.js.gz +0 -0
- data/spec/dummy/public/assets/application-b66ec4c26d457434039ef65a91d7f1aa.css +75 -0
- data/spec/dummy/public/assets/application-b66ec4c26d457434039ef65a91d7f1aa.css.gz +0 -0
- data/spec/dummy/public/assets/application.css +75 -0
- data/spec/dummy/public/assets/application.css.gz +0 -0
- data/spec/dummy/public/assets/application.js +17 -0
- data/spec/dummy/public/assets/application.js.gz +0 -0
- data/spec/dummy/public/assets/jquery.min-6c267bfd2b3f36e6edccb2e584934c1c.map +1 -0
- data/spec/dummy/public/assets/jquery.min.map +1 -0
- data/spec/dummy/public/assets/manifest.yml +11 -0
- data/spec/dummy/public/assets/nifty_errorpages/application-14e4ba6da2d49c7355074115cdc97ada.css +34 -0
- data/spec/dummy/public/assets/nifty_errorpages/application-14e4ba6da2d49c7355074115cdc97ada.css.gz +0 -0
- data/spec/dummy/public/assets/nifty_errorpages/application-155203b7144128c2047da6377a6f613e.js +17 -0
- data/spec/dummy/public/assets/nifty_errorpages/application-155203b7144128c2047da6377a6f613e.js.gz +0 -0
- data/spec/dummy/public/assets/nifty_errorpages/application.css +34 -0
- data/spec/dummy/public/assets/nifty_errorpages/application.css.gz +0 -0
- data/spec/dummy/public/assets/nifty_errorpages/application.js +17 -0
- data/spec/dummy/public/assets/nifty_errorpages/application.js.gz +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/features/errors_spec.rb +31 -0
- data/spec/spec_helper.rb +6 -0
- metadata +247 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
source "http://rubygems.org"
|
|
2
|
+
|
|
3
|
+
# Declare your gem's dependencies in nifty_errorpages.gemspec.
|
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
|
5
|
+
# development dependencies will be added by default to the :development group.
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
# jquery-rails is used by the dummy application
|
|
9
|
+
gem "jquery-rails"
|
|
10
|
+
gem "i18n"
|
|
11
|
+
|
|
12
|
+
# Declare any dependencies that are still in development here instead of in
|
|
13
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
|
14
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
|
15
|
+
# your gem to rubygems.org.
|
|
16
|
+
|
|
17
|
+
# To use debugger
|
|
18
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
nifty_errorpages (0.0.1)
|
|
5
|
+
i18n
|
|
6
|
+
rails (~> 3.2)
|
|
7
|
+
uglifier
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: http://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
actionmailer (3.2.13)
|
|
13
|
+
actionpack (= 3.2.13)
|
|
14
|
+
mail (~> 2.5.3)
|
|
15
|
+
actionpack (3.2.13)
|
|
16
|
+
activemodel (= 3.2.13)
|
|
17
|
+
activesupport (= 3.2.13)
|
|
18
|
+
builder (~> 3.0.0)
|
|
19
|
+
erubis (~> 2.7.0)
|
|
20
|
+
journey (~> 1.0.4)
|
|
21
|
+
rack (~> 1.4.5)
|
|
22
|
+
rack-cache (~> 1.2)
|
|
23
|
+
rack-test (~> 0.6.1)
|
|
24
|
+
sprockets (~> 2.2.1)
|
|
25
|
+
activemodel (3.2.13)
|
|
26
|
+
activesupport (= 3.2.13)
|
|
27
|
+
builder (~> 3.0.0)
|
|
28
|
+
activerecord (3.2.13)
|
|
29
|
+
activemodel (= 3.2.13)
|
|
30
|
+
activesupport (= 3.2.13)
|
|
31
|
+
arel (~> 3.0.2)
|
|
32
|
+
tzinfo (~> 0.3.29)
|
|
33
|
+
activeresource (3.2.13)
|
|
34
|
+
activemodel (= 3.2.13)
|
|
35
|
+
activesupport (= 3.2.13)
|
|
36
|
+
activesupport (3.2.13)
|
|
37
|
+
i18n (= 0.6.1)
|
|
38
|
+
multi_json (~> 1.0)
|
|
39
|
+
arel (3.0.2)
|
|
40
|
+
builder (3.0.4)
|
|
41
|
+
capybara (2.0.2)
|
|
42
|
+
mime-types (>= 1.16)
|
|
43
|
+
nokogiri (>= 1.3.3)
|
|
44
|
+
rack (>= 1.0.0)
|
|
45
|
+
rack-test (>= 0.5.4)
|
|
46
|
+
selenium-webdriver (~> 2.0)
|
|
47
|
+
xpath (~> 1.0.0)
|
|
48
|
+
childprocess (0.3.9)
|
|
49
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
50
|
+
columnize (0.3.6)
|
|
51
|
+
debugger (1.4.0)
|
|
52
|
+
columnize (>= 0.3.1)
|
|
53
|
+
debugger-linecache (~> 1.1.1)
|
|
54
|
+
debugger-ruby_core_source (~> 1.2.0)
|
|
55
|
+
debugger-linecache (1.1.2)
|
|
56
|
+
debugger-ruby_core_source (>= 1.1.1)
|
|
57
|
+
debugger-ruby_core_source (1.2.0)
|
|
58
|
+
diff-lcs (1.2.1)
|
|
59
|
+
erubis (2.7.0)
|
|
60
|
+
execjs (1.4.0)
|
|
61
|
+
multi_json (~> 1.0)
|
|
62
|
+
ffi (1.6.0)
|
|
63
|
+
hike (1.2.2)
|
|
64
|
+
i18n (0.6.1)
|
|
65
|
+
journey (1.0.4)
|
|
66
|
+
jquery-rails (2.2.1)
|
|
67
|
+
railties (>= 3.0, < 5.0)
|
|
68
|
+
thor (>= 0.14, < 2.0)
|
|
69
|
+
json (1.7.7)
|
|
70
|
+
mail (2.5.3)
|
|
71
|
+
i18n (>= 0.4.0)
|
|
72
|
+
mime-types (~> 1.16)
|
|
73
|
+
treetop (~> 1.4.8)
|
|
74
|
+
mime-types (1.23)
|
|
75
|
+
multi_json (1.7.2)
|
|
76
|
+
nokogiri (1.5.9)
|
|
77
|
+
polyglot (0.3.3)
|
|
78
|
+
rack (1.4.5)
|
|
79
|
+
rack-cache (1.2)
|
|
80
|
+
rack (>= 0.4)
|
|
81
|
+
rack-ssl (1.3.3)
|
|
82
|
+
rack
|
|
83
|
+
rack-test (0.6.2)
|
|
84
|
+
rack (>= 1.0)
|
|
85
|
+
rails (3.2.13)
|
|
86
|
+
actionmailer (= 3.2.13)
|
|
87
|
+
actionpack (= 3.2.13)
|
|
88
|
+
activerecord (= 3.2.13)
|
|
89
|
+
activeresource (= 3.2.13)
|
|
90
|
+
activesupport (= 3.2.13)
|
|
91
|
+
bundler (~> 1.0)
|
|
92
|
+
railties (= 3.2.13)
|
|
93
|
+
railties (3.2.13)
|
|
94
|
+
actionpack (= 3.2.13)
|
|
95
|
+
activesupport (= 3.2.13)
|
|
96
|
+
rack-ssl (~> 1.3.2)
|
|
97
|
+
rake (>= 0.8.7)
|
|
98
|
+
rdoc (~> 3.4)
|
|
99
|
+
thor (>= 0.14.6, < 2.0)
|
|
100
|
+
rake (10.0.4)
|
|
101
|
+
rdoc (3.12.2)
|
|
102
|
+
json (~> 1.4)
|
|
103
|
+
rspec-core (2.13.0)
|
|
104
|
+
rspec-expectations (2.13.0)
|
|
105
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
106
|
+
rspec-mocks (2.13.0)
|
|
107
|
+
rspec-rails (2.13.0)
|
|
108
|
+
actionpack (>= 3.0)
|
|
109
|
+
activesupport (>= 3.0)
|
|
110
|
+
railties (>= 3.0)
|
|
111
|
+
rspec-core (~> 2.13.0)
|
|
112
|
+
rspec-expectations (~> 2.13.0)
|
|
113
|
+
rspec-mocks (~> 2.13.0)
|
|
114
|
+
rubyzip (0.9.9)
|
|
115
|
+
selenium-webdriver (2.31.0)
|
|
116
|
+
childprocess (>= 0.2.5)
|
|
117
|
+
multi_json (~> 1.0)
|
|
118
|
+
rubyzip
|
|
119
|
+
websocket (~> 1.0.4)
|
|
120
|
+
sprockets (2.2.2)
|
|
121
|
+
hike (~> 1.2)
|
|
122
|
+
multi_json (~> 1.0)
|
|
123
|
+
rack (~> 1.0)
|
|
124
|
+
tilt (~> 1.1, != 1.3.0)
|
|
125
|
+
sqlite3 (1.3.7)
|
|
126
|
+
thor (0.18.1)
|
|
127
|
+
tilt (1.3.7)
|
|
128
|
+
treetop (1.4.12)
|
|
129
|
+
polyglot
|
|
130
|
+
polyglot (>= 0.3.1)
|
|
131
|
+
tzinfo (0.3.37)
|
|
132
|
+
uglifier (1.3.0)
|
|
133
|
+
execjs (>= 0.3.0)
|
|
134
|
+
multi_json (~> 1.0, >= 1.0.2)
|
|
135
|
+
websocket (1.0.7)
|
|
136
|
+
xpath (1.0.0)
|
|
137
|
+
nokogiri (~> 1.3)
|
|
138
|
+
|
|
139
|
+
PLATFORMS
|
|
140
|
+
ruby
|
|
141
|
+
|
|
142
|
+
DEPENDENCIES
|
|
143
|
+
capybara
|
|
144
|
+
debugger
|
|
145
|
+
i18n
|
|
146
|
+
jquery-rails
|
|
147
|
+
nifty_errorpages!
|
|
148
|
+
rspec-rails
|
|
149
|
+
sqlite3
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2013 Matthias Frick
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# NiftyErrorpages
|
|
2
|
+
|
|
3
|
+
This gem contains a little Rails 3.2 engine for generating dynamic error pages.
|
|
4
|
+
If an error occures, normally Rails will render a static 404.html, 422.html or 500.html file from the public folder.
|
|
5
|
+
NiftyErrorpages allows you to handle all the rendering through an errors_controller with views.
|
|
6
|
+
You can easily customize your views, layout, helper and controller.
|
|
7
|
+
|
|
8
|
+
The gem name is derived from the awesome [NiftyGenerators Gem](https://github.com/ryanb/nifty-generators) from Ryan Bates, because the default error pages have a quite similar style as the nifty generator views :-).
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
gem install nifty_errorpages
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or add it to your Gemfile:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
gem "nifty_errorpages"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Generators
|
|
23
|
+
There are following generators available for customizing your error pages and the behaviour:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
rails g nifty_errorpages:views # generates view files
|
|
27
|
+
rails g nifty_errorpages:controllers # generates controller files
|
|
28
|
+
rails g nifty_errorpages:helpers # generates helper files
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or simple generate all files
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
rails g nifty_errorpages:all # generates all files
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
Feel free to fork this project and add additional features. If you recognize any bugs, please create a new pull request or simple let me know about your problem. You always can contact me under [matthias@frick-web.at](mailto:matthias@frick-web.at).
|
|
39
|
+
|
|
40
|
+
## Testing
|
|
41
|
+
I run the tests under the production environment to simulate the exact error behavior under production.
|
|
42
|
+
Because of this you need to migrate the production database first:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
bundle exec rake db:migrate RAILS_ENV=production
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After that you can simple run the specs, first cd into the spec folder and then run:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
bundle exec rspec features/
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Copyright (c) 2013, Matthias Frick, BSc.
|
|
55
|
+
This project is released under the [MIT LICENSE](https://github.com/mattherick/nifty_errorpages/blob/master/MIT-LICENSE).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
begin
|
|
8
|
+
require 'rdoc/task'
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require 'rdoc/rdoc'
|
|
11
|
+
require 'rake/rdoctask'
|
|
12
|
+
RDoc::Task = Rake::RDocTask
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
17
|
+
rdoc.title = 'NiftyErrorpages'
|
|
18
|
+
rdoc.options << '--line-numbers'
|
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
24
|
+
load 'rails/tasks/engine.rake'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Bundler::GemHelper.install_tasks
|
|
29
|
+
|
|
30
|
+
require 'rake/testtask'
|
|
31
|
+
|
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
|
33
|
+
t.libs << 'lib'
|
|
34
|
+
t.libs << 'test'
|
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
|
36
|
+
t.verbose = false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
task :default => :test
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// the compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Place all the styles related to the matching controller here.
|
|
3
|
+
They will automatically be included in application.css.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
body {
|
|
7
|
+
background-color: #4B7399;
|
|
8
|
+
font-family: Verdana, Helvetica, Arial;
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#container {
|
|
13
|
+
width: 75%;
|
|
14
|
+
margin: 0 auto;
|
|
15
|
+
background-color: #FFF;
|
|
16
|
+
padding: 20px 40px;
|
|
17
|
+
border: solid 1px black;
|
|
18
|
+
margin-top: 20px;
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require_dependency "nifty_errorpages/application_controller"
|
|
2
|
+
|
|
3
|
+
module NiftyErrorpages
|
|
4
|
+
class ErrorsController < ApplicationController
|
|
5
|
+
|
|
6
|
+
def show
|
|
7
|
+
status = request.path[1..-1]
|
|
8
|
+
respond_to do |format|
|
|
9
|
+
format.html { render action: status }
|
|
10
|
+
format.json { render json: { status: status, error: get_error_message_for_json_format(status.to_i) } }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def get_error_message_for_json_format status
|
|
17
|
+
if status == 404
|
|
18
|
+
message = "<h1>Not Found.</h1><p>The page you are looking for doesn't exist.</p>"
|
|
19
|
+
elsif status == 422
|
|
20
|
+
message = "<h1>Change Rejected.</h1><p>Maybe you tried to change something you didn't have access to.</p>"
|
|
21
|
+
else
|
|
22
|
+
message = "<h1>Oops.</h1><p>We're sorry, but something went wrong.</p>"
|
|
23
|
+
end
|
|
24
|
+
message.html_safe
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title><%= pagetitle %></title>
|
|
5
|
+
<%= stylesheet_link_tag "nifty_errorpages/application", :media => "all" %>
|
|
6
|
+
<%= javascript_include_tag "nifty_errorpages/application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="container">
|
|
11
|
+
<%= yield %>
|
|
12
|
+
</div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
data/config/routes.rb
ADDED