effective_pages 3.7.2 → 3.7.4

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: 257ab7fcba7fb0d142a7d89b296a08f32edb7e5746d6a446286c72e0e7722c3d
4
- data.tar.gz: ec621b15d2fb2ca809f31648d9503defd0ae78967a5f32ace4bd6305f44b6de3
3
+ metadata.gz: 609cb873f8ee7b06289d1b6a892e5dfdf31d331fec0e70524193966b8dae6fb5
4
+ data.tar.gz: e931912e980cf36b614deae0cf70f729f3e6e98fa78d6b415de4ccd5f13d687d
5
5
  SHA512:
6
- metadata.gz: '0316868455b2cc7e8b85573bef25e91eb91b89e9d90c7b48a798bdc1235ab903ba53ab96b7cb405eee0aacc8efedd993c84d52f8c72a4a2c3047b6fa4cc80290'
7
- data.tar.gz: 65eb909d2ea534e5e7c88d4639042a365bd797695cc755c522b4d78139300e164d877da84785e3bfd4c1fc517d16e38b03a41aeb7bb63d6fe0702e5d8bce0e8e
6
+ metadata.gz: ed4f370e424c4fa6d03146b15f2b15e67f747202009c4b264bad9b2fa1debc398a5fdb322ff4cabe1dc5fd7220bdd33a2effa4ccb4f72ee9df12be97695187f2
7
+ data.tar.gz: 5678d59ab27e06eb7320710462451917512e91f6c8010087dcea656b745f80442b5a4b9ca17f06d29f2818e910c32feaffc7dce464b7f76aad440e81ba4f3499
@@ -18,11 +18,11 @@ module ActsAsTagged
18
18
  #
19
19
  # Create or assign tags based on the input
20
20
  #
21
- # @param [Array<String, Integer>] input An array of tag names and/or tag ids, with a possible blank string
21
+ # @param [Array<String, Integer>] input An array of tag names and/or tag ids, with possible blank strings
22
22
  #
23
23
  # @return [void]
24
24
  #
25
- def tags=(input)
25
+ def tag_ids=(input) # named after the field name in `effective_pages/app/views/effective/tags/_fields.html.haml`
26
26
  input = (input - ['']).group_by { |value| value.gsub(/\D/, '').to_i > 0 }
27
27
 
28
28
  ids = (input[true] || []).map(&:to_i)
@@ -33,7 +33,7 @@ module ActsAsTagged
33
33
 
34
34
  # Create any new Tags
35
35
  ids.each do |tag_id|
36
- taggings.find { |tagging| tagging.tag_id == tag_id } || self.tags << Effective::Tag.where(id: tag_id).first!
36
+ taggings.find { |tagging| tagging.tag_id == tag_id } || self.tags << Effective::Tag.find(tag_id)
37
37
  end
38
38
 
39
39
  names.each { |name| self.tags.build(name: name) }
@@ -3,22 +3,11 @@ module Effective
3
3
  if defined?(PgSearch)
4
4
  include PgSearch::Model
5
5
 
6
- multisearchable against: [
7
- :title,
8
- :menu_title,
9
- :meta_description,
10
- :slug,
11
- ],
12
- associated_against: {
13
- rich_texts: [:body],
14
- },
15
- using: {
16
- trigram: {},
17
- tsearch: {
18
- highlight: true,
19
- }
20
- }
6
+ multisearchable against: [:search_content]
21
7
 
8
+ def search_content
9
+ title + '|' + body.to_plain_text
10
+ end
22
11
  end
23
12
 
24
13
  attr_accessor :current_user
@@ -99,6 +88,22 @@ module Effective
99
88
  published.where(menu: false).or(published.where(menu: true).where.not(id: menu_root_with_children))
100
89
  }
101
90
 
91
+ scope :pages, -> (user: nil, unpublished: false) {
92
+ scope = all.deep.sorted
93
+
94
+ if defined?(EffectiveRoles) && EffectivePages.use_effective_roles
95
+ if user.present? && user.respond_to?(:roles)
96
+ scope = scope.for_role(user.roles)
97
+ end
98
+ end
99
+
100
+ unless unpublished
101
+ scope = scope.published
102
+ end
103
+
104
+ scope
105
+ }
106
+
102
107
  before_validation(if: -> { menu? && menu_position.blank? }) do
103
108
  self.menu_position = (self.class.where(menu_parent: menu_parent).maximum(:menu_position) || -1) + 1
104
109
  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
@@ -5,4 +5,4 @@ en:
5
5
 
6
6
  activerecord:
7
7
  models:
8
- effective/tagging: 'Tagged content'
8
+ effective/tagging: 'Taggings'
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.7.2'.freeze
2
+ VERSION = '3.7.4'.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.2
4
+ version: 3.7.4
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-16 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails