panda-cms 0.7.3 → 0.7.5
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 +40 -5
- data/Rakefile +2 -0
- data/app/assets/builds/panda.cms.css +2 -6
- data/app/assets/tailwind/application.css +178 -0
- data/app/assets/tailwind/tailwind.config.js +15 -0
- data/app/builders/panda/cms/form_builder.rb +27 -36
- data/app/components/panda/cms/admin/flash_message_component.html.erb +2 -2
- data/app/components/panda/cms/admin/heading_component.rb +5 -4
- data/app/components/panda/cms/admin/panel_component.rb +2 -2
- data/app/components/panda/cms/admin/statistics_component.rb +1 -2
- data/app/components/panda/cms/admin/user_activity_component.html.erb +3 -1
- data/app/components/panda/cms/admin/user_activity_component.rb +8 -21
- data/app/components/panda/cms/code_component.rb +8 -4
- data/app/components/panda/cms/menu_component.rb +7 -6
- data/app/components/panda/cms/page_menu_component.rb +15 -17
- data/app/components/panda/cms/rich_text_component.rb +5 -6
- data/app/components/panda/cms/text_component.rb +6 -7
- data/app/constraints/panda/cms/admin_constraint.rb +4 -1
- data/app/controllers/panda/cms/admin/block_contents_controller.rb +0 -1
- data/app/controllers/panda/cms/admin/dashboard_controller.rb +13 -9
- data/app/controllers/panda/cms/admin/forms_controller.rb +0 -3
- data/app/controllers/panda/cms/admin/my_profile_controller.rb +44 -0
- data/app/controllers/panda/cms/admin/pages_controller.rb +15 -4
- data/app/controllers/panda/cms/admin/posts_controller.rb +6 -22
- data/app/controllers/panda/cms/admin/sessions_controller.rb +3 -5
- data/app/controllers/panda/cms/admin/settings/bulk_editor_controller.rb +32 -25
- data/app/controllers/panda/cms/admin/settings_controller.rb +14 -10
- data/app/controllers/panda/cms/application_controller.rb +7 -2
- data/app/controllers/panda/cms/errors_controller.rb +5 -2
- data/app/controllers/panda/cms/form_submissions_controller.rb +4 -0
- data/app/controllers/panda/cms/pages_controller.rb +40 -35
- data/app/controllers/panda/cms/posts_controller.rb +2 -0
- data/app/helpers/panda/cms/admin/files_helper.rb +5 -1
- data/app/helpers/panda/cms/admin/pages_helper.rb +5 -1
- data/app/helpers/panda/cms/asset_helper.rb +182 -0
- data/app/helpers/panda/cms/pages_helper.rb +2 -0
- data/app/helpers/panda/cms/posts_helper.rb +2 -0
- data/app/helpers/panda/cms/theme_helper.rb +2 -0
- data/app/javascript/panda/cms/controllers/editor_form_controller.js +59 -6
- data/app/javascript/panda/cms/controllers/index.js +5 -9
- data/app/javascript/panda/cms/controllers/slug_controller.js +64 -31
- data/app/javascript/panda/cms/controllers/theme_form_controller.js +25 -0
- data/app/javascript/panda/cms/stimulus-loading.js +39 -0
- data/app/javascript/panda_cms/stimulus-loading.js +39 -0
- data/app/jobs/panda/cms/application_job.rb +2 -0
- data/app/jobs/panda/cms/record_visit_job.rb +14 -14
- data/app/mailers/panda/cms/application_mailer.rb +2 -0
- data/app/mailers/panda/cms/form_mailer.rb +3 -1
- data/app/models/panda/cms/application_record.rb +3 -0
- data/app/models/panda/cms/block.rb +12 -17
- data/app/models/panda/cms/block_content.rb +7 -6
- data/app/models/panda/cms/breadcrumb.rb +2 -0
- data/app/models/panda/cms/current.rb +2 -0
- data/app/models/panda/cms/form.rb +2 -0
- data/app/models/panda/cms/form_submission.rb +2 -0
- data/app/models/panda/cms/menu.rb +12 -9
- data/app/models/panda/cms/menu_item.rb +10 -6
- data/app/models/panda/cms/page.rb +31 -16
- data/app/models/panda/cms/post.rb +12 -10
- data/app/models/panda/cms/redirect.rb +9 -1
- data/app/models/panda/cms/template.rb +17 -13
- data/app/models/panda/cms/user.rb +2 -0
- data/app/models/panda/cms/visit.rb +3 -1
- data/app/models/panda/social/instagram_post.rb +17 -0
- data/app/services/panda/cms/html_to_editor_js_converter.rb +10 -15
- data/app/services/panda/social/instagram_feed_service.rb +63 -0
- data/app/views/layouts/different_page.html.erb +6 -0
- data/app/views/layouts/homepage.html.erb +37 -0
- data/app/views/layouts/page.html.erb +18 -0
- data/app/views/layouts/panda/cms/application.html.erb +1 -0
- data/app/views/panda/cms/admin/my_profile/edit.html.erb +35 -0
- data/app/views/panda/cms/admin/pages/index.html.erb +1 -1
- data/app/views/panda/cms/admin/pages/new.html.erb +14 -8
- data/app/views/panda/cms/admin/posts/_form.html.erb +10 -0
- data/app/views/panda/cms/admin/posts/edit.html.erb +3 -2
- data/app/views/panda/cms/admin/posts/index.html.erb +1 -1
- data/app/views/panda/cms/admin/settings/index.html.erb +3 -1
- data/app/views/panda/cms/admin/shared/_sidebar.html.erb +1 -1
- data/app/views/panda/cms/shared/_header.html.erb +14 -4
- data/app/views/panda/cms/shared/_importmap.html.erb +2 -1
- data/app/views/shared/_footer.html.erb +3 -0
- data/app/views/shared/_header.html.erb +11 -0
- data/config/importmap.rb +2 -0
- data/config/initializers/inflections.rb +2 -0
- data/config/initializers/panda/cms/form_errors.rb +20 -21
- data/config/initializers/panda/cms/healthcheck_log_silencer.rb +2 -0
- data/config/initializers/panda/cms.rb +2 -0
- data/config/initializers/zeitwork.rb +2 -0
- data/config/locales/en.yml +5 -0
- data/config/puma/test.rb +3 -1
- data/config/routes.rb +11 -8
- data/db/migrate/20240205223709_create_panda_cms_pages.rb +2 -0
- data/db/migrate/20240219213327_create_panda_cms_page_versions.rb +2 -0
- data/db/migrate/20240303002805_create_panda_cms_templates.rb +4 -1
- data/db/migrate/20240303003434_create_panda_cms_template_versions.rb +2 -0
- data/db/migrate/20240303022441_create_panda_cms_blocks.rb +4 -1
- data/db/migrate/20240303024256_create_panda_cms_block_contents.rb +2 -0
- data/db/migrate/20240303024746_create_panda_cms_block_content_versions.rb +2 -0
- data/db/migrate/20240303233238_add_panda_cms_menu_table.rb +2 -0
- data/db/migrate/20240303234724_add_panda_cms_menu_item_table.rb +2 -0
- data/db/migrate/20240304134343_add_parent_id_to_panda_cms_pages.rb +2 -0
- data/db/migrate/20240315125411_add_status_to_panda_cms_pages.rb +7 -5
- data/db/migrate/20240315125421_add_nested_sets_to_panda_cms_pages.rb +2 -0
- data/db/migrate/20240316212822_add_kind_to_panda_cms_menus.rb +3 -1
- data/db/migrate/20240316221425_add_start_page_to_panda_cms_menus.rb +2 -0
- data/db/migrate/20240316230706_add_nested_to_panda_cms_menu_items.rb +2 -0
- data/db/migrate/20240317010532_create_panda_cms_users.rb +2 -0
- data/db/migrate/20240317161534_add_max_uses_to_panda_cms_template.rb +2 -0
- data/db/migrate/20240317163053_reset_counter_cache_on_panda_cms_template.rb +2 -0
- data/db/migrate/20240317214827_create_panda_cms_redirects.rb +2 -0
- data/db/migrate/20240317230622_create_panda_cms_visits.rb +2 -0
- data/db/migrate/20240324205703_create_active_storage_tables.active_storage.rb +5 -2
- data/db/migrate/20240408084718_default_panda_cms_users_admin_to_false.rb +2 -0
- data/db/migrate/20240701225422_add_service_name_to_active_storage_blobs.active_storage.rb +8 -6
- data/db/migrate/20240701225423_create_active_storage_variant_records.active_storage.rb +2 -0
- data/db/migrate/20240701225424_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +2 -0
- data/db/migrate/20240804235210_create_panda_cms_forms.rb +2 -0
- data/db/migrate/20240805013612_create_panda_cms_form_submissions.rb +2 -0
- data/db/migrate/20240805121123_create_panda_cms_posts.rb +3 -1
- data/db/migrate/20240805123104_create_panda_cms_post_versions.rb +2 -0
- data/db/migrate/20240806112735_fix_panda_cms_visits_column_names.rb +2 -0
- data/db/migrate/20240806204412_add_completion_path_to_panda_cms_forms.rb +2 -0
- data/db/migrate/20240820081917_change_form_submissions_to_submission_count.rb +2 -0
- data/db/migrate/20240923234535_add_depth_to_panda_cms_menus.rb +6 -4
- data/db/migrate/20241031205109_add_cached_content_to_panda_cms_block_contents.rb +2 -0
- data/db/migrate/20241119214548_convert_post_content_to_editor_js.rb +2 -0
- data/db/migrate/20241120000419_remove_post_tag_references.rb +2 -0
- data/db/migrate/20241120110943_add_editor_js_to_posts.rb +2 -0
- data/db/migrate/20241120113859_add_cached_content_to_panda_cms_posts.rb +2 -0
- data/db/migrate/20241123234140_remove_post_tag_id_from_posts.rb +2 -0
- data/db/migrate/20250106223303_add_author_id_to_panda_cms_posts.rb +2 -0
- data/db/migrate/20250120235542_remove_paper_trail.rb +56 -0
- data/db/migrate/20250126234001_create_panda_social_instagram_posts.rb +16 -0
- data/db/migrate/20250504221812_add_current_theme_to_panda_cms_users.rb +7 -0
- data/db/seeds.rb +2 -0
- data/lib/generators/panda/cms/install_generator.rb +2 -0
- data/lib/panda/cms/asset_loader.rb +390 -0
- data/lib/panda/cms/bulk_editor.rb +7 -3
- data/lib/panda/cms/demo_site_generator.rb +27 -4
- data/lib/panda/cms/editor_js/blocks/alert.rb +2 -0
- data/lib/panda/cms/editor_js/blocks/base.rb +2 -0
- data/lib/panda/cms/editor_js/blocks/header.rb +2 -0
- data/lib/panda/cms/editor_js/blocks/image.rb +3 -0
- data/lib/panda/cms/editor_js/blocks/list.rb +2 -0
- data/lib/panda/cms/editor_js/blocks/paragraph.rb +3 -0
- data/lib/panda/cms/editor_js/blocks/quote.rb +3 -0
- data/lib/panda/cms/editor_js/blocks/table.rb +3 -1
- data/lib/panda/cms/editor_js/renderer.rb +3 -0
- data/lib/panda/cms/editor_js.rb +2 -0
- data/lib/panda/cms/editor_js_content.rb +50 -23
- data/lib/panda/cms/engine.rb +36 -37
- data/lib/panda/cms/exceptions_app.rb +2 -0
- data/lib/panda/cms/railtie.rb +2 -0
- data/lib/panda/cms/slug.rb +3 -1
- data/lib/panda-cms/version.rb +3 -1
- data/lib/panda-cms.rb +17 -2
- data/lib/tasks/assets.rake +547 -0
- data/lib/tasks/panda/cms/install.rake +25 -0
- data/lib/tasks/panda/social/instagram.rake +20 -0
- data/lib/tasks/panda_cms.rake +3 -30
- data/public/panda-cms-assets/editor-js/core/editorjs.min.js +83 -0
- data/public/panda-cms-assets/editor-js/plugins/embed.min.js +2 -0
- data/public/panda-cms-assets/editor-js/plugins/header.min.js +9 -0
- data/public/panda-cms-assets/editor-js/plugins/nested-list.min.js +2 -0
- data/public/panda-cms-assets/editor-js/plugins/paragraph.min.js +9 -0
- data/public/panda-cms-assets/editor-js/plugins/quote.min.js +2 -0
- data/public/panda-cms-assets/editor-js/plugins/simple-image.min.js +2 -0
- data/public/panda-cms-assets/editor-js/plugins/table.min.js +2 -0
- data/public/panda-cms-assets/manifest.json +20 -0
- data/public/panda-cms-assets/panda-cms-0.7.4.css +26 -0
- data/public/panda-cms-assets/panda-cms-0.7.4.js +150 -0
- metadata +71 -438
- data/app/models/action_text/rich_text_version.rb +0 -6
- data/app/models/panda/cms/block_content_version.rb +0 -8
- data/app/models/panda/cms/page_version.rb +0 -8
- data/app/models/panda/cms/post_version.rb +0 -8
- data/app/models/panda/cms/template_version.rb +0 -8
- data/app/models/panda/cms/version.rb +0 -8
- data/config/initializers/panda/cms/paper_trail.rb +0 -7
- data/db/migrate/20240904200605_create_action_text_tables.action_text.rb +0 -24
- data/db/migrate/20241119214549_remove_action_text_from_posts.rb +0 -9
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panda
|
2
4
|
module CMS
|
3
5
|
module EditorJs
|
@@ -23,7 +25,7 @@ module Panda
|
|
23
25
|
index = 0
|
24
26
|
|
25
27
|
while index < content.length
|
26
|
-
rows << if index
|
28
|
+
rows << if index.zero? && with_headings
|
27
29
|
render_header_row(content[index])
|
28
30
|
else
|
29
31
|
render_data_row(content[index])
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "sanitize"
|
2
4
|
|
3
5
|
module Panda
|
@@ -60,6 +62,7 @@ module Panda
|
|
60
62
|
# Only allow the exact valid content we expect
|
61
63
|
valid_content = '<figure class="text-left"><blockquote><p>Valid HTML</p></blockquote><figcaption>Valid caption</figcaption></figure>'
|
62
64
|
return html if html.strip == valid_content.strip
|
65
|
+
|
63
66
|
return ""
|
64
67
|
end
|
65
68
|
|
data/lib/panda/cms/editor_js.rb
CHANGED
@@ -1,34 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "json"
|
2
4
|
|
3
|
-
module Panda
|
4
|
-
|
5
|
+
module Panda
|
6
|
+
module CMS
|
7
|
+
module EditorJsContent
|
8
|
+
extend ActiveSupport::Concern
|
5
9
|
|
6
|
-
|
7
|
-
|
8
|
-
|
10
|
+
included do
|
11
|
+
include ActiveModel::Validations
|
12
|
+
include ActiveModel::Callbacks
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
before_save :generate_cached_content
|
15
|
+
end
|
16
|
+
|
17
|
+
def content=(value)
|
18
|
+
if value.is_a?(Hash)
|
19
|
+
super(value.to_json)
|
20
|
+
else
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def content
|
26
|
+
value = super
|
27
|
+
if value.is_a?(String)
|
28
|
+
begin
|
29
|
+
JSON.parse(value)
|
30
|
+
rescue JSON::ParserError
|
31
|
+
value
|
32
|
+
end
|
33
|
+
else
|
34
|
+
value
|
35
|
+
end
|
36
|
+
end
|
12
37
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
38
|
+
def generate_cached_content
|
39
|
+
if content.is_a?(String)
|
40
|
+
begin
|
41
|
+
parsed_content = JSON.parse(content)
|
42
|
+
self.cached_content = if parsed_content.is_a?(Hash) && parsed_content["blocks"].present?
|
43
|
+
Panda::CMS::EditorJs::Renderer.new(parsed_content).render
|
44
|
+
else
|
45
|
+
content
|
46
|
+
end
|
47
|
+
rescue JSON::ParserError
|
48
|
+
# If it's not JSON, treat it as plain text
|
49
|
+
self.cached_content = content
|
50
|
+
end
|
51
|
+
elsif content.is_a?(Hash) && content["blocks"].present?
|
52
|
+
# Process EditorJS content
|
53
|
+
self.cached_content = Panda::CMS::EditorJs::Renderer.new(content).render
|
19
54
|
else
|
20
|
-
|
55
|
+
# For any other case, store as is
|
56
|
+
self.cached_content = content.to_s
|
21
57
|
end
|
22
|
-
rescue JSON::ParserError
|
23
|
-
# If it's not JSON, treat it as plain text
|
24
|
-
self.cached_content = content
|
25
58
|
end
|
26
|
-
elsif content.is_a?(Hash) && content["blocks"].present?
|
27
|
-
# Process EditorJS content
|
28
|
-
self.cached_content = Panda::CMS::EditorJs::Renderer.new(content).render
|
29
|
-
else
|
30
|
-
# For any other case, store as is
|
31
|
-
self.cached_content = content.to_s
|
32
59
|
end
|
33
60
|
end
|
34
61
|
end
|
data/lib/panda/cms/engine.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "rubygems"
|
2
4
|
require "panda/core"
|
5
|
+
require "panda/core/engine"
|
3
6
|
require "panda/cms/railtie"
|
4
7
|
|
8
|
+
require "invisible_captcha"
|
9
|
+
|
5
10
|
module Panda
|
6
11
|
module CMS
|
7
12
|
class Engine < ::Rails::Engine
|
8
13
|
isolate_namespace Panda::CMS
|
9
|
-
engine_name "panda-cms"
|
10
14
|
|
11
15
|
# Add services directory to autoload paths
|
12
16
|
config.autoload_paths += %W[
|
@@ -14,10 +18,8 @@ module Panda
|
|
14
18
|
]
|
15
19
|
|
16
20
|
# Basic session setup only
|
17
|
-
initializer "
|
18
|
-
if app.config.middleware.frozen?
|
19
|
-
app.config.middleware = app.config.middleware.dup
|
20
|
-
end
|
21
|
+
initializer "panda_cms.session", before: :load_config_initializers do |app|
|
22
|
+
app.config.middleware = app.config.middleware.dup if app.config.middleware.frozen?
|
21
23
|
|
22
24
|
app.config.session_store :cookie_store, key: "_panda_cms_session"
|
23
25
|
app.config.middleware.use ActionDispatch::Cookies
|
@@ -26,18 +28,19 @@ module Panda
|
|
26
28
|
|
27
29
|
config.to_prepare do
|
28
30
|
ApplicationController.helper(::ApplicationHelper)
|
31
|
+
ApplicationController.helper(Panda::CMS::AssetHelper)
|
29
32
|
end
|
30
33
|
|
31
34
|
# Set our generators
|
32
35
|
config.generators do |g|
|
33
36
|
g.orm :active_record, primary_key_type: :uuid
|
34
37
|
g.test_framework :rspec, fixture: true
|
35
|
-
g.fixture_replacement
|
38
|
+
g.fixture_replacement nil
|
36
39
|
g.view_specs false
|
37
|
-
g.templates.unshift File.expand_path("
|
40
|
+
g.templates.unshift File.expand_path("../templates", __dir__)
|
38
41
|
end
|
39
42
|
|
40
|
-
# Make files in public available to the main app (e.g. /
|
43
|
+
# Make files in public available to the main app (e.g. /panda_cms-assets/favicon.ico)
|
41
44
|
config.app_middleware.use(
|
42
45
|
Rack::Static,
|
43
46
|
urls: ["/panda-cms-assets"],
|
@@ -47,7 +50,7 @@ module Panda
|
|
47
50
|
# Custom error handling
|
48
51
|
# config.exceptions_app = Panda::CMS::ExceptionsApp.new(exceptions_app: routes)
|
49
52
|
|
50
|
-
initializer "
|
53
|
+
initializer "panda_cms.assets" do |app|
|
51
54
|
if Rails.configuration.respond_to?(:assets)
|
52
55
|
# Add JavaScript paths
|
53
56
|
app.config.assets.paths << root.join("app/javascript")
|
@@ -65,12 +68,10 @@ module Panda
|
|
65
68
|
end
|
66
69
|
|
67
70
|
# Add importmap paths from the engine
|
68
|
-
initializer "
|
71
|
+
initializer "panda_cms.importmap", before: "importmap" do |app|
|
69
72
|
if app.config.respond_to?(:importmap)
|
70
73
|
# Create a new array if frozen
|
71
|
-
if app.config.importmap.paths.frozen?
|
72
|
-
app.config.importmap.paths = app.config.importmap.paths.dup
|
73
|
-
end
|
74
|
+
app.config.importmap.paths = app.config.importmap.paths.dup if app.config.importmap.paths.frozen?
|
74
75
|
|
75
76
|
# Add our paths
|
76
77
|
app.config.importmap.paths << root.join("config/importmap.rb")
|
@@ -94,13 +95,13 @@ module Panda
|
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
97
|
-
initializer "#{engine_name}.backtrace_cleaner" do |
|
98
|
+
initializer "#{engine_name}.backtrace_cleaner" do |_app|
|
98
99
|
engine_root_regex = Regexp.escape(root.to_s + File::SEPARATOR)
|
99
100
|
|
100
101
|
# Clean those ERB lines, we don't need the internal autogenerated
|
101
102
|
# ERB method, what we do need (line number in ERB file) is already there
|
102
103
|
Rails.backtrace_cleaner.add_filter do |line|
|
103
|
-
line.sub(/(\.erb:\d+):in `__.*$/,
|
104
|
+
line.sub(/(\.erb:\d+):in `__.*$/, '\\1')
|
104
105
|
end
|
105
106
|
|
106
107
|
# Remove our own engine's path prefix, even if it's
|
@@ -122,15 +123,13 @@ module Panda
|
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
125
|
-
# Set up ViewComponent
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
# config.view_component.preview_paths << Panda::CMS::Engine.root.join("lib/component_previews").to_s
|
133
|
-
# config.view_component.generate.preview_path = "lib/component_previews"
|
126
|
+
# Set up ViewComponent
|
127
|
+
initializer "panda_cms.view_component" do |app|
|
128
|
+
app.config.view_component.preview_paths ||= []
|
129
|
+
app.config.view_component.preview_paths << root.join("spec/components/previews")
|
130
|
+
app.config.view_component.generate.sidecar = true
|
131
|
+
app.config.view_component.generate.preview = true
|
132
|
+
end
|
134
133
|
|
135
134
|
# Set up authentication
|
136
135
|
initializer "panda_cms.omniauth", before: "omniauth" do |app|
|
@@ -214,26 +213,26 @@ module Panda
|
|
214
213
|
}
|
215
214
|
|
216
215
|
available_providers.each do |provider, options|
|
217
|
-
|
218
|
-
|
219
|
-
|
216
|
+
next unless Panda::CMS.config.authentication.dig(provider, :enabled)
|
217
|
+
|
218
|
+
auth_path = auth_path.starts_with?("/") ? auth_path : "/#{auth_path}"
|
219
|
+
options[:defaults][:path_prefix] = auth_path
|
220
220
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
221
|
+
options[:defaults][:redirect_uri] = if Rails.env.test?
|
222
|
+
"#{Capybara.app_host}#{auth_path}/#{provider}#{callback_path}"
|
223
|
+
else
|
224
|
+
"#{Panda::CMS.config.url}#{auth_path}/#{provider}#{callback_path}"
|
225
|
+
end
|
226
226
|
|
227
|
-
|
227
|
+
provider_config = options[:defaults].merge(Panda::CMS.config.authentication[provider])
|
228
228
|
|
229
|
-
|
230
|
-
|
231
|
-
end
|
229
|
+
app.config.middleware.use OmniAuth::Builder do
|
230
|
+
provider options[:strategy], provider_config
|
232
231
|
end
|
233
232
|
end
|
234
233
|
end
|
235
234
|
|
236
|
-
config.before_initialize do |
|
235
|
+
config.before_initialize do |_app|
|
237
236
|
# Default configuration
|
238
237
|
Panda::CMS.configure do |config|
|
239
238
|
# Array of additional EditorJS tools to load
|
data/lib/panda/cms/railtie.rb
CHANGED
data/lib/panda/cms/slug.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panda
|
2
4
|
module CMS
|
3
5
|
class Slug
|
@@ -13,7 +15,7 @@ module Panda
|
|
13
15
|
# Replace & with "and"
|
14
16
|
string = string.gsub("&", "and")
|
15
17
|
# Remove special characters
|
16
|
-
string = string.gsub(
|
18
|
+
string = string.gsub(%r{[!@£\\\^\[\]/]+}, "")
|
17
19
|
# Replace any whitespace character with -
|
18
20
|
string = string.gsub(/[^\w\s-]/, "-")
|
19
21
|
# Replace multiple occurences of _ and - with -
|
data/lib/panda-cms/version.rb
CHANGED
data/lib/panda-cms.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "rubygems"
|
2
4
|
require "panda/core"
|
3
5
|
require "panda/cms/railtie"
|
4
|
-
|
5
|
-
require "capybara/rspec"
|
6
|
+
require "view_component"
|
6
7
|
|
7
8
|
module Panda
|
8
9
|
module CMS
|
@@ -18,6 +19,19 @@ module Panda
|
|
18
19
|
setting :editor_js_tools, default: []
|
19
20
|
setting :editor_js_tool_config, default: {}
|
20
21
|
|
22
|
+
setting :instagram, default: {
|
23
|
+
enabled: false,
|
24
|
+
username: nil,
|
25
|
+
access_token: nil
|
26
|
+
}
|
27
|
+
|
28
|
+
setting :analytics, default: {
|
29
|
+
google_analytics: {
|
30
|
+
enabled: false,
|
31
|
+
tracking_id: nil
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
21
35
|
def self.root_path
|
22
36
|
config.admin_path
|
23
37
|
end
|
@@ -60,6 +74,7 @@ require_relative "panda-cms/version"
|
|
60
74
|
require_relative "panda/cms/exceptions_app"
|
61
75
|
require_relative "panda/cms/engine"
|
62
76
|
require_relative "panda/cms/demo_site_generator"
|
77
|
+
require_relative "panda/cms/asset_loader"
|
63
78
|
require_relative "panda/cms/editor_js"
|
64
79
|
require_relative "panda/cms/editor_js_content"
|
65
80
|
require_relative "panda/cms/editor_js/renderer"
|