effective_pages 3.4.13 → 3.5.0
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/alerts_controller.rb +15 -0
- data/app/datatables/effective_alerts_datatable.rb +18 -0
- data/app/helpers/effective_alerts_helper.rb +15 -0
- data/app/models/effective/alert.rb +25 -0
- data/app/views/admin/alerts/_form.html.haml +7 -0
- data/app/views/admin/alerts/_form_alert.html.haml +9 -0
- data/app/views/effective/alerts/_alert.html.haml +4 -0
- data/config/effective_pages.rb +1 -0
- data/config/routes.rb +1 -0
- data/db/migrate/01_create_effective_pages.rb.erb +7 -0
- data/lib/effective_pages/engine.rb +1 -0
- data/lib/effective_pages/version.rb +1 -1
- data/lib/effective_pages.rb +1 -1
- data/lib/generators/effective_pages/install_generator.rb +1 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf8ab6a872f5612cfc81a80d9a4616ef18ca85dc6b360e693fb24cd6039ced4e
|
4
|
+
data.tar.gz: 903d3aec8b320e7a69e6cd01a971e2ef3c09f57ed38103e357e031b9fd418090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4c3f5328c83713f2efba331743bcd99870432f2ba9d5defcda5926a82c2ad6d124191fec7987cb87442cc6d681869d8a4ccbf917394657f4d30be940b208479
|
7
|
+
data.tar.gz: 7a8fad535372027cd5b87b2b0f72508f26731d6e07b3d0ef7e6b6bb007396674306cbe9e8f37974ad134d577d65989036a7d7774331d08dec0345191a7f02e2a
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Admin
|
2
|
+
class AlertsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_pages) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
page_title 'Alerts'
|
9
|
+
|
10
|
+
def permitted_params
|
11
|
+
params.require(:effective_alert).permit!
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class EffectiveAlertsDatatable < Effective::Datatable
|
2
|
+
|
3
|
+
datatable do
|
4
|
+
col :id, visible: false
|
5
|
+
col :updated_at, visible: false
|
6
|
+
|
7
|
+
col :enabled
|
8
|
+
|
9
|
+
col :rich_text_body, label: 'Content'
|
10
|
+
|
11
|
+
actions_col
|
12
|
+
end
|
13
|
+
|
14
|
+
collection do
|
15
|
+
Effective::Alert.deep.all
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module EffectiveAlertsHelper
|
3
|
+
|
4
|
+
def effective_alerts
|
5
|
+
@_effective_alerts ||= Effective::Alert.all.enabled
|
6
|
+
end
|
7
|
+
|
8
|
+
def render_effective_alerts
|
9
|
+
effective_alerts
|
10
|
+
.map { |alert| render 'effective/alerts/alert', alert: alert }
|
11
|
+
.join
|
12
|
+
.html_safe
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Effective
|
2
|
+
class Alert < ApplicationRecord
|
3
|
+
self.table_name = (EffectivePages.alerts_table_name || :alerts).to_s
|
4
|
+
|
5
|
+
log_changes if respond_to?(:log_changes)
|
6
|
+
|
7
|
+
has_rich_text :body
|
8
|
+
|
9
|
+
effective_resource do
|
10
|
+
enabled :boolean
|
11
|
+
|
12
|
+
timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
scope :deep, -> { with_rich_text_body }
|
16
|
+
scope :enabled, -> { where(enabled: true) }
|
17
|
+
|
18
|
+
validates :body, presence: true
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
'alert'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= effective_form_with(model: [:admin, alert], engine: true) do |f|
|
2
|
+
= f.check_box :enabled, hint: 'Toggle activation of this alert'
|
3
|
+
|
4
|
+
- if defined?(EffectiveArticleEditor)
|
5
|
+
= f.article_editor :body, label: 'Content', hint: 'Content to be displayed'
|
6
|
+
- else
|
7
|
+
= f.rich_text_area :body, label: 'Content', hint: 'Content to be displayed'
|
8
|
+
|
9
|
+
= effective_submit(f)
|
data/config/effective_pages.rb
CHANGED
@@ -3,6 +3,7 @@ EffectivePages.setup do |config|
|
|
3
3
|
config.page_sections_table_name = :page_sections
|
4
4
|
config.page_banners_table_name = :page_banners
|
5
5
|
config.carousel_items_table_name = :carousel_items
|
6
|
+
config.alerts_table_name = :alerts
|
6
7
|
|
7
8
|
# The menu names a page can belong to
|
8
9
|
config.menus = [:main, :footer]
|
data/config/routes.rb
CHANGED
@@ -75,6 +75,12 @@ class CreateEffectivePages < ActiveRecord::Migration[4.2]
|
|
75
75
|
t.timestamps
|
76
76
|
end
|
77
77
|
|
78
|
+
create_table <%= @alerts_table_name %>, if_not_exists: true do |t|
|
79
|
+
t.boolean :enabled
|
80
|
+
|
81
|
+
t.timestamps
|
82
|
+
end
|
83
|
+
|
78
84
|
end
|
79
85
|
|
80
86
|
def self.down
|
@@ -82,6 +88,7 @@ class CreateEffectivePages < ActiveRecord::Migration[4.2]
|
|
82
88
|
drop_table <%= @page_banners_table_name %>
|
83
89
|
drop_table <%= @page_sections_table_name %>
|
84
90
|
drop_table <%= @carousel_items_table_name %>
|
91
|
+
drop_table <%= @alerts_table_name %>
|
85
92
|
end
|
86
93
|
|
87
94
|
end
|
data/lib/effective_pages.rb
CHANGED
@@ -7,7 +7,7 @@ require 'effective_pages/version'
|
|
7
7
|
module EffectivePages
|
8
8
|
def self.config_keys
|
9
9
|
[
|
10
|
-
:pages_table_name, :page_sections_table_name, :page_banners_table_name, :carousel_items_table_name,
|
10
|
+
:pages_table_name, :page_sections_table_name, :page_banners_table_name, :carousel_items_table_name, :alerts_table_name,
|
11
11
|
:pages_path, :excluded_pages, :layouts_path, :excluded_layouts,
|
12
12
|
:site_og_image, :site_og_image_width, :site_og_image_height,
|
13
13
|
:site_title, :site_title_suffix, :fallback_meta_description, :google_analytics_code,
|
@@ -24,6 +24,7 @@ module EffectivePages
|
|
24
24
|
@page_sections_table_name = ':' + EffectivePages.page_sections_table_name.to_s
|
25
25
|
@page_banners_table_name = ':' + EffectivePages.page_banners_table_name.to_s
|
26
26
|
@carousel_items_table_name = ':' + EffectivePages.carousel_items_table_name.to_s
|
27
|
+
@alerts_table_name = ':' + EffectivePages.alerts_table_name.to_s
|
27
28
|
|
28
29
|
migration_template ('../' * 3) + 'db/migrate/01_create_effective_pages.rb.erb', 'db/migrate/create_effective_pages.rb'
|
29
30
|
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.
|
4
|
+
version: 3.5.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: 2023-
|
11
|
+
date: 2023-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -78,26 +78,32 @@ files:
|
|
78
78
|
- app/assets/config/effective_pages_manifest.js
|
79
79
|
- app/assets/javascripts/effective_pages.js
|
80
80
|
- app/assets/javascripts/effective_pages/google_analytics.js
|
81
|
+
- app/controllers/admin/alerts_controller.rb
|
81
82
|
- app/controllers/admin/carousel_items_controller.rb
|
82
83
|
- app/controllers/admin/menus_controller.rb
|
83
84
|
- app/controllers/admin/page_banners_controller.rb
|
84
85
|
- app/controllers/admin/page_sections_controller.rb
|
85
86
|
- app/controllers/admin/pages_controller.rb
|
86
87
|
- app/controllers/effective/pages_controller.rb
|
88
|
+
- app/datatables/effective_alerts_datatable.rb
|
87
89
|
- app/datatables/effective_carousel_items_datatable.rb
|
88
90
|
- app/datatables/effective_page_banners_datatable.rb
|
89
91
|
- app/datatables/effective_page_sections_datatable.rb
|
90
92
|
- app/datatables/effective_pages_datatable.rb
|
91
93
|
- app/datatables/effective_pages_menu_datatable.rb
|
94
|
+
- app/helpers/effective_alerts_helper.rb
|
92
95
|
- app/helpers/effective_carousels_helper.rb
|
93
96
|
- app/helpers/effective_menus_helper.rb
|
94
97
|
- app/helpers/effective_page_banners_helper.rb
|
95
98
|
- app/helpers/effective_page_sections_helper.rb
|
96
99
|
- app/helpers/effective_pages_helper.rb
|
100
|
+
- app/models/effective/alert.rb
|
97
101
|
- app/models/effective/carousel_item.rb
|
98
102
|
- app/models/effective/page.rb
|
99
103
|
- app/models/effective/page_banner.rb
|
100
104
|
- app/models/effective/page_section.rb
|
105
|
+
- app/views/admin/alerts/_form.html.haml
|
106
|
+
- app/views/admin/alerts/_form_alert.html.haml
|
101
107
|
- app/views/admin/carousel_items/_form.html.haml
|
102
108
|
- app/views/admin/carousel_items/_form_carousel_item.html.haml
|
103
109
|
- app/views/admin/carousel_items/index.html.haml
|
@@ -112,6 +118,7 @@ files:
|
|
112
118
|
- app/views/admin/pages/_form_menu.html.haml
|
113
119
|
- app/views/admin/pages/_form_page.html.haml
|
114
120
|
- app/views/admin/pages/_rich_text_areas.html.haml
|
121
|
+
- app/views/effective/alerts/_alert.html.haml
|
115
122
|
- app/views/effective/carousels/_carousel.html.haml
|
116
123
|
- app/views/effective/pages/_menu.html.haml
|
117
124
|
- app/views/effective/pages/_page_menu.html.haml
|