effective_posts 2.7.4 → 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: 2de1e57d74d589f50d3515a2853108e482735e77040253b68d011a594ad14782
4
- data.tar.gz: 53cca2477debcdfa215d8e4b50a6eb394142cec9bd4c16075dd843c1e2fe8367
3
+ metadata.gz: 18b1cb77e5c1dee2b2a438b1ad4a71f1a79caa1f5340d351b3355e0e92909c4b
4
+ data.tar.gz: 5d37e599214a4346eaa6a43491109496dbff7ace48bc8a706d2ad801b1cea3e9
5
5
  SHA512:
6
- metadata.gz: 960b0c9fdcf9a28bf9975fae28470c676b430a66ca5d980d4b57cfcd91e8f56c8b3a07f0b2e19bb0a03c3d5ad1e1d07cfe27da4bf41acade69d0c01271ca8634
7
- data.tar.gz: 102cad6a101b4b5fef4f98770a2eba5b15d8dd53b8a6b3d79e277066c9d1b88a55ca8bb89c60fb949e4576ba22ff7c7f3564d8eac5c2425dffc041d592a7d580
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
 
@@ -6,7 +6,7 @@ module Effective
6
6
 
7
7
  if defined?(PgSearch)
8
8
  include PgSearch::Model
9
- multisearchable against: [:body]
9
+ multisearchable against: [:title, :body]
10
10
  end
11
11
 
12
12
  attr_accessor :current_user
@@ -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.7.4'.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.7.4
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-11-27 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