render_404 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.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in render_404.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Андрей [ws70]
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ render_404
2
+ ==========
3
+
4
+ Auto rendering 404 errors for Rails App
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ # coding: utf-8
2
+ class ErrorsController < ApplicationController
3
+ def routing_error
4
+ render_404
5
+ end
6
+ end
@@ -0,0 +1 @@
1
+ <h1>Page not found!<h1>
@@ -0,0 +1,9 @@
1
+ <%# breadcrumbs "root", ["Страница не найдена"] %>
2
+ <p>Запрошенному вами URL не соответствует ни одна страница сайта.</p>
3
+ <p>Возможные причины:</p>
4
+ <ul class="sitemap">
5
+ <li>Вам могли прислать неверную ссылку.</li>
6
+ <li>Вы могли набрать адрес с ошибкой.</li>
7
+ <li>Страница могла быть удалена с изменением структуры сайта.</li>
8
+ </ul>
9
+ <p>Если вы уверены, что адрес правильный, попробуйте начать поиск информации с <a href="/">главной страницы сайта</a>.</p>
@@ -0,0 +1,3 @@
1
+ en:
2
+ render_404:
3
+ render_not_found: Page not found
@@ -0,0 +1,3 @@
1
+ ru:
2
+ render_404:
3
+ page_not_found: "Страница не найдена (404)"
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ match "*request", :to => "errors#routing_error"
3
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ module Render404
3
+ module Controller
4
+ def render_404
5
+ @meta_title = I18n.t("render_404.page_not_found")
6
+ locale = I18n.locale
7
+ respond_to do |format|
8
+ format.html {
9
+ render(
10
+ :template => "errors/#{locale}/not_found.html.erb",
11
+ :status => 404,
12
+ :layout => true
13
+ )
14
+ }
15
+ format.all {
16
+ render :nothing => true,
17
+ :status => 404
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,10 @@
1
+ module Render404
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Render404
4
+ engine_name "render_404"
5
+
6
+ initializer "render_404.includers" do |app|
7
+ ActionController::Base.send :include, Render404::Controller
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Render404
2
+ VERSION = "0.0.1"
3
+ end
data/lib/render_404.rb ADDED
@@ -0,0 +1,4 @@
1
+ # coding: utf-8
2
+ require "render_404/controller"
3
+ require "render_404/engine"
4
+ require "render_404/version"
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'render_404/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "render_404"
8
+ gem.version = Render404::VERSION
9
+ gem.authors = ["Андрей [ws70]"]
10
+ gem.email = ["railscode@gmail.com"]
11
+ gem.description = "Auto rendering 404 errors for Rails App"
12
+ gem.summary = "Auto rendering 404 errors for Rails App"
13
+ gem.homepage = "https://github.com/vav/render_404"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "rails", ">= 3.2.12"
21
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: render_404
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Андрей [ws70]
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-05 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.12
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.12
30
+ description: Auto rendering 404 errors for Rails App
31
+ email:
32
+ - railscode@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - app/controllers/errors_controller.rb
43
+ - app/views/errors/en/not_found.html.erb
44
+ - app/views/errors/ru/not_found.html.erb
45
+ - config/locales/render_404.en.yml
46
+ - config/locales/render_404.ru.yml
47
+ - config/routes.rb
48
+ - lib/render_404.rb
49
+ - lib/render_404/controller.rb
50
+ - lib/render_404/engine.rb
51
+ - lib/render_404/version.rb
52
+ - render_404.gemspec
53
+ homepage: https://github.com/vav/render_404
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 1.8.23
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Auto rendering 404 errors for Rails App
77
+ test_files: []