effective_pages 2.0.5 → 2.1.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 +4 -4
- data/README.md +2 -4
- data/app/controllers/admin/menus_controller.rb +2 -2
- data/app/controllers/admin/pages_controller.rb +2 -2
- data/app/controllers/effective/pages_controller.rb +5 -2
- data/app/helpers/effective_pages_helper.rb +15 -3
- data/app/models/effective/page.rb +8 -4
- data/app/views/admin/menus/show.html.haml +1 -1
- data/app/views/admin/pages/_actions.html.haml +9 -5
- data/config/effective_pages.rb +5 -0
- data/lib/effective_pages.rb +3 -1
- data/lib/effective_pages/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c9f8085e8926499de3786ac923688c20ca98ac0961fa91d46918dc4061684af
|
4
|
+
data.tar.gz: 96520c4452017a88c201c7d37378f57a421ae6f7ddefe5dc22803589d4768d38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 953b7b048450e900a145d65611f06b2b53ecfa8437470d48cc6c7a438d7736a892032da7b3592073cc0f01c3f10942efd980ed53556e40438724ef96e3b753e4
|
7
|
+
data.tar.gz: 1ee0ed1d174602c4c91f009f1e29bb79deb67b6bf39474ae47cdcc55b2b8efc5fa85377e05b2461abb901ccf07a0047d1164ad8a7114bb0ac9e522eb37327539
|
data/README.md
CHANGED
@@ -11,11 +11,11 @@ Built ontop of effective_regions and effective_ckeditor.
|
|
11
11
|
|
12
12
|
## effective_pages 2.0
|
13
13
|
|
14
|
-
This is the 2.0 series of effective_pages.
|
14
|
+
This is the 2.0 / bootstrap4 series of effective_pages.
|
15
15
|
|
16
16
|
This requires Twitter Bootstrap 4 and Rails 5.1+
|
17
17
|
|
18
|
-
Please check out [bootstrap3 branch](https://github.com/code-and-effect/
|
18
|
+
Please check out [bootstrap3 branch](https://github.com/code-and-effect/effective_pages/tree/bootstrap3) for more information using this gem with Bootstrap 3.
|
19
19
|
|
20
20
|
|
21
21
|
## Getting Started
|
@@ -250,5 +250,3 @@ MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
|
|
250
250
|
4. Push to the branch (`git push origin my-new-feature`)
|
251
251
|
5. Bonus points for test coverage
|
252
252
|
6. Create new Pull Request
|
253
|
-
|
254
|
-
|
@@ -45,8 +45,8 @@ module Admin
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def authorize_effective_menus!
|
48
|
-
EffectivePages.
|
49
|
-
EffectivePages.
|
48
|
+
EffectivePages.authorize!(self, :admin, :effective_pages)
|
49
|
+
EffectivePages.authorize!(self, action_name.to_sym, @menu || Effective::Menu)
|
50
50
|
end
|
51
51
|
|
52
52
|
def menu_params
|
@@ -101,8 +101,8 @@ module Admin
|
|
101
101
|
private
|
102
102
|
|
103
103
|
def authorize_effective_pages!
|
104
|
-
EffectivePages.
|
105
|
-
EffectivePages.
|
104
|
+
EffectivePages.authorize!(self, :admin, :effective_pages)
|
105
|
+
EffectivePages.authorize!(self, action_name.to_sym, @page || Effective::Page)
|
106
106
|
end
|
107
107
|
|
108
108
|
def page_params
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Effective
|
2
2
|
class PagesController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if EffectivePages.authenticate_user # Devise
|
4
|
+
|
3
5
|
def show
|
4
6
|
@pages = Effective::Page.all
|
5
7
|
@pages = @pages.published unless EffectivePages.authorized?(self, :admin, :effective_pages)
|
@@ -9,17 +11,18 @@ module Effective
|
|
9
11
|
raise ActiveRecord::RecordNotFound unless @page.present? # Incase .find() isn't raising it
|
10
12
|
raise Effective::AccessDenied.new('Access Denied', :show, @page) unless @page.roles_permit?(current_user)
|
11
13
|
|
12
|
-
EffectivePages.
|
14
|
+
EffectivePages.authorize!(self, :show, @page)
|
13
15
|
|
14
16
|
@page_title = @page.title
|
15
17
|
@meta_description = @page.meta_description
|
18
|
+
@canonical_url = effective_pages.page_url(@page)
|
16
19
|
|
17
20
|
if EffectivePages.authorized?(self, :admin, :effective_pages)
|
18
21
|
flash.now[:warning] = [
|
19
22
|
'Hi Admin!',
|
20
23
|
('You are viewing a hidden page.' unless @page.published?),
|
21
24
|
'Click here to',
|
22
|
-
("<a href='#{effective_regions.edit_path(effective_pages.page_path(@page))}' class='alert-link'>edit page content</a> or" unless admin_edit?),
|
25
|
+
("<a href='#{effective_regions.edit_path(effective_pages.page_path(@page))}' class='alert-link' data-no-turbolink='true' data-turbolinks='false'>edit page content</a> or" unless admin_edit?),
|
23
26
|
("<a href='#{effective_pages.edit_admin_page_path(@page)}' class='alert-link'>edit page settings</a>.")
|
24
27
|
].compact.join(' ')
|
25
28
|
end
|
@@ -2,7 +2,7 @@ module EffectivePagesHelper
|
|
2
2
|
|
3
3
|
def effective_pages_body_classes
|
4
4
|
[
|
5
|
-
params[:controller].parameterize,
|
5
|
+
params[:controller].to_s.parameterize,
|
6
6
|
params[:action],
|
7
7
|
((user_signed_in? ? 'signed-in'.freeze : 'not-signed-in'.freeze) rescue nil),
|
8
8
|
(@page.template rescue nil),
|
@@ -39,14 +39,18 @@ module EffectivePagesHelper
|
|
39
39
|
]
|
40
40
|
|
41
41
|
if EffectivePages.site_og_image_width.present?
|
42
|
-
tags << tag(:meta, property: 'og:image:width', content: EffectivePages.site_og_image_width)
|
42
|
+
tags << tag(:meta, property: 'og:image:width', content: EffectivePages.site_og_image_width)
|
43
43
|
end
|
44
44
|
|
45
45
|
if EffectivePages.site_og_image_height.present?
|
46
|
-
tags << tag(:meta, property: 'og:image:height', content: EffectivePages.site_og_image_height)
|
46
|
+
tags << tag(:meta, property: 'og:image:height', content: EffectivePages.site_og_image_height)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
if effective_pages_canonical_url.present?
|
51
|
+
tags << tag(:link, rel: 'canonical', href: effective_pages_canonical_url)
|
52
|
+
end
|
53
|
+
|
50
54
|
tags.compact.join("\n").html_safe
|
51
55
|
end
|
52
56
|
|
@@ -70,6 +74,14 @@ module EffectivePagesHelper
|
|
70
74
|
truncate((@meta_description || EffectivePages.fallback_meta_description).to_s, length: 150)
|
71
75
|
end
|
72
76
|
|
77
|
+
def effective_pages_canonical_url
|
78
|
+
unless @canonical_url.present? || EffectivePages.silence_missing_canonical_url_warnings
|
79
|
+
Rails.logger.error("WARNING: (effective_pages) Expected @canonical_url to be present. Please assign a @canonical_url variable in your controller action.")
|
80
|
+
end
|
81
|
+
|
82
|
+
@canonical_url
|
83
|
+
end
|
84
|
+
|
73
85
|
def effective_pages_og_type
|
74
86
|
@effective_pages_og_type || 'website'
|
75
87
|
end
|
@@ -42,6 +42,14 @@ module Effective
|
|
42
42
|
!draft?
|
43
43
|
end
|
44
44
|
|
45
|
+
def content
|
46
|
+
region(:content).content
|
47
|
+
end
|
48
|
+
|
49
|
+
def content=(input)
|
50
|
+
region(:content).content = input
|
51
|
+
end
|
52
|
+
|
45
53
|
# Returns a duplicated post object, or throws an exception
|
46
54
|
def duplicate!
|
47
55
|
Page.new(attributes.except('id', 'updated_at', 'created_at')).tap do |page|
|
@@ -60,7 +68,3 @@ module Effective
|
|
60
68
|
end
|
61
69
|
|
62
70
|
end
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
@@ -7,7 +7,7 @@
|
|
7
7
|
All menu editing may be done from the fullscreen editor. Just drag and drop menu items.
|
8
8
|
.col-sm-6
|
9
9
|
%p.text-right
|
10
|
-
= link_to "Edit #{@menu}", effective_regions.edit_path('/'), class: 'btn btn-primary', 'data-no-turbolink': true, target: '_blank'
|
10
|
+
= link_to "Edit #{@menu}", effective_regions.edit_path('/'), class: 'btn btn-primary', 'data-no-turbolink': true, 'data-turbolinks': false, target: '_blank'
|
11
11
|
|
12
12
|
- if defined?(EffectiveRoles)
|
13
13
|
%h2 Menu Items
|
@@ -1,7 +1,11 @@
|
|
1
1
|
= dropdown(variation: :dropleft) do
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
- if EffectivePages.authorized?(self, :edit, page)
|
3
|
+
= dropdown_link_to 'Edit', effective_pages.edit_admin_page_path(page)
|
4
|
+
= dropdown_link_to 'Edit Content', effective_regions.edit_path(page), 'data-no-turbolink': true, 'data-turbolinks': false, target: '_blank'
|
5
5
|
|
6
|
-
|
7
|
-
data:
|
6
|
+
- if EffectivePages.authorized?(self, :show, page)
|
7
|
+
= dropdown_link_to 'View', effective_pages.page_path(page), 'data-no-turbolink': true, 'data-turbolinks': false, target: '_blank'
|
8
|
+
|
9
|
+
- if EffectivePages.authorized?(self, :destroy, page)
|
10
|
+
= dropdown_link_to "Delete #{page}", effective_pages.admin_page_path(page),
|
11
|
+
data: { method: :delete, confirm: "Really delete #{page}?" }
|
data/config/effective_pages.rb
CHANGED
@@ -3,6 +3,9 @@ EffectivePages.setup do |config|
|
|
3
3
|
config.menus_table_name = :menus
|
4
4
|
config.menu_items_table_name = :menu_items
|
5
5
|
|
6
|
+
# Call devise authenticate_user! as a before_action on Effective::Pages#show
|
7
|
+
config.authenticate_user = false
|
8
|
+
|
6
9
|
# The directory where your page templates live
|
7
10
|
# Any files in this directory will be automatically available when
|
8
11
|
# creating/editting an Effective::Page from the Admin screens
|
@@ -37,6 +40,8 @@ EffectivePages.setup do |config|
|
|
37
40
|
# Turn off missing meta page title and meta description warnings
|
38
41
|
config.silence_missing_page_title_warnings = false
|
39
42
|
config.silence_missing_meta_description_warnings = false
|
43
|
+
config.silence_missing_canonical_url_warnings = false
|
44
|
+
|
40
45
|
|
41
46
|
# Display the effective roles 'choose roles' input when an admin creates a new post
|
42
47
|
config.use_effective_roles = false
|
data/lib/effective_pages.rb
CHANGED
@@ -23,8 +23,10 @@ module EffectivePages
|
|
23
23
|
|
24
24
|
mattr_accessor :silence_missing_page_title_warnings
|
25
25
|
mattr_accessor :silence_missing_meta_description_warnings
|
26
|
-
|
26
|
+
mattr_accessor :silence_missing_canonical_url_warnings
|
27
|
+
|
27
28
|
mattr_accessor :use_effective_roles
|
29
|
+
mattr_accessor :authenticate_user
|
28
30
|
|
29
31
|
mattr_accessor :menu
|
30
32
|
mattr_accessor :authorization_method
|
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: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -132,7 +132,7 @@ homepage: https://github.com/code-and-effect/effective_pages
|
|
132
132
|
licenses:
|
133
133
|
- MIT
|
134
134
|
metadata: {}
|
135
|
-
post_install_message:
|
135
|
+
post_install_message:
|
136
136
|
rdoc_options: []
|
137
137
|
require_paths:
|
138
138
|
- lib
|
@@ -147,8 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
-
signing_key:
|
150
|
+
rubygems_version: 3.1.2
|
151
|
+
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Content pages for your rails app
|
154
154
|
test_files: []
|