kaminari-cells 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/Gemfile +2 -0
- data/kaminari-cells.gemspec +2 -1
- data/lib/kaminari-cells.rb +3 -0
- data/lib/kaminari/cells.rb +1 -6
- data/lib/kaminari/cells/version.rb +1 -1
- data/test/cells_test.rb +10 -9
- data/test/fake_app/cells.rb +5 -14
- data/test/fake_app/rails_app.rb +14 -10
- data/test/fake_app/views/kaminari/{_paginator.erb → _paginator.html.erb} +0 -0
- data/test/test_helper.rb +1 -4
- metadata +26 -9
- data/test/fake_app/app-cells/.gitkeep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d60741bc8169c26b69a9123f5806b0792e33ea4a
|
4
|
+
data.tar.gz: d539c8ef29c839f2f7f48817720d08aedf0ac894
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1f6b3984a970a86a6e1d9b27889765cd50c58d4bd61f7b4b858fa502a0b4632637bafa9774c99f2b774660ae611e94c3bf0bb935641672a723341654e4027f7
|
7
|
+
data.tar.gz: da4d7a98e5fd1530f9dae29ff91fddb241760cfb8dc5df23a9d3033835f666f2c1cc55ed3d052041b183f1cce349bfe382c8b7ab25c745ec24659de68fdf0958
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
data/kaminari-cells.gemspec
CHANGED
@@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "kaminari", ">= 0.16.0"
|
22
|
-
spec.add_dependency "cells"
|
22
|
+
spec.add_dependency "cells", ">= 4.0.0", "<= 5.0.0"
|
23
|
+
spec.add_development_dependency "cells-erb"
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.6"
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "minitest"
|
data/lib/kaminari-cells.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
require "cells"
|
2
2
|
require "kaminari"
|
3
3
|
require "kaminari/cells/version"
|
4
|
+
require "cell/partial"
|
4
5
|
|
5
6
|
module Kaminari
|
6
7
|
module Helpers
|
7
8
|
module CellsHelper
|
8
9
|
include Kaminari::ActionViewExtension
|
9
10
|
include ActionView::Helpers::OutputSafetyHelper
|
11
|
+
include ActionView::Helpers::TranslationHelper
|
12
|
+
include Cell::ViewModel::Partial
|
10
13
|
|
11
14
|
def paginate(scope, options = {}, &block)
|
12
15
|
options = options.reverse_merge(:views_prefix => "../views/")
|
data/lib/kaminari/cells.rb
CHANGED
@@ -3,12 +3,7 @@ module Kaminari
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
|
7
|
-
if (::Cell::Rails.const_defined?(:ViewModel) and self < Cell::Rails::ViewModel) or (::Cell.const_defined?(:ViewModel) and self < Cell::ViewModel)
|
8
|
-
include Kaminari::Helpers::CellsHelper
|
9
|
-
else
|
10
|
-
helper Kaminari::Helpers::CellsHelper
|
11
|
-
end
|
6
|
+
include Kaminari::Helpers::CellsHelper
|
12
7
|
end
|
13
8
|
end
|
14
9
|
end
|
data/test/cells_test.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
Cell::
|
4
|
-
|
3
|
+
# Cell::ViewModel.class_eval do
|
4
|
+
# include Rails.application.routes.url_helpers # FIXME: that SUCKS.
|
5
5
|
|
6
|
-
|
7
|
-
end
|
6
|
+
# append_view_path "test/fake_app/app-cells/"
|
7
|
+
# end
|
8
8
|
|
9
9
|
|
10
10
|
class KaminariCellsTest < ActionController::TestCase
|
@@ -16,13 +16,14 @@ class KaminariCellsTest < ActionController::TestCase
|
|
16
16
|
50.times {|i| User.create! :name => "user#{i}"}
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
# TODO: test concept cells
|
20
|
+
# test "rendering normal cell" do
|
21
|
+
# get :index
|
22
|
+
# assert_equal "<p>1</p>\n\n", @response.body
|
23
|
+
# end
|
23
24
|
|
24
25
|
test "rendering view model cell" do
|
25
26
|
get :show, :id => 1
|
26
|
-
assert_equal "<p>1</p>\n
|
27
|
+
assert_equal "<p>1</p>\n", @response.body
|
27
28
|
end
|
28
29
|
end
|
data/test/fake_app/cells.rb
CHANGED
@@ -1,21 +1,12 @@
|
|
1
|
-
|
2
|
-
include Kaminari::Cells
|
3
|
-
|
4
|
-
def show(users)
|
5
|
-
@users = users
|
6
|
-
|
7
|
-
render :inline => <<-ERB
|
8
|
-
<%= paginate @users %>
|
9
|
-
ERB
|
10
|
-
end
|
11
|
-
end
|
1
|
+
require 'cell/partial'
|
12
2
|
|
13
3
|
class ViewModelCell < Cell::ViewModel
|
14
4
|
include Kaminari::Cells
|
5
|
+
include Partial
|
6
|
+
|
7
|
+
self.view_paths = ["test/fake_app/cells/"]
|
15
8
|
|
16
9
|
def show
|
17
|
-
|
18
|
-
<%= paginate model %>
|
19
|
-
ERB
|
10
|
+
paginate(model)
|
20
11
|
end
|
21
12
|
end
|
data/test/fake_app/rails_app.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
require "cells"
|
2
|
+
require "cells-erb"
|
3
|
+
require 'kaminari-cells'
|
4
|
+
require 'fake_app/cells'
|
5
|
+
|
2
6
|
require 'action_controller/railtie'
|
3
7
|
require 'action_view/railtie'
|
4
8
|
require 'active_record'
|
@@ -6,13 +10,13 @@ require 'active_record'
|
|
6
10
|
require 'fake_app/config'
|
7
11
|
|
8
12
|
|
13
|
+
|
9
14
|
# config
|
10
15
|
app = Class.new(Rails::Application)
|
11
16
|
app.config.secret_token = '3b7cd727ee24e8444053437c36cc66c4'
|
12
17
|
app.config.session_store :cookie_store, :key => '_myapp_session'
|
13
18
|
app.config.active_support.deprecation = :log
|
14
19
|
app.config.eager_load = false
|
15
|
-
# Rais.root
|
16
20
|
app.config.root = File.dirname(__FILE__)
|
17
21
|
Rails.backtrace_cleaner.remove_silencers!
|
18
22
|
app.initialize!
|
@@ -25,20 +29,20 @@ end
|
|
25
29
|
#models
|
26
30
|
require 'fake_app/models'
|
27
31
|
|
32
|
+
ActionView::Base.class_eval do
|
33
|
+
include ::Cell::RailsExtensions::ActionView
|
34
|
+
end
|
35
|
+
ActionController::Base.class_eval do
|
36
|
+
include ::Cell::RailsExtensions::ActionController
|
37
|
+
end
|
38
|
+
|
28
39
|
# controllers
|
29
40
|
class ApplicationController < ActionController::Base; end
|
30
41
|
class UsersController < ApplicationController
|
31
|
-
def index
|
32
|
-
@users = User.all.page params[:page]
|
33
|
-
render :inline => <<-ERB
|
34
|
-
<%= render_cell(:user, :show, @users) %>
|
35
|
-
ERB
|
36
|
-
end
|
37
|
-
|
38
42
|
def show
|
39
43
|
@users = User.all.page params[:page]
|
40
44
|
render :inline => <<-ERB
|
41
|
-
<%= cell(:view_model, @users).show %>
|
45
|
+
<%= cell(:view_model, @users).(:show) %>
|
42
46
|
ERB
|
43
47
|
end
|
44
48
|
end
|
File without changes
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaminari-cells
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kaminari
|
@@ -30,9 +30,29 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.0.0
|
34
|
+
- - "<="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 5.0.0
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 4.0.0
|
44
|
+
- - "<="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 5.0.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: cells-erb
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
36
56
|
version_requirements: !ruby/object:Gem::Requirement
|
37
57
|
requirements:
|
38
58
|
- - ">="
|
@@ -127,12 +147,11 @@ files:
|
|
127
147
|
- lib/kaminari/cells.rb
|
128
148
|
- lib/kaminari/cells/version.rb
|
129
149
|
- test/cells_test.rb
|
130
|
-
- test/fake_app/app-cells/.gitkeep
|
131
150
|
- test/fake_app/cells.rb
|
132
151
|
- test/fake_app/config.rb
|
133
152
|
- test/fake_app/models.rb
|
134
153
|
- test/fake_app/rails_app.rb
|
135
|
-
- test/fake_app/views/kaminari/_paginator.erb
|
154
|
+
- test/fake_app/views/kaminari/_paginator.html.erb
|
136
155
|
- test/test_helper.rb
|
137
156
|
homepage: ''
|
138
157
|
licenses:
|
@@ -154,17 +173,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
173
|
version: '0'
|
155
174
|
requirements: []
|
156
175
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.2.
|
176
|
+
rubygems_version: 2.2.2
|
158
177
|
signing_key:
|
159
178
|
specification_version: 4
|
160
179
|
summary: Kaminari pagination in Cells.
|
161
180
|
test_files:
|
162
181
|
- test/cells_test.rb
|
163
|
-
- test/fake_app/app-cells/.gitkeep
|
164
182
|
- test/fake_app/cells.rb
|
165
183
|
- test/fake_app/config.rb
|
166
184
|
- test/fake_app/models.rb
|
167
185
|
- test/fake_app/rails_app.rb
|
168
|
-
- test/fake_app/views/kaminari/_paginator.erb
|
186
|
+
- test/fake_app/views/kaminari/_paginator.html.erb
|
169
187
|
- test/test_helper.rb
|
170
|
-
has_rdoc:
|
File without changes
|