effective_pages 3.10.3 → 3.11.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: 65cee10f754283599ad7b184e91bc8c86be7b9fb9105c8ac73eea21dffb715d2
4
- data.tar.gz: aa5392fe1adef1c6938400e10be3c337bacfa418c6d3708a5119c0b1ef4d07f8
3
+ metadata.gz: f608a5aa1318fab93ca116d9edea04aeb3a2077ecbcd41378dad81b3fb3018a5
4
+ data.tar.gz: 803a6fbc21a969464faf8d149b724d1a65b1b970e2a4b2e5ac57ddd17cf02e87
5
5
  SHA512:
6
- metadata.gz: 4a3ddad10e69703c863560f5db63815fdcaa9a3f16662e9c7e0890d99c57a33290df385987d7b4f5d219b5e05d3ef4a881787de608405325c5c28c5935260733
7
- data.tar.gz: 5175e36de922d314b6010911b88a2102685b8b42105058ed0e3eaf5041bca8aaeb3d7d8d9740b2620ea6579593ce21b10114c78912ef6a44e6cfff5fc43d8ece
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)
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.3'.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.3
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-06 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