thredded-workgroup 0.4.0 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e900db2dd2e7b571e3d3fcb4fac889dbdb8d40d96902a2952b97cbf6bb09704f
4
- data.tar.gz: 22794ff545fa54b6e0b26680ee53dacb5a472ccbe8658413534ea327344ddf47
3
+ metadata.gz: 5a4b87b36c16619b50e64a3279c978938cc4656be82573b6b86b65e3fec7ea9c
4
+ data.tar.gz: 531f7e1814b3f671b74040ab78002da8ce237c948fe9a6ad89162339fa1aa510
5
5
  SHA512:
6
- metadata.gz: 67d6def354e8949bf6cff37ddbd360a96a6a9a40a01260ebb7691e400d806796815ab017355ce778de415c368edb7eecefc2fe34f4fbb8b50127b68917e9fc91
7
- data.tar.gz: dc65476c53d44b297f13e5c1ca62309c6ec6436d9cfa90ee7f62e43d75b1b300226cae7b79a6be21f55617adaafea15192d6cab60943aeb7f41954161c62b08d
6
+ metadata.gz: a60532df9ba718818df6a18903cef78f3b9d269c36ba361296d57db7b13ff5a6de2297961855f98507e4ae00a5672ed22a4f4e784688efe9af560e029d1a6971
7
+ data.tar.gz: 1dff132aea3c5179bb706327d4f4c6f988492d6a197ba4045778e75f89cb83de73eacaa8fdc7e0915e6a5f81eb505510d0c01026ec9812009fcd689bef1df1a5
data/.rubocop.yml CHANGED
@@ -15,6 +15,15 @@ AllCops:
15
15
  CacheRootDirectory: tmp # ie. tmp/rubocop_cache
16
16
  UseCache: true
17
17
 
18
+ Layout/EndAlignment:
19
+ AutoCorrect: true
20
+
21
+ Layout/LineLength:
22
+ Max: 120
23
+
24
+ Layout/MultilineMethodCallIndentation:
25
+ EnforcedStyle: indented
26
+
18
27
  Metrics/AbcSize:
19
28
  Enabled: false
20
29
 
@@ -22,10 +31,23 @@ Metrics/ClassLength:
22
31
  Max: 125
23
32
 
24
33
  Metrics/BlockLength:
34
+ CountComments: false # count full line comments?
35
+ IgnoredMethods:
36
+ - 'context'
37
+ - 'configure'
38
+ - 'describe'
39
+ - 'namespace'
40
+ - 'shared_examples_for'
41
+ - 'shared_examples'
42
+ - 'pending'
43
+ - 'shared_context'
44
+ - 'xcontext'
45
+ - 'xdescribe'
46
+ - 'it'
25
47
  Exclude:
26
- - 'spec/factories/*'
27
- Layout/LineLength:
28
- Max: 120
48
+ - 'db/schema.rb'
49
+ - 'spec/factories/**/*'
50
+ - '*.gemspec'
29
51
 
30
52
  Metrics/MethodLength:
31
53
  Max: 25
@@ -37,19 +59,29 @@ Metrics/ModuleLength:
37
59
  Metrics/PerceivedComplexity:
38
60
  Enabled: false
39
61
 
62
+ Naming/PredicateName:
63
+ Exclude:
64
+ - spec/**/*.rb
65
+
66
+ Rails:
67
+ Enabled: true
68
+
69
+ Rails/Date:
70
+ EnforcedStyle: strict
71
+
72
+ Rails/FindBy:
73
+ Enabled: true
74
+ Include:
75
+ - app/commands/**/*.rb
76
+ - app/models/**/*.rb
77
+ - app/view_models/**/*.rb
78
+
40
79
  Style/CollectionMethods:
41
80
  Enabled: true
42
81
 
43
82
  Style/Documentation:
44
83
  Enabled: false
45
84
 
46
- Layout/MultilineMethodCallIndentation:
47
- EnforcedStyle: indented
48
-
49
- Naming/PredicateName:
50
- Exclude:
51
- - spec/**/*.rb
52
-
53
85
  Style/SignalException:
54
86
  EnforcedStyle: semantic
55
87
 
@@ -65,18 +97,3 @@ Style/TrailingCommaInHashLiteral:
65
97
  Style/TrailingCommaInArguments:
66
98
  Enabled: false
67
99
 
68
- Rails:
69
- Enabled: true
70
-
71
- Rails/Date:
72
- EnforcedStyle: strict
73
-
74
- Rails/FindBy:
75
- Enabled: true
76
- Include:
77
- - app/commands/**/*.rb
78
- - app/models/**/*.rb
79
- - app/view_models/**/*.rb
80
-
81
- Layout/EndAlignment:
82
- AutoCorrect: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.4.1
2
+
3
+ * Fix for a bug with pagination
4
+
1
5
  # v0.4.0
2
6
 
3
7
  This version supports:
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Thredded
4
+ module Workgroup
5
+ class Paginator < Kaminari::Helpers::Paginator
6
+ module UrlFixer
7
+ def page_url_for(page)
8
+ params = params_for(page)
9
+ params[:only_path] = true
10
+ @template.thredded_workgroup.url_for params
11
+ end
12
+ end
13
+
14
+ # Override the Kaminari::Helpers::Paginator methods as of kaminari v1.2.2 (fragile)
15
+ def page_tag(page)
16
+ @last = Thredded::Workgroup::Paginator::Page.new @template, **@options.merge(page: page)
17
+ end
18
+
19
+ # rubocop:disable Security/Eval
20
+ # rubocop:disable Style/DocumentDynamicEvalDefinition
21
+ %w[first_page prev_page next_page last_page gap].each do |tag|
22
+ eval <<-DEF, nil, __FILE__, __LINE__ + 1
23
+ def #{tag}_tag
24
+ @last = Thredded::Workgroup::Paginator::#{tag.classify}.new @template, **@options
25
+ end
26
+ DEF
27
+ end
28
+
29
+ # Create the relevant classes with the URL overrides
30
+ %w[page first_page prev_page next_page last_page gap].each do |tag|
31
+ eval <<-DEF, nil, __FILE__, __LINE__ + 1
32
+ class #{tag.classify} < ::Kaminari::Helpers:: #{tag.classify}
33
+ include UrlFixer
34
+ end
35
+ DEF
36
+ end
37
+ # rubocop:enable Security/Eval
38
+ # rubocop:enable Style/DocumentDynamicEvalDefinition
39
+ end
40
+ end
41
+ end
@@ -11,6 +11,6 @@
11
11
  method: :put -%>
12
12
 
13
13
  <footer>
14
- <%= paginate @topics %>
14
+ <%= paginate(@topics, paginator_class: Thredded::Workgroup::Paginator) %>
15
15
  </footer>
16
16
  <% end %>
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Thredded
4
4
  module Workgroup
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thredded-workgroup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Diggins
@@ -448,6 +448,7 @@ files:
448
448
  - app/controllers/thredded/workgroup/topics_controller.rb
449
449
  - app/jobs/thredded/workgroup/mark_all_topics_read_job.rb
450
450
  - app/view_hooks/thredded/workgroup/view_hooks.rb
451
+ - app/view_models/thredded/workgroup/paginator.rb
451
452
  - app/view_models/thredded/workgroup/topics_page_view_with_last_post.rb
452
453
  - app/views/layouts/thredded/workgroup/application.html.erb
453
454
  - app/views/thredded/posts_common/form/_after_content.html.erb
@@ -469,6 +470,7 @@ files:
469
470
  - bin/dummy-rails
470
471
  - bin/rails.rb
471
472
  - bin/rspec
473
+ - bin/rubocop
472
474
  - bin/setup
473
475
  - bin/update_from_thredded
474
476
  - config/locales/en.yml