effective_posts 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bde5e656dd3fde528efd6721dcc6e07b5c19961fb2b7ba0de5171f37724e608c
4
- data.tar.gz: e842c001e3b345812c3c686a6a318c76c56369c587e0b1c95950d2f785f29d8b
3
+ metadata.gz: 18b1cb77e5c1dee2b2a438b1ad4a71f1a79caa1f5340d351b3355e0e92909c4b
4
+ data.tar.gz: 5d37e599214a4346eaa6a43491109496dbff7ace48bc8a706d2ad801b1cea3e9
5
5
  SHA512:
6
- metadata.gz: 3960b26be3a24db766a56bab72b8855cf6628f1f33071e1348a078796a90396a2b46a2bce09053f0fa0331c43e16fda7df11d4f00b1ddcca5979f39d019f92eb
7
- data.tar.gz: bd8883db4146db72c6cd75c1d0efbd0964c85b7d95c472ad67358d3f9fb7d2fafa1c765f01f3d936162697c6b633d035b644159980ba90b9183d6d08075902d6
6
+ metadata.gz: 237e17a90d360ee82c0d75e2d3ad2e1e3e8afe1f558e59307d6c844e20cc8d3532bfee6ff4fde9a8a2e5a6cab9fbfdd4534af629b9e4917d4f034029547527f9
7
+ data.tar.gz: 7b19966b9da0e7a1f6182678181f1fc8f70814500ce7adcf94dfcf7cd6103dfe2579d40e9280b7d22d0404a746725db98c7bc9df8297f33aa43f3aa8b343d55b
@@ -28,6 +28,7 @@ class EffectivePostsDatatable < Effective::Datatable
28
28
  col :published?, as: :boolean
29
29
  col :published_start_at, label: "Published start"
30
30
  col :published_end_at, label: "Published end"
31
+ col :roles
31
32
 
32
33
  col :archived
33
34
 
@@ -86,15 +86,21 @@ module EffectivePostsHelper
86
86
  ].compact.join(' ').html_safe
87
87
  end
88
88
 
89
+ def post_status_badge(post)
90
+ post.roles.map do |role|
91
+ content_tag(:span, "#{role.to_s.upcase} ONLY", class: 'badge badge-secondary')
92
+ end.join(' ').html_safe
93
+ end
94
+
89
95
  def admin_post_status_badge(post)
90
96
  return nil unless EffectiveResources.authorized?(self, :admin, :effective_posts)
91
97
 
92
98
  if post.archived?
93
- content_tag(:span, 'ARCHIVED', class: 'badge badge-info')
99
+ content_tag(:span, 'ARCHIVED', class: 'badge badge-secondary')
94
100
  elsif post.draft?
95
- content_tag(:span, 'DRAFT', class: 'badge badge-info')
101
+ content_tag(:span, 'NOT PUBLISHED', class: 'badge badge-danger')
96
102
  elsif post.published? == false
97
- content_tag(:span, "TO BE PUBLISHED AT #{post.published_start_at&.strftime('%F %H:%M') || 'LATER'}", class: 'badge badge-info')
103
+ content_tag(:span, "TO BE PUBLISHED AT #{post.published_start_at&.strftime('%F %H:%M') || 'LATER'}", class: 'badge badge-danger')
98
104
  end
99
105
  end
100
106
 
@@ -88,9 +88,10 @@ module Effective
88
88
  scope :posts, -> (user: nil, category: nil, unpublished: false, archived: false) {
89
89
  scope = all.deep.order(arel_table[:published_start_at].desc.nulls_last)
90
90
 
91
- if defined?(EffectiveRoles) && EffectivePosts.use_effective_roles
92
- scope = scope.for_role(user&.roles)
93
- end
91
+ # We include member only posts for all users.
92
+ # if defined?(EffectiveRoles) && EffectivePosts.use_effective_roles
93
+ # scope = scope.for_role(user&.roles)
94
+ # end
94
95
 
95
96
  if category.present?
96
97
  scope = scope.with_category(category)
@@ -8,6 +8,7 @@
8
8
 
9
9
  .effective-posts-meta.mb-2
10
10
  = post_meta(post, author: false)
11
+ = post_status_badge(post)
11
12
  = admin_post_status_badge(post)
12
13
 
13
14
  %h2.effective-posts-title= link_to post, effective_post_path(post)
@@ -1,3 +1,3 @@
1
1
  module EffectivePosts
2
- VERSION = '2.8.0'.freeze
2
+ VERSION = '2.9.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_posts
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-06 00:00:00.000000000 Z
11
+ date: 2024-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails