effective_pages 3.10.2 → 3.11.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: 1fd5033b1c1e0aeb36a9d35216a9f47e7e5f68de94dbe8688f8a4cf6e606a690
4
- data.tar.gz: 3512cfb9bba19e4a2c71c56c86f05efe574bc7dbe0e924f138f2873b4da20c7a
3
+ metadata.gz: f608a5aa1318fab93ca116d9edea04aeb3a2077ecbcd41378dad81b3fb3018a5
4
+ data.tar.gz: 803a6fbc21a969464faf8d149b724d1a65b1b970e2a4b2e5ac57ddd17cf02e87
5
5
  SHA512:
6
- metadata.gz: 3e8b8bba6f888898cc7e6ba2508b4d0cacd97881011c57e0dafe1ddb63f22b74c6da0db650f8e0bbd9b4b182f6f836c5167f6da95a764b31b1c5b590cb6e86b6
7
- data.tar.gz: 01bba194d58a6d6faae7cd5cfa2773f92e165d13c2984015709905475328b019b5ec68b1072d6467ba5249e425ecc9a2d9f89c8276c550d5be2bb28feea7432a
6
+ metadata.gz: 482a07502489d6b6e6494bc6bf17f5b17c82ee05a68f500b85a33d380b71abc49074c371f556816b60142f131d523f46a3f66271c0ea69094dda69fb147523aa
7
+ data.tar.gz: dd26dfe9186dc3d1e8408f42967431a3e94d8db2882d8c96f7d53deb9103bb8af0888ccbd5bd247c52a5ba99ff9f0caf8d141caa037d478d5cb5aa98fee64e0b
@@ -1,9 +1,11 @@
1
1
  module Effective
2
2
  class PermalinksController < ApplicationController
3
- def redirect
3
+ include Effective::CrudController
4
+
5
+ def show
4
6
  @permalink = Effective::Permalink.find_by! slug: params[:slug]
5
7
 
6
- authorize! :redirect, @permalink
8
+ authorize! :show, @permalink
7
9
 
8
10
  redirect_to redirect_path_for(@permalink), allow_other_host: (@permalink.target == :url)
9
11
  end
@@ -5,9 +5,18 @@ class EffectivePermalinksDatatable < Effective::Datatable
5
5
  col :updated_at, visible: false
6
6
 
7
7
  col :title
8
- col :slug
8
+
9
+ col(:url) do |permalink|
10
+ url = (root_url + "link/" + permalink.slug)
11
+ link_to(url, url, target: '_blank')
12
+ end
13
+
9
14
  col :summary
10
- col :tags
15
+
16
+ col :slug, visible: false
17
+ col :tags, visible: false
18
+
19
+ col :tracks_count, label: 'Views'
11
20
 
12
21
  actions_col
13
22
  end
@@ -14,6 +14,7 @@ module Effective
14
14
  acts_as_tagged
15
15
  acts_as_slugged
16
16
 
17
+ acts_as_trackable if respond_to?(:acts_as_trackable)
17
18
  log_changes if respond_to?(:log_changes)
18
19
 
19
20
  scope :deep, -> {
@@ -3,5 +3,11 @@
3
3
  = render '/admin/permalinks/form_permalink', permalink: permalink
4
4
 
5
5
  - if permalink.persisted?
6
- = tab 'Logs' do
7
- = render_datatable(permalink.log_changes_datatable, inline: true, namespace: :admin)
6
+ - if permalink.class.respond_to?(:acts_as_trackable?)
7
+ = tab 'Tracks' do
8
+ - datatable = Admin::EffectiveTracksDatatable.new(owner: permalink)
9
+ = render_datatable(datatable, inline: true, namespace: :admin)
10
+
11
+ - if permalink.respond_to?(:log_changes_datatable)
12
+ = tab 'Logs' do
13
+ = render_datatable(permalink.log_changes_datatable, inline: true, namespace: :admin)
@@ -1,4 +1,4 @@
1
- = cache([carousel, Effective::CarouselItem.all.cache_key]) do
1
+ = cache(EffectiveResources.cache_key(carousel, Effective::CarouselItem.all.cache_key_with_version)) do
2
2
  - carousel_items = Effective::CarouselItem.sorted.deep.where(carousel: carousel).to_a
3
3
  - uid = "effective-carousel-#{carousel}-#{Time.zone.now.to_i}"
4
4
 
@@ -1,7 +1,7 @@
1
1
  - raise('expected a menu') unless menu.present?
2
2
  - menu = menu.to_s
3
3
 
4
- = cache([menu, current_user, Effective::Page.all.cache_key]) do
4
+ = cache(EffectiveResources.cache_key(menu, current_user, Effective::Page.all.cache_key_with_version)) do
5
5
  - # Renders menu_root? level pages and their immediate children
6
6
  - Effective::Page.for_menu_root(menu).each do |page|
7
7
  - next unless EffectiveResources.authorized?(self, :show, page)
data/config/routes.rb CHANGED
@@ -14,7 +14,7 @@ EffectivePages::Engine.routes.draw do
14
14
  end
15
15
 
16
16
  scope module: 'effective' do
17
- get '/link/:slug', to: 'permalinks#redirect', as: :permalink_redirect
17
+ get '/link/:slug', to: 'permalinks#show', as: :permalink_redirect
18
18
 
19
19
  match '*id', to: 'pages#show', via: :get, as: :page, constraints: lambda { |req|
20
20
  Effective::Page.find_by_slug_or_id(req.path_parameters[:id] || '/').present?
@@ -88,6 +88,7 @@ class CreateEffectivePages < ActiveRecord::Migration[6.0]
88
88
  t.string :slug
89
89
  t.string :url
90
90
  t.text :summary
91
+ t.integer :tracks_count, default: 0
91
92
 
92
93
  t.timestamps
93
94
  end
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.10.2'.freeze
2
+ VERSION = '3.11.0'.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.10.2
4
+ version: 3.11.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-05-02 00:00:00.000000000 Z
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails