effective_pages 3.7.1 → 3.7.3

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: f179e95562b963d627c17b17ffe4912b92caff1bfd0a8a2160a2eb5d310a2e8e
4
- data.tar.gz: c60c3a44c52670d4f3a650303a7feea0d290db19a66f3aa51ed0ab7730c673f4
3
+ metadata.gz: 70925d39994d0941e75bece5c0b240134d2b32470d31199c513a2e25faddc840
4
+ data.tar.gz: 6c8effd26cf0f030a293adb9c1542bd13fb3dd294e553544a23370d2ec6648f5
5
5
  SHA512:
6
- metadata.gz: 6567176a63f855482e04e69feaaa0a1d6cde4813953f3a29b6cffdb71a93ef0e87f3b9e86eb6a08fc09df5620156b4fa5a3e75f3d17b5dd49da5391c0b12cff8
7
- data.tar.gz: a5f4a50f5f7f92f771536be1a686f91de12b6cc3ecf33609e24f64d35ff4a9b892b67ee60bf2dcaa3c65ab9e15fdfac2e53f2851914d83ab7f0af2794b1976c1
6
+ metadata.gz: 0a538fa3618b3b1faf92f7ca4e8dad13ce41656e1b4327c7ff14813c9760127bbec87f3bfae4c929ddbacd8ae7a2bd4f3cc236e31860203c5a97dc2d61d4cc7f
7
+ data.tar.gz: f69803876b65edbd994fc7056903520a81f26907fbc8131260188e2fadcc32c4d7b22c62dd4677b468d996690b6011263e6140c2193477a8b2de3e329c3df776
@@ -3,34 +3,7 @@ module Effective
3
3
  if defined?(PgSearch)
4
4
  include PgSearch::Model
5
5
 
6
- pg_search_scope :search,
7
- against: [
8
- :title,
9
- :menu_title,
10
- :meta_description,
11
- :slug,
12
- ],
13
- associated_against: {
14
- rich_texts: [:body],
15
- },
16
- using: { tsearch: { highlight: true }, trigram: { word_similarity: true } }
17
-
18
- multisearchable against: [
19
- :title,
20
- :menu_title,
21
- :meta_description,
22
- :slug,
23
- ],
24
- associated_against: {
25
- rich_texts: [:body],
26
- },
27
- using: {
28
- trigram: {},
29
- tsearch: {
30
- highlight: true,
31
- }
32
- },
33
- ranked_by: ":trigram" # Could rank by any column/expression, e.g.: (books.num_pages * :trigram) + (:tsearch / 2.0)
6
+ multisearchable against: [:title, :menu_title, :meta_description, :slug]
34
7
  end
35
8
 
36
9
  attr_accessor :current_user
@@ -111,6 +84,22 @@ module Effective
111
84
  published.where(menu: false).or(published.where(menu: true).where.not(id: menu_root_with_children))
112
85
  }
113
86
 
87
+ scope :pages, -> (user: nil, unpublished: false) {
88
+ scope = all.deep.sorted
89
+
90
+ if defined?(EffectiveRoles) && EffectivePages.use_effective_roles
91
+ if user.present? && user.respond_to?(:roles)
92
+ scope = scope.for_role(user.roles)
93
+ end
94
+ end
95
+
96
+ unless unpublished
97
+ scope = scope.published
98
+ end
99
+
100
+ scope
101
+ }
102
+
114
103
  before_validation(if: -> { menu? && menu_position.blank? }) do
115
104
  self.menu_position = (self.class.where(menu_parent: menu_parent).maximum(:menu_position) || -1) + 1
116
105
  end
@@ -1,5 +1,11 @@
1
1
  module Effective
2
2
  class Permalink < ApplicationRecord
3
+ if defined?(PgSearch)
4
+ include PgSearch::Model
5
+
6
+ multisearchable against: [:title, :summary]
7
+ end
8
+
3
9
  self.table_name = (EffectivePages.permalinks_table_name || :permalinks).to_s
4
10
 
5
11
  has_one_attached :attachment
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.7.1'.freeze
2
+ VERSION = '3.7.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.1
4
+ version: 3.7.3
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: 2023-06-15 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails