integral 1.3.0 → 1.4.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 -30
- data/Rakefile +1 -1
- data/app/assets/images/integral/defaults/no_image_available.jpg +0 -0
- data/app/assets/javascripts/integral/backend.js +102 -11
- data/app/assets/javascripts/integral/frontend.js +37 -0
- data/app/assets/javascripts/integral/support/confirm_modal.coffee +2 -2
- data/app/assets/javascripts/integral/support/gallery.coffee +71 -54
- data/app/assets/javascripts/integral/support/lib/lazysizes.js +755 -0
- data/app/assets/javascripts/integral/support/lib/materialize-tags.js +49 -44
- data/app/assets/javascripts/integral/support/ls.instagram.js +57 -0
- data/app/assets/javascripts/integral/support/ls.twitter.js +66 -0
- data/app/assets/javascripts/integral/support/record_selector.coffee +1 -1
- data/app/assets/javascripts/integral/support/remote_form.coffee +5 -2
- data/app/assets/stylesheets/integral/backend.sass +2 -1
- data/app/assets/stylesheets/integral/backend/_foundation_settings.scss +3 -4
- data/app/assets/stylesheets/integral/backend/dashboard-layout.scss +4 -1
- data/app/assets/stylesheets/integral/backend/materialize-tags.sass +1 -1
- data/app/assets/stylesheets/integral/backend/modules/timeline.scss +214 -0
- data/app/assets/stylesheets/integral/backend/shared.sass +80 -11
- data/app/assets/stylesheets/integral/frontend.scss +45 -0
- data/app/assets/stylesheets/integral/frontend/_foundation_settings.scss +2 -2
- data/app/assets/stylesheets/integral/frontend/blog.sass +155 -142
- data/app/assets/stylesheets/integral/frontend/layout.sass +3 -3
- data/app/assets/stylesheets/integral/frontend/modules/article-footer.scss +55 -0
- data/app/assets/stylesheets/integral/frontend/modules/article.scss +34 -0
- data/app/assets/stylesheets/integral/frontend/modules/horizontal-post.scss +44 -0
- data/app/assets/stylesheets/integral/frontend/modules/inline-articles.scss +23 -0
- data/app/assets/stylesheets/integral/frontend/modules/latest-post.scss +37 -0
- data/app/assets/stylesheets/integral/frontend/modules/list-widget.scss +50 -0
- data/app/assets/stylesheets/integral/frontend/modules/piped-list.scss +33 -0
- data/app/assets/stylesheets/integral/frontend/modules/post-tags.scss +19 -0
- data/app/assets/stylesheets/integral/frontend/modules/scroll-container.scss +9 -0
- data/app/assets/stylesheets/integral/frontend/modules/sidebar-articles.scss +42 -0
- data/app/assets/stylesheets/integral/frontend/modules/sidebar-tags.scss +6 -0
- data/app/assets/stylesheets/integral/frontend/modules/sidebar-widget.scss +47 -0
- data/app/assets/stylesheets/integral/frontend/modules/vertical-post.scss +31 -0
- data/app/assets/stylesheets/integral/frontend/share_modal.sass +0 -5
- data/app/assets/stylesheets/integral/support/gallery.sass +8 -0
- data/app/assets/stylesheets/integral/support/media-query-indicator.sass +6 -0
- data/app/controllers/integral/application_controller.rb +7 -1
- data/app/controllers/integral/backend/activities_controller.rb +13 -2
- data/app/controllers/integral/backend/base_controller.rb +60 -7
- data/app/controllers/integral/backend/categories_controller.rb +49 -0
- data/app/controllers/integral/backend/pages_controller.rb +7 -2
- data/app/controllers/integral/backend/posts_controller.rb +8 -3
- data/app/controllers/integral/backend/static_pages_controller.rb +4 -0
- data/app/controllers/integral/backend/users_controller.rb +13 -7
- data/app/controllers/integral/categories_controller.rb +31 -0
- data/app/controllers/integral/pages_controller.rb +1 -1
- data/app/controllers/integral/posts_controller.rb +5 -3
- data/app/decorators/integral/category_decorator.rb +30 -0
- data/app/decorators/integral/category_version_decorator.rb +7 -0
- data/app/decorators/integral/image_version_decorator.rb +7 -0
- data/app/decorators/integral/list_decorator.rb +1 -1
- data/app/decorators/integral/list_version_decorator.rb +7 -0
- data/app/decorators/integral/page_version_decorator.rb +7 -0
- data/app/decorators/integral/post_decorator.rb +9 -1
- data/app/decorators/integral/post_version_decorator.rb +7 -0
- data/app/decorators/integral/user_decorator.rb +1 -1
- data/app/decorators/integral/user_version_decorator.rb +7 -0
- data/app/decorators/integral/version_decorator.rb +51 -12
- data/app/helpers/integral/backend/base_helper.rb +56 -2
- data/app/helpers/integral/blog_helper.rb +21 -4
- data/app/jobs/integral/webhook/delivery_job.rb +37 -0
- data/app/mailers/integral/contact_mailer.rb +4 -1
- data/app/models/concerns/integral/lazy_contentable.rb +54 -0
- data/app/models/concerns/integral/webhook/delivery.rb +30 -0
- data/app/models/concerns/integral/webhook/observable.rb +23 -0
- data/app/models/integral/category.rb +20 -0
- data/app/models/integral/category_version.rb +8 -0
- data/app/models/integral/list_item.rb +1 -2
- data/app/models/integral/page.rb +18 -3
- data/app/models/integral/post.rb +28 -1
- data/app/models/integral/version.rb +2 -2
- data/app/models/integral/webhook/endpoint.rb +40 -0
- data/app/models/integral/webhook/event.rb +20 -0
- data/app/policies/integral/base_policy.rb +1 -0
- data/app/policies/integral/category_policy.rb +9 -0
- data/app/serializers/integral/post_serializer.rb +24 -0
- data/app/uploaders/integral/avatar_uploader.rb +1 -1
- data/app/views/integral/backend/activities/_activity.haml +21 -0
- data/app/views/integral/backend/activities/_grid.haml +1 -2
- data/app/views/integral/backend/activities/shared/_grid.haml +3 -2
- data/app/views/integral/backend/activities/shared/{_listing.haml → index.haml} +1 -0
- data/app/views/integral/backend/activities/shared/{_log.haml → show.haml} +0 -0
- data/app/views/integral/backend/categories/_modal.haml +25 -0
- data/app/views/integral/backend/lists/_child_fields.haml +1 -1
- data/app/views/integral/backend/lists/_item_container.haml +1 -1
- data/app/views/integral/backend/lists/_item_modal.haml +1 -1
- data/app/views/integral/backend/lists/_list_item_fields.haml +1 -1
- data/app/views/integral/backend/pages/_form.haml +1 -4
- data/app/views/integral/backend/pages/_grid.haml +34 -9
- data/app/views/integral/backend/pages/edit.haml +9 -3
- data/app/views/integral/backend/pages/index.haml +11 -21
- data/app/views/integral/backend/pages/list.haml +22 -0
- data/app/views/integral/backend/pages/show.haml +48 -0
- data/app/views/integral/backend/posts/_form.haml +8 -6
- data/app/views/integral/backend/posts/_grid.haml +33 -7
- data/app/views/integral/backend/posts/index.haml +13 -19
- data/app/views/integral/backend/posts/list.haml +20 -0
- data/app/views/integral/backend/posts/show.haml +54 -0
- data/app/views/integral/backend/shared/_activity_modal.haml +13 -0
- data/app/views/integral/backend/shared/cards/_categories.haml +34 -0
- data/app/views/integral/backend/{static_pages/_card.haml → shared/cards/_object.haml} +0 -0
- data/app/views/integral/backend/shared/cards/_recent_activity.haml +20 -0
- data/app/views/integral/backend/shared/cards/_recent_pages.haml +19 -0
- data/app/views/integral/backend/shared/cards/_recent_posts.haml +18 -0
- data/app/views/integral/backend/shared/cards/_recent_user_activity.haml +1 -0
- data/app/views/integral/backend/shared/cards/_recent_users.haml +19 -0
- data/app/views/integral/backend/shared/cards/_top_post_authors.haml +19 -0
- data/app/views/integral/backend/shared/record_selector/_record.haml +6 -4
- data/app/views/integral/backend/static_pages/dashboard.haml +13 -11
- data/app/views/integral/backend/users/_grid.haml +24 -7
- data/app/views/integral/backend/users/index.haml +11 -17
- data/app/views/integral/backend/users/list.haml +18 -0
- data/app/views/integral/backend/users/show.haml +5 -11
- data/app/views/integral/categories/show.haml +5 -0
- data/app/views/integral/posts/_article_footer.haml +17 -0
- data/app/views/integral/posts/_card.haml +11 -0
- data/app/views/integral/posts/_latest_post.haml +8 -0
- data/app/views/integral/posts/_most_read_section.haml +8 -0
- data/app/views/integral/posts/_post.haml +11 -0
- data/app/views/integral/posts/_similar_posts.haml +5 -0
- data/app/views/integral/posts/index.haml +6 -5
- data/app/views/integral/posts/templates/default.haml +34 -33
- data/app/views/integral/shared/_subscribe_modal.haml +14 -0
- data/app/views/integral/shared/blog/_categories.haml +15 -0
- data/app/views/integral/shared/blog/_layout.haml +9 -0
- data/app/views/integral/shared/blog/_sidebar.haml +10 -0
- data/app/views/integral/shared/gallery/_placeholder.haml +1 -1
- data/app/views/integral/shared/gallery/_slide.haml +2 -2
- data/app/views/integral/shared/gallery/gallery.haml +5 -2
- data/app/views/integral/shared/sidebar/_item.haml +8 -0
- data/app/views/integral/shared/sidebar/_newsletter_signup.haml +7 -0
- data/app/views/integral/shared/sidebar/_popular_posts.haml +7 -0
- data/app/views/integral/shared/sidebar/_popular_tags.haml +7 -0
- data/app/views/integral/shared/sidebar/_recent_posts.haml +7 -0
- data/app/views/integral/tags/index.haml +2 -2
- data/app/views/integral/tags/show.haml +3 -6
- data/app/views/layouts/integral/backend.html.haml +3 -0
- data/app/views/layouts/integral/backend/_main_menu_items.haml +10 -0
- data/app/views/layouts/integral/frontend.html.haml +3 -3
- data/config/locales/en.yml +52 -49
- data/db/migrate/20190414172018_create_webhook_endpoints.rb +10 -0
- data/db/migrate/20190929191412_add_integral_post_categories.rb +13 -0
- data/db/migrate/20191203090008_add_image_to_integral_categories.rb +6 -0
- data/db/migrate/20200401210442_create_category_versions.rb +20 -0
- data/db/seeds.rb +3 -1
- data/lib/generators/integral/assets_generator.rb +2 -2
- data/lib/generators/integral/install_generator.rb +1 -1
- data/lib/generators/integral/views_generator.rb +1 -1
- data/lib/generators/templates/integral.rb +5 -0
- data/lib/integral.rb +3 -30
- data/lib/integral/acts_as_listable.rb +2 -2
- data/lib/integral/chart_renderer/base.rb +2 -0
- data/lib/integral/content_renderer.rb +2 -2
- data/lib/integral/engine.rb +2 -2
- data/lib/integral/grids/activities_grid.rb +15 -1
- data/lib/integral/list_item_renderer.rb +4 -2
- data/lib/integral/list_renderer.rb +1 -0
- data/lib/integral/middleware/page_router.rb +15 -6
- data/lib/integral/router.rb +19 -3
- data/lib/integral/version.rb +1 -1
- data/lib/integral/widgets/swiper_list.rb +3 -2
- data/public/images/integral/demo/continous-integration.png +0 -0
- data/public/images/integral/demo/foundation-frontend-framework.jpg +0 -0
- data/public/images/integral/demo/heroku.png +0 -0
- data/public/images/integral/demo/integral-cms-without-hassle.jpg +0 -0
- data/public/images/integral/demo/integral-features-activity-tracking.jpg +0 -0
- data/public/images/integral/demo/integral-features-contact-form.png +0 -0
- data/public/images/integral/demo/integral-features-design.jpg +0 -0
- data/public/images/integral/demo/integral-features-dynamic-pages.jpg +0 -0
- data/public/images/integral/demo/integral-features-image-management.jpg +0 -0
- data/public/images/integral/demo/integral-features-integrated-blog.jpg +0 -0
- data/public/images/integral/demo/integral-features-list-management.jpg +0 -0
- data/public/images/integral/demo/integral-features-seo-ready.jpg +0 -0
- data/public/images/integral/demo/integral-features-user-management.jpg +0 -0
- data/public/images/integral/demo/integral-presentation.png +0 -0
- data/spec/factories.rb +15 -7
- metadata +110 -98
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/copywidget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/editwidget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/copywidget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/editwidget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/removewidget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/widget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/removewidget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/widget.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/integral-card/plugin.js +0 -86
- data/app/assets/javascripts/ckeditor/plugins/integralrecentposts/dialogs/integralrecentposts.js +0 -40
- data/app/assets/javascripts/ckeditor/plugins/integralrecentposts/plugin.js +0 -32
- data/app/assets/javascripts/ckeditor/plugins/numericinput/LICENSE.md +0 -363
- data/app/assets/javascripts/ckeditor/plugins/numericinput/README.md +0 -16
- data/app/assets/javascripts/ckeditor/plugins/numericinput/plugin.js +0 -354
- data/app/assets/stylesheets/integral/frontend.sass +0 -25
- data/app/views/integral/backend/pages/activities.haml +0 -2
- data/app/views/integral/backend/pages/activity.haml +0 -1
- data/app/views/integral/backend/posts/activities.haml +0 -3
- data/app/views/integral/backend/posts/activity.haml +0 -1
- data/app/views/integral/posts/_collection.haml +0 -4
- data/app/views/integral/posts/_item.haml +0 -16
- data/app/views/integral/shared/_blog_layout.haml +0 -15
- data/app/views/integral/shared/_blog_sidebar.haml +0 -49
- data/lib/integral/slack_bot.rb +0 -45
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddIntegralPostCategories < ActiveRecord::Migration[5.1]
|
|
2
|
+
def change
|
|
3
|
+
create_table :integral_categories do |t|
|
|
4
|
+
t.string :title
|
|
5
|
+
t.string :description
|
|
6
|
+
t.string :slug, unique: true
|
|
7
|
+
|
|
8
|
+
t.timestamps null: false
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
add_reference :integral_posts, :category, index: true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class CreateCategoryVersions < ActiveRecord::Migration[5.2]
|
|
2
|
+
# The largest text column available in all supported RDBMS is
|
|
3
|
+
# 1024^3 - 1 bytes, roughly one gibibyte. We specify a size
|
|
4
|
+
# so that MySQL will use `longtext` instead of `text`. Otherwise,
|
|
5
|
+
# when serializing very large objects, `text` might not be big enough.
|
|
6
|
+
TEXT_BYTES = 1_073_741_823
|
|
7
|
+
|
|
8
|
+
def change
|
|
9
|
+
create_table :integral_category_versions do |t|
|
|
10
|
+
t.string :item_type, {:null=>false}
|
|
11
|
+
t.integer :item_id, null: false
|
|
12
|
+
t.string :event, null: false
|
|
13
|
+
t.string :whodunnit
|
|
14
|
+
t.text :object, limit: TEXT_BYTES
|
|
15
|
+
t.text :object_changes, limit: TEXT_BYTES
|
|
16
|
+
t.datetime :created_at
|
|
17
|
+
end
|
|
18
|
+
add_index :integral_category_versions, %i(item_type item_id)
|
|
19
|
+
end
|
|
20
|
+
end
|
data/db/seeds.rb
CHANGED
|
@@ -34,13 +34,15 @@ Integral::Page.create!(title: 'Integral CMS - Demo Page',
|
|
|
34
34
|
status: 1)
|
|
35
35
|
|
|
36
36
|
# Demo Post
|
|
37
|
+
category = Integral::Category.create!(title: 'Uncategorised', description: "Posts which we haven't yet categorized but are sure to grab your attention", slug: 'uncategorized')
|
|
37
38
|
Integral::Post.create!(title: 'Integral CMS - Demo Post',
|
|
38
39
|
description:'Integral CMS demo post. Integral is a rails content management system (CMS) which gives developers the ability to create a modern website with all the bells and whistles without the hassle.',
|
|
39
40
|
body: File.read(File.join(Integral::Engine.root.join('public', 'integral', 'ckeditor_demo_content.html'))),
|
|
40
41
|
slug: 'integral-demo',
|
|
41
42
|
user: user,
|
|
42
43
|
tag_list: 'integral-cms,example-tag',
|
|
43
|
-
status: 1
|
|
44
|
+
status: 1,
|
|
45
|
+
category: category)
|
|
44
46
|
|
|
45
47
|
# Main Menu
|
|
46
48
|
Integral::List.create!({ title: 'Main Menu', list_items: [
|
|
@@ -6,7 +6,7 @@ module Integral
|
|
|
6
6
|
# @example Generate all Integral assets
|
|
7
7
|
# rails g integral:assets --assets 'backend frontend email'
|
|
8
8
|
class AssetsGenerator < Rails::Generators::Base
|
|
9
|
-
source_root File.expand_path('
|
|
9
|
+
source_root File.expand_path('../../../app/assets', __dir__)
|
|
10
10
|
class_option :asset_list, aliases: '-a', type: :array, default: 'frontend'
|
|
11
11
|
desc 'Copies Integral assets to your application'
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ module Integral
|
|
|
24
24
|
return unless options['asset_list'].include?('frontend')
|
|
25
25
|
|
|
26
26
|
file 'javascripts/integral/frontend.js'
|
|
27
|
-
file 'stylesheets/integral/frontend.
|
|
27
|
+
file 'stylesheets/integral/frontend.scss'
|
|
28
28
|
directory 'stylesheets/integral/frontend'
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -3,7 +3,7 @@ module Integral
|
|
|
3
3
|
module Generators
|
|
4
4
|
# Runs setup for an Integral Application
|
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
|
6
|
-
source_root File.expand_path('
|
|
6
|
+
source_root File.expand_path('../templates', __dir__)
|
|
7
7
|
desc 'Creates Integral, Carrierwave, CarrierwaveBackgrounder & Sitemap initializers'
|
|
8
8
|
|
|
9
9
|
# Copies over necessary initialiser files
|
|
@@ -6,7 +6,7 @@ module Integral
|
|
|
6
6
|
# @example Generate all Integral views
|
|
7
7
|
# rails g integral:views --views 'backend frontend devise mailer'
|
|
8
8
|
class ViewsGenerator < Rails::Generators::Base
|
|
9
|
-
source_root File.expand_path('
|
|
9
|
+
source_root File.expand_path('../../../app/views', __dir__)
|
|
10
10
|
class_option :views, aliases: '-v', type: :array, default: 'frontend'
|
|
11
11
|
desc 'Copies Integral views to your application'
|
|
12
12
|
|
|
@@ -61,6 +61,11 @@ Integral.configure do |config|
|
|
|
61
61
|
#
|
|
62
62
|
# config.additional_page_templates = [:full_width]
|
|
63
63
|
|
|
64
|
+
# Add additional tracked classes to include within activity tracking
|
|
65
|
+
# Default is []
|
|
66
|
+
#
|
|
67
|
+
# config.additional_tracked_classes = [MyCustomClass]
|
|
68
|
+
|
|
64
69
|
# Configure what page paths are protected from user entry to prevent accidentally overriding
|
|
65
70
|
# config.black_listed_paths = [
|
|
66
71
|
# '/admin/',
|
data/lib/integral.rb
CHANGED
|
@@ -5,7 +5,6 @@ require 'integral/version'
|
|
|
5
5
|
require 'integral/router'
|
|
6
6
|
require 'integral/middleware/page_router'
|
|
7
7
|
require 'integral/engine'
|
|
8
|
-
require 'integral/slack_bot'
|
|
9
8
|
require 'integral/button_link_renderer'
|
|
10
9
|
require 'integral/google_tag_manager'
|
|
11
10
|
require 'integral/foundation_builder'
|
|
@@ -34,107 +33,81 @@ module Integral
|
|
|
34
33
|
yield(self)
|
|
35
34
|
end
|
|
36
35
|
|
|
37
|
-
#
|
|
38
36
|
mattr_accessor :backend_namespace
|
|
39
37
|
@@backend_namespace = 'admin'
|
|
40
38
|
|
|
41
|
-
#
|
|
42
39
|
mattr_accessor :backend_locales
|
|
43
40
|
@@backend_locales = [:en]
|
|
44
41
|
|
|
45
|
-
#
|
|
46
42
|
mattr_accessor :additional_settings_params
|
|
47
43
|
@@additional_settings_params = []
|
|
48
44
|
|
|
49
|
-
#
|
|
50
45
|
mattr_accessor :additional_widgets
|
|
51
46
|
@@additional_widgets = []
|
|
52
47
|
|
|
53
|
-
#
|
|
54
48
|
mattr_accessor :additional_post_params
|
|
55
49
|
@@additional_post_params = []
|
|
56
50
|
|
|
57
|
-
#
|
|
58
51
|
mattr_accessor :additional_page_params
|
|
59
52
|
@@additional_page_params = []
|
|
60
53
|
|
|
61
|
-
#
|
|
62
54
|
mattr_accessor :gtm_container_id
|
|
63
55
|
@@gtm_container_id = ''
|
|
64
56
|
|
|
65
|
-
#
|
|
66
57
|
mattr_accessor :blog_enabled
|
|
67
58
|
@@blog_enabled = true
|
|
68
59
|
|
|
69
|
-
#
|
|
70
60
|
mattr_accessor :blog_namespace
|
|
71
61
|
@@blog_namespace = 'blog'
|
|
72
62
|
|
|
73
|
-
#
|
|
74
63
|
mattr_accessor :black_listed_paths
|
|
75
64
|
@@black_listed_paths = ['/admin']
|
|
76
65
|
|
|
77
|
-
#
|
|
78
66
|
mattr_accessor :root_path
|
|
79
67
|
@@root_path = nil
|
|
80
68
|
|
|
81
|
-
#
|
|
82
69
|
mattr_accessor :frontend_parent_controller
|
|
83
70
|
@@frontend_parent_controller = 'Integral::ApplicationController'
|
|
84
71
|
|
|
85
|
-
#
|
|
86
72
|
mattr_accessor :editor_image_size_limit
|
|
87
73
|
@@editor_image_size_limit = [1600, 1600]
|
|
88
74
|
|
|
89
|
-
#
|
|
90
75
|
mattr_accessor :image_thumbnail_size
|
|
91
76
|
@@image_thumbnail_size = [50, 50]
|
|
92
77
|
|
|
93
|
-
#
|
|
94
78
|
mattr_accessor :image_small_size
|
|
95
79
|
@@image_small_size = [500, 500]
|
|
96
80
|
|
|
97
|
-
#
|
|
98
81
|
mattr_accessor :image_medium_size
|
|
99
82
|
@@image_medium_size = [800, 800]
|
|
100
83
|
|
|
101
|
-
#
|
|
102
84
|
mattr_accessor :image_large_size
|
|
103
85
|
@@image_large_size = [1600, 1600]
|
|
104
86
|
|
|
105
|
-
#
|
|
106
87
|
mattr_accessor :additional_page_templates
|
|
107
88
|
@@additional_page_templates = []
|
|
108
89
|
|
|
109
|
-
|
|
90
|
+
mattr_accessor :additional_tracked_classes
|
|
91
|
+
@@additional_tracked_classes = []
|
|
92
|
+
|
|
110
93
|
mattr_accessor :compression_enabled
|
|
111
94
|
@@compression_enabled = true
|
|
112
95
|
|
|
113
|
-
#
|
|
114
96
|
mattr_accessor :image_compression_quality
|
|
115
97
|
@@image_compression_quality = 85
|
|
116
98
|
|
|
117
|
-
#
|
|
118
99
|
mattr_accessor :editable_persisted_images
|
|
119
100
|
@@editable_persisted_images = false
|
|
120
101
|
|
|
121
|
-
#
|
|
122
|
-
mattr_accessor :slack_web_hook_url
|
|
123
|
-
@@slack_web_hook_url = nil
|
|
124
|
-
|
|
125
|
-
#
|
|
126
102
|
mattr_accessor :description_length_maximum
|
|
127
103
|
@@description_length_maximum = 300
|
|
128
104
|
|
|
129
|
-
#
|
|
130
105
|
mattr_accessor :description_length_minimum
|
|
131
106
|
@@description_length_minimum = 50
|
|
132
107
|
|
|
133
|
-
#
|
|
134
108
|
mattr_accessor :title_length_maximum
|
|
135
109
|
@@title_length_maximum = 60
|
|
136
110
|
|
|
137
|
-
#
|
|
138
111
|
mattr_accessor :title_length_minimum
|
|
139
112
|
@@title_length_minimum = 4
|
|
140
113
|
|
|
@@ -24,6 +24,7 @@ module Integral
|
|
|
24
24
|
data = process_data
|
|
25
25
|
|
|
26
26
|
return respond_with_chart(data) if data_available?(data)
|
|
27
|
+
|
|
27
28
|
respond_with_no_data_available
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -64,6 +65,7 @@ module Integral
|
|
|
64
65
|
data = data.map(&:uniq).uniq
|
|
65
66
|
|
|
66
67
|
return true if data.length > 1
|
|
68
|
+
|
|
67
69
|
data = data.first
|
|
68
70
|
end
|
|
69
71
|
|
|
@@ -59,8 +59,8 @@ module Integral
|
|
|
59
59
|
return widget_not_available_message unless widget.present?
|
|
60
60
|
|
|
61
61
|
widget[1].constantize.render(options)
|
|
62
|
-
rescue StandardError =>
|
|
63
|
-
respond_with_widget_error(
|
|
62
|
+
rescue StandardError => e
|
|
63
|
+
respond_with_widget_error(e)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# Handles widget errors
|
data/lib/integral/engine.rb
CHANGED
|
@@ -35,7 +35,6 @@ module Integral
|
|
|
35
35
|
# require 'before_render'
|
|
36
36
|
require 'friendly_id'
|
|
37
37
|
require 'acts-as-taggable-on'
|
|
38
|
-
require 'slack-notifier'
|
|
39
38
|
require 'paranoia'
|
|
40
39
|
require 'inky'
|
|
41
40
|
require 'premailer/rails'
|
|
@@ -43,6 +42,7 @@ module Integral
|
|
|
43
42
|
require 'will_paginate-foundation'
|
|
44
43
|
require 'rails-settings-cached'
|
|
45
44
|
require 'gaffe'
|
|
45
|
+
require 'fast_jsonapi'
|
|
46
46
|
|
|
47
47
|
isolate_namespace Integral
|
|
48
48
|
|
|
@@ -73,7 +73,7 @@ module Integral
|
|
|
73
73
|
# Allows engine factories to be reused by application
|
|
74
74
|
initializer 'model_core.factories', after: 'factory_bot.set_factory_paths' do
|
|
75
75
|
if defined?(FactoryBot)
|
|
76
|
-
FactoryBot.definition_file_paths << File.expand_path('
|
|
76
|
+
FactoryBot.definition_file_paths << File.expand_path('../../spec/factories', __dir__)
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -6,7 +6,17 @@ module Integral
|
|
|
6
6
|
include Datagrid
|
|
7
7
|
|
|
8
8
|
scope do
|
|
9
|
-
|
|
9
|
+
fields = [:id, :item_type, :item_id, :event, :whodunnit, :created_at]
|
|
10
|
+
scope = Integral::PageVersion.select(fields).all
|
|
11
|
+
|
|
12
|
+
[Integral::PostVersion,
|
|
13
|
+
Integral::CategoryVersion,
|
|
14
|
+
Integral::ListVersion,
|
|
15
|
+
Integral::ImageVersion,
|
|
16
|
+
Integral::UserVersion].concat(Integral.additional_tracked_classes.map { |klass| klass.version_class_name.constantize }).each do |version|
|
|
17
|
+
scope = scope.union(version.select(fields).all)
|
|
18
|
+
end
|
|
19
|
+
scope = scope.order('created_at DESC')
|
|
10
20
|
end
|
|
11
21
|
|
|
12
22
|
filter(:user, multiple: true) do |value|
|
|
@@ -25,6 +35,10 @@ module Integral
|
|
|
25
35
|
where(item_id: value)
|
|
26
36
|
end
|
|
27
37
|
|
|
38
|
+
filter(:created_at) do |value|
|
|
39
|
+
where("created_at < ?", value)
|
|
40
|
+
end
|
|
41
|
+
|
|
28
42
|
column(:date, order: :created_at)
|
|
29
43
|
column(:user, order: :whodunnit)
|
|
30
44
|
column(:action, order: :event)
|
|
@@ -76,6 +76,7 @@ module Integral
|
|
|
76
76
|
# TODO: Move this onto the model level
|
|
77
77
|
def type_for_dropdown
|
|
78
78
|
return list_item.type unless list_item.object?
|
|
79
|
+
|
|
79
80
|
list_item.object_type.to_s
|
|
80
81
|
end
|
|
81
82
|
|
|
@@ -97,12 +98,13 @@ module Integral
|
|
|
97
98
|
# @return [String] URL of list item
|
|
98
99
|
def url
|
|
99
100
|
return if list_item.basic?
|
|
101
|
+
|
|
100
102
|
url = provide_attr(:url)
|
|
101
103
|
|
|
102
104
|
return url if url.nil? || url.empty?
|
|
103
|
-
return url if url.match?(URI::DEFAULT_PARSER.make_regexp)
|
|
105
|
+
return CGI.unescape(url) if url.match?(URI::DEFAULT_PARSER.make_regexp)
|
|
104
106
|
|
|
105
|
-
"#{Rails.application.routes.default_url_options[:host]}#{url}"
|
|
107
|
+
CGI.unescape("#{Rails.application.routes.default_url_options[:host]}#{url}")
|
|
106
108
|
end
|
|
107
109
|
|
|
108
110
|
# @return [String] subtitle of list item
|
|
@@ -39,7 +39,13 @@ module Integral
|
|
|
39
39
|
return dynamic_homepage if path == '/' && Integral.dynamic_homepage_enabled?
|
|
40
40
|
|
|
41
41
|
# TODO: Speed this up by adding an index & unique constraint on path attribute
|
|
42
|
-
Integral::Page.find_by_path(path)&.id
|
|
42
|
+
Integral::Page.not_archived.find_by_path(path)&.id
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def category_identifier(path)
|
|
46
|
+
return nil unless path.starts_with?("/#{Integral.blog_namespace}")
|
|
47
|
+
|
|
48
|
+
Integral::Category.select(:id, :slug).all.map { |category| [category.id, "/#{Integral.blog_namespace}/#{category.slug}"] }.find { |category| category[1] == path }&.first
|
|
43
49
|
end
|
|
44
50
|
|
|
45
51
|
# Converts the request path from human readable into something Rails router understands
|
|
@@ -51,12 +57,15 @@ module Integral
|
|
|
51
57
|
# @return [String] Path Rails needs to link the request to the correct Integral::Page record
|
|
52
58
|
def rewrite_path(env, path)
|
|
53
59
|
page_id = page_identifier(path)
|
|
54
|
-
|
|
60
|
+
if page_id
|
|
61
|
+
env['PATH_INFO'] = "/pages/#{page_id}"
|
|
62
|
+
else
|
|
63
|
+
category_id = category_identifier(path)
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
rescue StandardError =>
|
|
59
|
-
handle_rewrite_error(
|
|
65
|
+
env['PATH_INFO'] = "/#{Integral.blog_namespace}/categories/#{category_id}" if category_id
|
|
66
|
+
end
|
|
67
|
+
rescue StandardError => e
|
|
68
|
+
handle_rewrite_error(e)
|
|
60
69
|
end
|
|
61
70
|
|
|
62
71
|
# Homepage ID as defined by User within backend settings
|
data/lib/integral/router.rb
CHANGED
|
@@ -33,6 +33,7 @@ module Integral
|
|
|
33
33
|
if Integral.blog_enabled?
|
|
34
34
|
scope Integral.blog_namespace do
|
|
35
35
|
resources :tags, only: %i[index show]
|
|
36
|
+
resources :categories, only: %i[show]
|
|
36
37
|
end
|
|
37
38
|
# Post Routing must go after tags otherwise it will override
|
|
38
39
|
resources Integral.blog_namespace, only: %i[show index], as: :posts, controller: 'posts'
|
|
@@ -59,13 +60,20 @@ module Integral
|
|
|
59
60
|
get 'account', to: 'users#account'
|
|
60
61
|
|
|
61
62
|
# User Management
|
|
62
|
-
resources :users
|
|
63
|
+
resources :users do
|
|
64
|
+
get 'list', on: :collection
|
|
65
|
+
member do
|
|
66
|
+
get 'activities', controller: 'users'
|
|
67
|
+
get 'activities/:activity_id', to: 'users#activity', as: :activity
|
|
68
|
+
end
|
|
69
|
+
end
|
|
63
70
|
|
|
64
71
|
# Image Management
|
|
65
72
|
resources :images, as: :img
|
|
66
73
|
|
|
67
74
|
# Page Management
|
|
68
|
-
resources :pages
|
|
75
|
+
resources :pages do
|
|
76
|
+
get 'list', on: :collection
|
|
69
77
|
member do
|
|
70
78
|
post 'duplicate'
|
|
71
79
|
get 'activities', controller: 'pages'
|
|
@@ -76,13 +84,15 @@ module Integral
|
|
|
76
84
|
# Activity Management
|
|
77
85
|
resources :activities, only: %i[index show] do
|
|
78
86
|
collection do
|
|
87
|
+
post 'widget'
|
|
79
88
|
post 'grid'
|
|
80
89
|
end
|
|
81
90
|
end
|
|
82
91
|
|
|
83
92
|
# Post Management
|
|
84
93
|
if Integral.blog_enabled?
|
|
85
|
-
resources :posts
|
|
94
|
+
resources :posts do
|
|
95
|
+
get 'list', on: :collection
|
|
86
96
|
member do
|
|
87
97
|
post 'duplicate'
|
|
88
98
|
get 'activities', controller: 'posts'
|
|
@@ -90,6 +100,12 @@ module Integral
|
|
|
90
100
|
end
|
|
91
101
|
# resources :comments, only: [:create, :destroy]
|
|
92
102
|
end
|
|
103
|
+
resources :categories, only: %i[create edit update destroy] do
|
|
104
|
+
member do
|
|
105
|
+
get 'activities', controller: 'categories'
|
|
106
|
+
get 'activities/:activity_id', to: 'categories#activity', as: :activity
|
|
107
|
+
end
|
|
108
|
+
end
|
|
93
109
|
end
|
|
94
110
|
|
|
95
111
|
# List Management
|