effective_posts 2.1.0 → 2.2.0

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: 1ceb1f23b04e83df1d9e2f1392dc541e9f80631bd503b95fd787fd0a41608e06
4
- data.tar.gz: 6171ca2f46ba3c5124b804fc06ddb6b27b405be2a2669fed7fc19fae095af9a5
3
+ metadata.gz: f228b038e50b44f2d2c17a492872ff12b35a2f0e6f04c3ede8b2bbb23aae0205
4
+ data.tar.gz: 61a375523f541f7b986554280376c090e8a787fedffe33e60e0b9d09639de837
5
5
  SHA512:
6
- metadata.gz: 1565992dbf8ab2e6b25ab0772bdcbc05193fb42591091cc40a05f847515e5d18416f14aa6c42afbb3afce19d4eb0fb7d9fe63514ca03c6ae0d4d22a3f4519a91
7
- data.tar.gz: 9425f6f6c6ea39f60d89392dfbcf3e50d132e25da4b670d5e09851c88538eb89140e63b4d6741fb98143a8fbf21f458857f99fd6e0caac2b91b2f788949f23ed
6
+ metadata.gz: dde470fb053b70b253e031b1c43dfa110f31b40821739f34681c3ccfa24de982a72ba0f27316bd26668f77f846c41bfd5f7d335fad49780ea3004d7e25747e30
7
+ data.tar.gz: 0cb784aec5de7ae07e8919ab8693bec7269bcb976b03235c6e00857b08b2257f75edc9db10c2e6b4e6ae5dbe63259cd16ebc7decd989552e6449ac743ed9a030
data/README.md CHANGED
@@ -100,6 +100,10 @@ if user.admin?
100
100
  end
101
101
  ```
102
102
 
103
+ ## Search
104
+
105
+ If you use `pg_search` then `Effective::Posts` will be also included on its `multisearch` by default, allowing you to search across all posts.
106
+
103
107
  ## Future Plans
104
108
 
105
109
  There are some obvious additional features that have yet to be implemented:
@@ -8,7 +8,7 @@ module Admin
8
8
  submit :save, 'Save'
9
9
  submit :save, 'Save and Add New', redirect: :new
10
10
  submit :save, 'Save and View', redirect: -> { effective_posts.post_path(resource) }
11
- submit :save, 'Duplicate', redirect: -> { effective_posts.new_admin_post_path(duplicate_id: resource.id) }
11
+ submit :save, 'Duplicate', redirect: -> { effective_posts.new_admin_post_path(duplicate_id: resource) }
12
12
 
13
13
  def post_params
14
14
  params.require(:effective_post).permit!
@@ -1,5 +1,27 @@
1
1
  module Effective
2
2
  class Post < ActiveRecord::Base
3
+ if defined?(PgSearch)
4
+ include PgSearch::Model
5
+
6
+ multisearchable against: [
7
+ :title,
8
+ :menu_title,
9
+ :meta_description,
10
+ :slug,
11
+ ],
12
+ associated_against: {
13
+ rich_text_body: [:body],
14
+ rich_text_excerpt: [:body],
15
+ },
16
+ using: {
17
+ trigram: {},
18
+ tsearch: {
19
+ highlight: true,
20
+ }
21
+ },
22
+ ranked_by: ":trigram" # Could rank by any column/expression, e.g.: (books.num_pages * :trigram) + (:tsearch / 2.0)
23
+ end
24
+
3
25
  attr_accessor :current_user
4
26
 
5
27
  acts_as_slugged
@@ -1,4 +1,4 @@
1
- = effective_form_with(model: post, url: post.persisted? ? effective_posts.admin_post_path(post.id) : effective_posts.admin_posts_path) do |f|
1
+ = effective_form_with(model: [:admin, post], engine: true) do |f|
2
2
  = f.text_field :title, hint: 'The title of your post.'
3
3
 
4
4
  - if f.object.persisted? || f.object.errors.include?(:slug)
@@ -1,4 +1,4 @@
1
- = effective_form_with(model: post, url: post.persisted? ? effective_posts.post_path(post.id) : effective_posts.posts_path) do |f|
1
+ = effective_form_with(model: post, engine: true) do |f|
2
2
  = f.text_field :title, hint: 'The title of your post.'
3
3
 
4
4
  - if f.object.persisted? || f.object.errors.include?(:slug)
@@ -1,3 +1,3 @@
1
1
  module EffectivePosts
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.2.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.1.0
4
+ version: 2.2.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: 2022-08-24 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails