effective_pages 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -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 +3 -1
- data/app/models/effective/page.rb +8 -4
- data/app/views/admin/pages/_actions.html.haml +9 -5
- data/config/effective_pages.rb +3 -0
- data/lib/effective_pages.rb +1 -0
- data/lib/effective_pages/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b298b87af43901b5d92f8bcb5cf504fa4d3c713f1b64814a45791d491d1b5d81
|
4
|
+
data.tar.gz: c6306cc6b24c38e9155ae875db90c2c16745a48fcf4da456653011fdff364b44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcd50073b96b4ded0b1e15c67187e8f9fe92936562df620cbdb2f600adeb4d5f36ccbe7a19bf7e1dcc81ab1ae7e8b62c09b83c2e9e888872bb17402f5326103d
|
7
|
+
data.tar.gz: fe88e46fd6782778b8b2ea2283ca91c4f223bcd8b998f78ef234f94a11c26098634af5ef309caf0efd481cfd3b1f6af3193c6b829bb1af182995f754a1256d4d
|
@@ -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,7 +11,7 @@ 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
|
@@ -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
|
-
|
@@ -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
|
data/lib/effective_pages.rb
CHANGED
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.0.9
|
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: 2020-
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|