rails_contrib 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- metadata +18 -139
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -43
- data/Rakefile +0 -38
- data/lib/rails_contrib.rb +0 -7
- data/lib/rails_contrib/action_controller/base.rb +0 -53
- data/lib/rails_contrib/action_view/base.rb +0 -27
- data/lib/rails_contrib/railtie.rb +0 -10
- data/lib/rails_contrib/version.rb +0 -5
- data/test/controller_test.rb +0 -29
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/statics_controller.rb +0 -6
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/statics/home.html.erb +0 -8
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -61
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -1933
- data/test/dummy/log/test.log +0 -372
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c +0 -0
- data/test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4 +0 -0
- data/test/rails_contrib_test.rb +0 -9
- data/test/test_helper.rb +0 -15
- data/test/view_test.rb +0 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0524d48954caf5dfd3f7a73a6fce1f104bc19639
|
4
|
+
data.tar.gz: c8710d82cb728b38bdf20ae002881627e3e18082
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28b0eab4cb75a0e4b6e408788549aedaa4fcd6084592a9c01519316bbb36ea8953197c14bfc89cc02d88a98d1c9a428ba56de5eced1136510a87c0c9c9731a4c
|
7
|
+
data.tar.gz: 92ac0ec65e97601d16c20d5cc6c7f5565cffeaa015569f005b034068bf86a204861f28d4c79108a6dc8733ad738cb058a39adbe58c0dadebc2f5f02ce08c1cc7
|
metadata
CHANGED
@@ -1,179 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mattways
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: tuning
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.8
|
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.8
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: sqlite3
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
17
|
+
- - '>='
|
36
18
|
- !ruby/object:Gem::Version
|
37
19
|
version: '0'
|
38
|
-
type: :
|
20
|
+
type: :runtime
|
39
21
|
prerelease: false
|
40
22
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
23
|
requirements:
|
43
|
-
- -
|
24
|
+
- - '>='
|
44
25
|
- !ruby/object:Gem::Version
|
45
26
|
version: '0'
|
46
|
-
description:
|
27
|
+
description: This gem has been renamed to just "tuning".
|
47
28
|
email:
|
48
29
|
- contact@mattways.com
|
49
30
|
executables: []
|
50
31
|
extensions: []
|
51
32
|
extra_rdoc_files: []
|
52
|
-
files:
|
53
|
-
|
54
|
-
|
55
|
-
-
|
56
|
-
|
57
|
-
- lib/rails_contrib.rb
|
58
|
-
- MIT-LICENSE
|
59
|
-
- Rakefile
|
60
|
-
- README.rdoc
|
61
|
-
- test/controller_test.rb
|
62
|
-
- test/dummy/app/assets/javascripts/application.js
|
63
|
-
- test/dummy/app/assets/stylesheets/application.css
|
64
|
-
- test/dummy/app/controllers/application_controller.rb
|
65
|
-
- test/dummy/app/controllers/statics_controller.rb
|
66
|
-
- test/dummy/app/helpers/application_helper.rb
|
67
|
-
- test/dummy/app/views/layouts/application.html.erb
|
68
|
-
- test/dummy/app/views/statics/home.html.erb
|
69
|
-
- test/dummy/config/application.rb
|
70
|
-
- test/dummy/config/boot.rb
|
71
|
-
- test/dummy/config/database.yml
|
72
|
-
- test/dummy/config/environment.rb
|
73
|
-
- test/dummy/config/environments/development.rb
|
74
|
-
- test/dummy/config/environments/production.rb
|
75
|
-
- test/dummy/config/environments/test.rb
|
76
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
77
|
-
- test/dummy/config/initializers/inflections.rb
|
78
|
-
- test/dummy/config/initializers/mime_types.rb
|
79
|
-
- test/dummy/config/initializers/secret_token.rb
|
80
|
-
- test/dummy/config/initializers/session_store.rb
|
81
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
82
|
-
- test/dummy/config/locales/en.yml
|
83
|
-
- test/dummy/config/routes.rb
|
84
|
-
- test/dummy/config.ru
|
85
|
-
- test/dummy/db/development.sqlite3
|
86
|
-
- test/dummy/log/development.log
|
87
|
-
- test/dummy/log/test.log
|
88
|
-
- test/dummy/public/404.html
|
89
|
-
- test/dummy/public/422.html
|
90
|
-
- test/dummy/public/500.html
|
91
|
-
- test/dummy/public/favicon.ico
|
92
|
-
- test/dummy/Rakefile
|
93
|
-
- test/dummy/README.rdoc
|
94
|
-
- test/dummy/script/rails
|
95
|
-
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
96
|
-
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
97
|
-
- test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
98
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
99
|
-
- test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c
|
100
|
-
- test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b
|
101
|
-
- test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
102
|
-
- test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
|
103
|
-
- test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
104
|
-
- test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
|
105
|
-
- test/rails_contrib_test.rb
|
106
|
-
- test/test_helper.rb
|
107
|
-
- test/view_test.rb
|
108
|
-
homepage: https://github.com/mattways/rails_contrib
|
109
|
-
licenses: []
|
33
|
+
files: []
|
34
|
+
homepage: https://github.com/mattways/tuning
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
110
38
|
post_install_message:
|
111
39
|
rdoc_options: []
|
112
40
|
require_paths:
|
113
41
|
- lib
|
114
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
43
|
requirements:
|
117
|
-
- -
|
44
|
+
- - '>='
|
118
45
|
- !ruby/object:Gem::Version
|
119
46
|
version: '0'
|
120
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
48
|
requirements:
|
123
|
-
- -
|
49
|
+
- - '>='
|
124
50
|
- !ruby/object:Gem::Version
|
125
51
|
version: '0'
|
126
52
|
requirements: []
|
127
53
|
rubyforge_project:
|
128
|
-
rubygems_version:
|
54
|
+
rubygems_version: 2.0.3
|
129
55
|
signing_key:
|
130
|
-
specification_version:
|
131
|
-
summary:
|
132
|
-
test_files:
|
133
|
-
- test/controller_test.rb
|
134
|
-
- test/dummy/app/assets/javascripts/application.js
|
135
|
-
- test/dummy/app/assets/stylesheets/application.css
|
136
|
-
- test/dummy/app/controllers/application_controller.rb
|
137
|
-
- test/dummy/app/controllers/statics_controller.rb
|
138
|
-
- test/dummy/app/helpers/application_helper.rb
|
139
|
-
- test/dummy/app/views/layouts/application.html.erb
|
140
|
-
- test/dummy/app/views/statics/home.html.erb
|
141
|
-
- test/dummy/config/application.rb
|
142
|
-
- test/dummy/config/boot.rb
|
143
|
-
- test/dummy/config/database.yml
|
144
|
-
- test/dummy/config/environment.rb
|
145
|
-
- test/dummy/config/environments/development.rb
|
146
|
-
- test/dummy/config/environments/production.rb
|
147
|
-
- test/dummy/config/environments/test.rb
|
148
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
149
|
-
- test/dummy/config/initializers/inflections.rb
|
150
|
-
- test/dummy/config/initializers/mime_types.rb
|
151
|
-
- test/dummy/config/initializers/secret_token.rb
|
152
|
-
- test/dummy/config/initializers/session_store.rb
|
153
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
154
|
-
- test/dummy/config/locales/en.yml
|
155
|
-
- test/dummy/config/routes.rb
|
156
|
-
- test/dummy/config.ru
|
157
|
-
- test/dummy/db/development.sqlite3
|
158
|
-
- test/dummy/log/development.log
|
159
|
-
- test/dummy/log/test.log
|
160
|
-
- test/dummy/public/404.html
|
161
|
-
- test/dummy/public/422.html
|
162
|
-
- test/dummy/public/500.html
|
163
|
-
- test/dummy/public/favicon.ico
|
164
|
-
- test/dummy/Rakefile
|
165
|
-
- test/dummy/README.rdoc
|
166
|
-
- test/dummy/script/rails
|
167
|
-
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
168
|
-
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
169
|
-
- test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
170
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
171
|
-
- test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c
|
172
|
-
- test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b
|
173
|
-
- test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
174
|
-
- test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
|
175
|
-
- test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
176
|
-
- test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
|
177
|
-
- test/rails_contrib_test.rb
|
178
|
-
- test/test_helper.rb
|
179
|
-
- test/view_test.rb
|
56
|
+
specification_version: 4
|
57
|
+
summary: Renamed to just "tuning"
|
58
|
+
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2013 Mattways
|
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.rdoc
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
{<img src="https://codeclimate.com/github/mattways/rails_contrib.png" />}[https://codeclimate.com/github/mattways/rails_contrib] {<img src="https://travis-ci.org/mattways/rails_contrib.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mattways/rails_contrib] {<img src="https://gemnasium.com/mattways/rails_contrib.png" alt="Dependency Status" />}[https://gemnasium.com/mattways/rails_contrib]
|
2
|
-
|
3
|
-
= Rails Contrib
|
4
|
-
|
5
|
-
Adds contributions to the core of Rails.
|
6
|
-
|
7
|
-
= Install
|
8
|
-
|
9
|
-
Put this line in your Gemfile:
|
10
|
-
gem 'rails_contrib'
|
11
|
-
|
12
|
-
Then bundle:
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
= Controllers
|
16
|
-
|
17
|
-
(This plugin will create an error method to force debug information on exceptions in development env)
|
18
|
-
|
19
|
-
Use not_found method to show 404.html in your controller:
|
20
|
-
not_found
|
21
|
-
|
22
|
-
Use forbidden method to show 422.html in your controller:
|
23
|
-
forbidden
|
24
|
-
|
25
|
-
Use redirect_with_flash to directly redirect with flash inside your controller:
|
26
|
-
redirect_with_flash home_path, :success, 'success message'
|
27
|
-
|
28
|
-
Use flash_errors method to directly flash models errors inside your controller:
|
29
|
-
flash_errors model
|
30
|
-
|
31
|
-
= Views
|
32
|
-
|
33
|
-
Use conditional_tag if you want wrap content into some tag if certain condition it's true in your views:
|
34
|
-
= conditional_tag :h1, request.path == home_path do
|
35
|
-
%a#logo{ :href => home_path }= Home
|
36
|
-
|
37
|
-
User active_menu? if you want to add an active class to some tag in your views:
|
38
|
-
%li{ :class => active_menu?(some_path) }
|
39
|
-
|
40
|
-
The method submit_tag outputs a button with span inside:
|
41
|
-
<button name="commit" value="submit">
|
42
|
-
<span>Send</span>
|
43
|
-
</button>
|
data/Rakefile
DELETED
@@ -1,38 +0,0 @@
|
|
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 = 'RailsContrib'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Bundler::GemHelper.install_tasks
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
|
30
|
-
Rake::TestTask.new(:test) do |t|
|
31
|
-
t.libs << 'lib'
|
32
|
-
t.libs << 'test'
|
33
|
-
t.pattern = 'test/**/*_test.rb'
|
34
|
-
t.verbose = false
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
task :default => :test
|
data/lib/rails_contrib.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
module RailsContrib
|
2
|
-
module ActionController
|
3
|
-
module Base
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.class_eval do
|
7
|
-
if Rails.env == 'development'
|
8
|
-
rescue_from Exception, :with => :error
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
protected
|
14
|
-
|
15
|
-
def error(exception)
|
16
|
-
logger.error exception.message
|
17
|
-
exception.backtrace.each { |line| logger.error line }
|
18
|
-
render :file => Rails.root.join('public', '500.html'), :status => 500, :layout => false
|
19
|
-
end
|
20
|
-
|
21
|
-
def not_found
|
22
|
-
render :file => Rails.root.join('public', '404.html'), :status => 404, :layout => false
|
23
|
-
end
|
24
|
-
|
25
|
-
def forbidden
|
26
|
-
render :file => Rails.root.join('public', '422.html'), :status => 422, :layout => false
|
27
|
-
end
|
28
|
-
|
29
|
-
def redirect_with_flash(options, type, flash)
|
30
|
-
args = [options]
|
31
|
-
if flash.is_a? String
|
32
|
-
flash = [flash]
|
33
|
-
elsif flash.respond_to? :errors
|
34
|
-
flash = flash.errors.full_messages
|
35
|
-
end
|
36
|
-
flash = { :flash => { type => flash } }
|
37
|
-
redirect_to *(args[0].is_a?(Hash) ? args[0].merge(flash) : args.push(flash))
|
38
|
-
end
|
39
|
-
|
40
|
-
def flash_errors(source)
|
41
|
-
flash.now[:error] = [] unless flash.now[:error].is_a? Array
|
42
|
-
if source.is_a? String
|
43
|
-
flash.now[:error] << source
|
44
|
-
elsif source.is_a? Array
|
45
|
-
source.each { |error| flash.now[:error] << error }
|
46
|
-
elsif source.respond_to? :errors
|
47
|
-
source.errors.full_messages.each { |error| flash.now[:error] << error }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module RailsContrib
|
2
|
-
module ActionView
|
3
|
-
module Base
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.alias_method_chain :submit_tag, :button
|
7
|
-
end
|
8
|
-
|
9
|
-
def conditional_tag(tag, condition, options=nil, &block)
|
10
|
-
condition ? content_tag(tag, options, &block) : capture(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
def active_menu?(path)
|
14
|
-
if path == '/'
|
15
|
-
request.path == path ? 'active' : ''
|
16
|
-
else
|
17
|
-
request.path.start_with?(path) ? 'active' : ''
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def submit_tag_with_button(value='Send', options={})
|
22
|
-
button_tag({ :type => 'submit', :name => 'commit' }.update(options)) { content_tag(:span, value) }
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/test/controller_test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ControllerTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup :set_instance
|
6
|
-
|
7
|
-
test "should have not_found method" do
|
8
|
-
assert @instance.respond_to?(:not_found)
|
9
|
-
end
|
10
|
-
|
11
|
-
test "should have forbidden method" do
|
12
|
-
assert @instance.respond_to?(:forbidden)
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should have redirect_with_flash method" do
|
16
|
-
assert @instance.respond_to?(:redirect_with_flash)
|
17
|
-
end
|
18
|
-
|
19
|
-
test "should have flash_errors method" do
|
20
|
-
assert @instance.respond_to?(:flash_errors)
|
21
|
-
end
|
22
|
-
|
23
|
-
protected
|
24
|
-
|
25
|
-
def set_instance
|
26
|
-
@instance = ApplicationController.new
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|