listings 0.1.7 → 0.1.8
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/app/views/listings/_table_content.html.haml +1 -1
- data/lib/listings/action_view_extensions.rb +2 -1
- data/lib/listings/kaminari_helpers_tag_patch.rb +2 -3
- data/lib/listings/rspec/listings_helpers.rb +6 -1
- data/lib/listings/sources/active_record_data_source.rb +2 -3
- data/lib/listings/sources/object_data_source.rb +2 -3
- data/lib/listings/version.rb +1 -1
- data/lib/listings/view_helper_methods.rb +1 -1
- data/spec/dummy/config/application.rb +2 -2
- data/spec/dummy/config/environments/test.rb +2 -1
- metadata +2 -34
@@ -26,7 +26,7 @@
|
|
26
26
|
%ul.nav.clearfix
|
27
27
|
- if listing.paginated?
|
28
28
|
%li.pull-left
|
29
|
-
= paginate listing.items, :
|
29
|
+
= paginate listing.items, :theme => listing.kaminari_theme, :params => listing.params, :remote => true
|
30
30
|
- unless listing.export_formats.empty?
|
31
31
|
%li.pull-right
|
32
32
|
%ul.inline.list-inline
|
@@ -3,7 +3,8 @@ module Listings
|
|
3
3
|
module ActionViewExtensions
|
4
4
|
def render_listing(key, options = {})
|
5
5
|
options.reverse_merge! :params => {}
|
6
|
-
|
6
|
+
_params = Rails::VERSION::MAJOR < 5 ? params : params.to_unsafe_h
|
7
|
+
params_for_listing = {:listing => key}.merge(_params).merge(options[:params]).with_indifferent_access
|
7
8
|
listing = prepare_listing(params_for_listing, self)
|
8
9
|
res = listings_partial_render 'listing', listing
|
9
10
|
Kaminari::Helpers::Tag.paginate_with_listings(nil)
|
@@ -9,9 +9,10 @@ module Kaminari
|
|
9
9
|
Thread.current[:listings]
|
10
10
|
end
|
11
11
|
|
12
|
+
alias_method :page_url_for_without_listing, :page_url_for
|
12
13
|
# patch kaminari helpers
|
13
14
|
# passing options of mountable engine routes seems to not be working
|
14
|
-
def
|
15
|
+
def page_url_for(page)
|
15
16
|
if Kaminari::Helpers::Tag.listings_to_paginate_with
|
16
17
|
@params.delete :page
|
17
18
|
params = {@param_name => page}.merge(@params).with_indifferent_access
|
@@ -22,8 +23,6 @@ module Kaminari
|
|
22
23
|
page_url_for_without_listing(page)
|
23
24
|
end
|
24
25
|
end
|
25
|
-
|
26
|
-
alias_method_chain :page_url_for, :listing
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
@@ -36,7 +36,12 @@ module RSpec::ListingsHelpers
|
|
36
36
|
|
37
37
|
def fake_context
|
38
38
|
controller = ActionController::Base.new
|
39
|
-
|
39
|
+
|
40
|
+
controller.request = if Rails::VERSION::MAJOR < 5
|
41
|
+
ActionController::TestRequest.new(:host => "http://test.com")
|
42
|
+
else
|
43
|
+
ActionController::TestRequest.create
|
44
|
+
end
|
40
45
|
context = controller.view_context
|
41
46
|
|
42
47
|
context.class.send(:define_method, 'listings') do
|
@@ -80,15 +80,14 @@ module Listings::Sources
|
|
80
80
|
|
81
81
|
class DataSource
|
82
82
|
class << self
|
83
|
-
|
83
|
+
alias_method :for_without_active_record, :for
|
84
|
+
def for(model)
|
84
85
|
if (model.is_a?(Class) && model.ancestors.include?(ActiveRecord::Base)) || model.is_a?(ActiveRecord::Relation)
|
85
86
|
ActiveRecordDataSource.new(model)
|
86
87
|
else
|
87
88
|
for_without_active_record(model)
|
88
89
|
end
|
89
90
|
end
|
90
|
-
|
91
|
-
alias_method_chain :for, :active_record
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
@@ -58,15 +58,14 @@ module Listings::Sources
|
|
58
58
|
|
59
59
|
class DataSource
|
60
60
|
class << self
|
61
|
-
|
61
|
+
alias_method :for_without_object, :for
|
62
|
+
def for(model)
|
62
63
|
if model.is_a?(Array) # TODO Enumerable
|
63
64
|
ObjectDataSource.new(model)
|
64
65
|
else
|
65
66
|
for_without_object(model)
|
66
67
|
end
|
67
68
|
end
|
68
|
-
|
69
|
-
alias_method_chain :for, :object
|
70
69
|
end
|
71
70
|
end
|
72
71
|
|
data/lib/listings/version.rb
CHANGED
@@ -51,10 +51,10 @@ module Dummy
|
|
51
51
|
config.active_record.whitelist_attributes = true if Rails::VERSION::MAJOR == 3
|
52
52
|
|
53
53
|
# Enable the asset pipeline
|
54
|
-
config.assets.enabled = true
|
54
|
+
config.assets.enabled = true if Rails::VERSION::MAJOR < 5
|
55
55
|
|
56
56
|
# Version of your assets, change this if you want to expire all your assets
|
57
|
-
config.assets.version = '1.0'
|
57
|
+
config.assets.version = '1.0' if Rails::VERSION::MAJOR < 5
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -9,7 +9,8 @@ Dummy::Application.configure do
|
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
11
|
config.serve_static_assets = true
|
12
|
-
config.static_cache_control = "public, max-age=3600"
|
12
|
+
config.static_cache_control = "public, max-age=3600" if Rails::VERSION::MAJOR < 5
|
13
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } if Rails::VERSION::MAJOR >= 5
|
13
14
|
|
14
15
|
# Log error messages when you accidentally call methods on nil
|
15
16
|
config.whiny_nils = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -139,38 +139,6 @@ dependencies:
|
|
139
139
|
- - ! '>='
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: pry
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: pry-debugger
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
142
|
description: Simple creation of listings in rails applications.
|
175
143
|
email:
|
176
144
|
- bcardiff@gmail.com
|