pagers 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +34 -0
- data/Rakefile +34 -0
- data/app/views/pagers/_main.html.erb +35 -0
- data/app/views/pagers/main.html.erb +35 -0
- data/config/locales/en.yml +6 -0
- data/config/locales/es.yml +6 -0
- data/lib/pagers/action_view/base.rb +40 -0
- data/lib/pagers/active_record/base.rb +35 -0
- data/lib/pagers/active_record/relation.rb +41 -0
- data/lib/pagers/engine.rb +7 -0
- data/lib/pagers/railtie.rb +16 -0
- data/lib/pagers/version.rb +5 -0
- data/lib/pagers.rb +9 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/pages_controller.rb +7 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/model.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/pages/index.html.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +22 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130820024335_create_models.rb +9 -0
- data/test/dummy/db/schema.rb +22 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +1236 -0
- data/test/dummy/log/test.log +94483 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/empty_test.rb +39 -0
- data/test/first_test.rb +43 -0
- data/test/last_test.rb +43 -0
- data/test/middle_test.rb +43 -0
- data/test/padding_test.rb +53 -0
- data/test/test_helper.rb +21 -0
- metadata +190 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0045ecc04a429c56771d9dce706949fc3836c9b5
|
4
|
+
data.tar.gz: 6fdd2abf723af68ecb4f4fecb88eb8eb6c5b7945
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 92da1eeafdfabaf9a2389e7e49941f13cbd6c53c9a83d1c2be30243a667fdd33ee865685b1f24c4717e2c990abe77a8c5b4fc002321e95d13c121e3099644680
|
7
|
+
data.tar.gz: 64fd9a84bbc9f6659276bb697ac70f749aafecbf768b0a1eeee73100ce1994c9e1ea34f22c7efe835e36440c655a9d533b2d282f0d64f6f293c000329f292059
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Museways
|
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
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
{<img src="https://badge.fury.io/rb/pagers.png" alt="Gem Version" />}[http://badge.fury.io/rb/pagers] {<img src="https://codeclimate.com/github/museways/pagers.png" />}[https://codeclimate.com/github/museways/pagers] {<img src="https://travis-ci.org/museways/pagers.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/pagers] {<img src="https://gemnasium.com/museways/pagers.png" alt="Dependency Status" />}[https://gemnasium.com/museways/pagers]
|
2
|
+
|
3
|
+
= Pagers
|
4
|
+
|
5
|
+
Inspired in kaminari and will_paginate but more minimalistic.
|
6
|
+
|
7
|
+
= Install
|
8
|
+
|
9
|
+
Put this line in your Gemfile:
|
10
|
+
gem 'pagers'
|
11
|
+
|
12
|
+
Then bundle:
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
= Usage
|
16
|
+
|
17
|
+
Call the page scope:
|
18
|
+
@collection = Model.page(1, length: 10)
|
19
|
+
|
20
|
+
And in your views just:
|
21
|
+
<%= paginate @collection %>
|
22
|
+
|
23
|
+
= Configuration
|
24
|
+
|
25
|
+
== Defaults
|
26
|
+
|
27
|
+
If you want to change defaults you can override the values in the helper:
|
28
|
+
<%= paginate @collection, parameter: :p, pages: 3 %>
|
29
|
+
|
30
|
+
Or to set them globally in your application.rb:
|
31
|
+
config.pagers.parameter = :p
|
32
|
+
config.pagers.pages = 3
|
33
|
+
config.pagers.length = 5
|
34
|
+
config.pagers.padding = 0
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Pagers'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% if collection.total_pages > 1 %>
|
2
|
+
<ul class="pager">
|
3
|
+
<% if collection.previous_page %>
|
4
|
+
<li class="first">
|
5
|
+
<%= link_to t('pager.first'), page_path(collection.first_page, options) %>
|
6
|
+
</li>
|
7
|
+
<li class="previous">
|
8
|
+
<%= link_to t('pager.previous'), page_path(collection.previous_page, options) %>
|
9
|
+
</li>
|
10
|
+
<% end %>
|
11
|
+
<% if less_pages %>
|
12
|
+
<li class="ellipsis">
|
13
|
+
…
|
14
|
+
</li>
|
15
|
+
<% end %>
|
16
|
+
<% pages.each do |page| %>
|
17
|
+
<li class="page<%= ' current' if collection.current_page == page %>">
|
18
|
+
<%= link_to page, page_path(page, options) %>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
<% if more_pages %>
|
22
|
+
<li class="ellipsis">
|
23
|
+
…
|
24
|
+
</li>
|
25
|
+
<% end %>
|
26
|
+
<% if collection.next_page %>
|
27
|
+
<li class="next">
|
28
|
+
<%= link_to t('pager.next'), page_path(collection.next_page, options) %>
|
29
|
+
</li>
|
30
|
+
<li class="last">
|
31
|
+
<%= link_to t('pager.last'), page_path(collection.last_page, options) %>
|
32
|
+
</li>
|
33
|
+
<% end %>
|
34
|
+
</ul>
|
35
|
+
<% end %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% if collection.total_pages > 1 %>
|
2
|
+
<ul class="pager">
|
3
|
+
<% if collection.previous_page %>
|
4
|
+
<li class="first">
|
5
|
+
<%= link_to t('pager.first'), page_path(collection.first_page, options) %>
|
6
|
+
</li>
|
7
|
+
<li class="previous">
|
8
|
+
<%= link_to t('pager.previous'), page_path(collection.previous_page, options) %>
|
9
|
+
</li>
|
10
|
+
<% end %>
|
11
|
+
<% if less_pages %>
|
12
|
+
<li class="ellipsis">
|
13
|
+
…
|
14
|
+
</li>
|
15
|
+
<% end %>
|
16
|
+
<% pages.each do |page| %>
|
17
|
+
<li class="page<%= ' current' if collection.current_page == page %>">
|
18
|
+
<%= link_to page, page_path(page, options) %>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
<% if more_pages %>
|
22
|
+
<li class="ellipsis">
|
23
|
+
…
|
24
|
+
</li>
|
25
|
+
<% end %>
|
26
|
+
<% if collection.next_page %>
|
27
|
+
<li class="next">
|
28
|
+
<%= link_to t('pager.next'), page_path(collection.next_page, options) %>
|
29
|
+
</li>
|
30
|
+
<li class="last">
|
31
|
+
<%= link_to t('pager.last'), page_path(collection.last_page, options) %>
|
32
|
+
</li>
|
33
|
+
<% end %>
|
34
|
+
</ul>
|
35
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Pagers
|
2
|
+
module ActionView
|
3
|
+
module Base
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def page_path(page, options={})
|
7
|
+
parameter = options[:parameter] || Rails.application.config.pagers.parameter
|
8
|
+
request.path + '?' + request.query_parameters.merge(parameter => page).to_query
|
9
|
+
end
|
10
|
+
|
11
|
+
def paginate(collection, options={})
|
12
|
+
pages = options[:pages] || Rails.application.config.pagers.pages
|
13
|
+
if collection.total_pages >= pages
|
14
|
+
middle = (pages / 2).ceil
|
15
|
+
if collection.current_page > (collection.total_pages - middle)
|
16
|
+
starts_at = collection.total_pages - pages + 1
|
17
|
+
ends_at = collection.total_pages
|
18
|
+
elsif collection.current_page <= middle
|
19
|
+
starts_at = 1
|
20
|
+
ends_at = pages
|
21
|
+
else
|
22
|
+
starts_at = collection.current_page - middle
|
23
|
+
ends_at = collection.current_page + middle
|
24
|
+
end
|
25
|
+
else
|
26
|
+
starts_at = 1
|
27
|
+
ends_at = collection.total_pages
|
28
|
+
end
|
29
|
+
render partial: 'pagers/main', locals: {
|
30
|
+
collection: collection,
|
31
|
+
options: options,
|
32
|
+
pages: Range.new(starts_at, ends_at),
|
33
|
+
less_pages: starts_at > 1,
|
34
|
+
more_pages: ends_at < collection.total_pages
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Pagers
|
2
|
+
module ActiveRecord
|
3
|
+
module Base
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
|
8
|
+
def inherited(subclass)
|
9
|
+
subclass.class_eval do
|
10
|
+
if superclass == ::ActiveRecord::Base
|
11
|
+
scope :page, ->(number, options={}) {
|
12
|
+
length = options[:length] || Rails.application.config.pagers.length
|
13
|
+
padding = options[:padding] || Rails.application.config.pagers.padding
|
14
|
+
current_page = [number.to_i, 1].max
|
15
|
+
offset_value = (length * (current_page - 1)) + (current_page == 1 ? padding : 0)
|
16
|
+
limit_value = length - (current_page == 1 ? padding : 0)
|
17
|
+
values = Module.new do
|
18
|
+
define_method :page_length do
|
19
|
+
length
|
20
|
+
end
|
21
|
+
define_method :current_page do
|
22
|
+
current_page
|
23
|
+
end
|
24
|
+
end
|
25
|
+
limit(limit_value).offset(offset_value).extending(Pagers::ActiveRecord::Relation, values)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Pagers
|
2
|
+
module ActiveRecord
|
3
|
+
module Relation
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def total_pages
|
7
|
+
@total_pages ||= [(total_count.to_f / page_length).ceil, 1].max
|
8
|
+
end
|
9
|
+
|
10
|
+
def previous_page
|
11
|
+
@previous_page ||= current_page > 1 ? (current_page - 1) : nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def next_page
|
15
|
+
@next_page ||= current_page < total_pages ? (current_page + 1) : nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def first_page
|
19
|
+
1
|
20
|
+
end
|
21
|
+
|
22
|
+
def last_page
|
23
|
+
total_pages
|
24
|
+
end
|
25
|
+
|
26
|
+
def out_of_bounds?
|
27
|
+
@out_of_bounds ||= (current_page > total_pages || current_page < first_page)
|
28
|
+
end
|
29
|
+
|
30
|
+
def total_count
|
31
|
+
@total_count ||= begin
|
32
|
+
r = except(:limit, :offset, :order, :reorder)
|
33
|
+
r = r.except(:includes) unless references_eager_loaded_tables?
|
34
|
+
r = r.count
|
35
|
+
r.respond_to?(:count) ? r.count : r
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Pagers
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
|
4
|
+
config.pagers = ActiveSupport::OrderedOptions.new
|
5
|
+
config.pagers.length = 20
|
6
|
+
config.pagers.padding = 0
|
7
|
+
config.pagers.parameter = :p
|
8
|
+
config.pagers.pages = 5
|
9
|
+
|
10
|
+
initializer 'pagers' do
|
11
|
+
::ActiveRecord::Base.send :include, Pagers::ActiveRecord::Base
|
12
|
+
::ActionView::Base.send :include, Pagers::ActionView::Base
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/lib/pagers.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
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
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= 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,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= paginate @collection %>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require 'pagers'
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Generate digests for assets URLs.
|
33
|
+
config.assets.digest = true
|
34
|
+
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
37
|
+
|
38
|
+
# Specifies the header that your server uses for sending files.
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Set to :debug to see everything in the log.
|
46
|
+
config.log_level = :info
|
47
|
+
|
48
|
+
# Prepend all log lines with the following tags.
|
49
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
+
|
51
|
+
# Use a different logger for distributed setups.
|
52
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
+
|
54
|
+
# Use a different cache store in production.
|
55
|
+
# config.cache_store = :mem_cache_store
|
56
|
+
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
+
|
60
|
+
# Precompile additional assets.
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
+
# config.assets.precompile += %w( search.js )
|
63
|
+
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
+
# config.action_mailer.raise_delivery_errors = false
|
67
|
+
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
70
|
+
config.i18n.fallbacks = true
|
71
|
+
|
72
|
+
# Send deprecation notices to registered listeners.
|
73
|
+
config.active_support.deprecation = :notify
|
74
|
+
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
76
|
+
# config.autoflush_log = false
|
77
|
+
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
80
|
+
end
|