camaleon_cms 2.1.2.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/app/apps/plugins/attack/attack_helper.rb +3 -0
- data/app/apps/plugins/attack/config/custom_models.rb +4 -2
- data/app/apps/plugins/attack/config/locales/translation.yml +19 -0
- data/app/apps/plugins/attack/models/attack.rb +1 -1
- data/app/apps/plugins/front_cache/config/initializer.rb +4 -2
- data/app/apps/plugins/front_cache/config/locales/translation.yml +19 -0
- data/app/apps/themes/camaleon_first/main_helper.rb +1 -3
- data/app/apps/themes/default/views/admin/settings.html.erb +0 -1
- data/app/apps/themes/default/views/layouts/index.html.erb +5 -5
- data/app/apps/themes/new/assets/css/main.css +1 -1
- data/app/apps/themes/new/assets/js/main.js +1 -1
- data/app/apps/themes/new/views/admin/settings.html.erb +1 -1
- data/app/assets/images/camaleon_cms/language/{pt_br.png → pt-BR.png} +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +105 -51
- data/app/assets/javascripts/camaleon_cms/admin/_libraries.js +4 -2
- data/app/assets/javascripts/camaleon_cms/admin/_translator.js +2 -2
- data/app/assets/javascripts/camaleon_cms/admin/custom_fields_form.js +9 -7
- data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/{pt_br.js → pt-BR.js} +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/{pt_br.js → pt-BR.js} +1 -1
- data/app/assets/javascripts/camaleon_cms/admin/nav_menu.js.coffee +15 -1
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/{pt_br.js → pt-BR.js} +1 -1
- data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +24 -12
- data/app/assets/stylesheets/camaleon_cms/admin/_custom_admin.css.scss +9 -0
- data/app/assets/stylesheets/camaleon_cms/admin/lte/_admin.css.scss +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +13 -6
- data/app/controllers/camaleon_cms/admin/appearances/themes_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/widgets/assign_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/widgets/sidebar_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/comments_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/media_controller.rb +15 -5
- data/app/controllers/camaleon_cms/admin/plugins_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/settings/custom_fields_controller.rb +14 -8
- data/app/controllers/camaleon_cms/admin/settings_controller.rb +22 -7
- data/app/controllers/camaleon_cms/admin/user_roles_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/users_controller.rb +1 -1
- data/app/controllers/camaleon_cms/apps/plugins_admin_controller.rb +4 -1
- data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +5 -10
- data/app/controllers/camaleon_cms/apps/themes_front_controller.rb +1 -4
- data/app/controllers/camaleon_cms/camaleon_controller.rb +4 -13
- data/app/controllers/camaleon_cms/frontend_controller.rb +15 -9
- data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +17 -8
- data/app/decorators/camaleon_cms/application_decorator.rb +3 -3
- data/app/decorators/camaleon_cms/custom_fields_concern.rb +21 -6
- data/app/decorators/camaleon_cms/post_comment_decorator.rb +21 -0
- data/app/decorators/camaleon_cms/site_decorator.rb +5 -5
- data/app/decorators/camaleon_cms/theme_decorator.rb +10 -0
- data/app/decorators/camaleon_cms/user_decorator.rb +2 -2
- data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +24 -2
- data/app/helpers/camaleon_cms/admin/menus_helper.rb +13 -12
- data/app/helpers/camaleon_cms/frontend/application_helper.rb +1 -1
- data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +7 -6
- data/app/helpers/camaleon_cms/plugins_helper.rb +20 -18
- data/app/helpers/camaleon_cms/site_helper.rb +1 -20
- data/app/helpers/camaleon_cms/theme_helper.rb +1 -1
- data/app/helpers/camaleon_cms/uploader_helper.rb +25 -20
- data/app/helpers/camaleon_cms/user_roles_helper.rb +6 -1
- data/app/mailers/camaleon_cms/html_mailer.rb +2 -1
- data/app/models/camaleon_cms/ability.rb +3 -26
- data/app/models/camaleon_cms/custom_field.rb +2 -1
- data/app/models/camaleon_cms/custom_field_group.rb +23 -22
- data/app/models/camaleon_cms/custom_fields_relationship.rb +1 -1
- data/app/models/camaleon_cms/nav_menu.rb +1 -1
- data/app/models/camaleon_cms/nav_menu_item.rb +12 -19
- data/app/models/camaleon_cms/post.rb +1 -1
- data/app/models/camaleon_cms/post_comment.rb +3 -1
- data/app/models/camaleon_cms/post_default.rb +1 -1
- data/app/models/camaleon_cms/post_type.rb +5 -4
- data/app/models/camaleon_cms/site.rb +12 -0
- data/app/models/camaleon_cms/term_taxonomy.rb +1 -1
- data/app/models/camaleon_cms/user_role.rb +5 -1
- data/app/models/concerns/camaleon_cms/custom_fields_read.rb +99 -49
- data/app/uploaders/camaleon_cms_aws_uploader.rb +1 -1
- data/app/uploaders/camaleon_cms_local_uploader.rb +19 -3
- data/app/uploaders/camaleon_cms_uploader.rb +13 -6
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_menus.html.erb +9 -2
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_form.html.erb +1 -1
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_menu_items.html.erb +2 -2
- data/app/views/camaleon_cms/admin/appearances/themes/index.html.erb +1 -3
- data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +1 -0
- data/app/views/camaleon_cms/admin/media/index.html.erb +3 -3
- data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +1 -1
- data/app/views/camaleon_cms/admin/posts/form.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +4 -0
- data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +6 -6
- data/app/views/camaleon_cms/admin/settings/custom_fields/_meta_data.html.erb +0 -9
- data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +39 -55
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_audio.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkbox.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkboxes.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_colorpicker.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_date.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_editor.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_email.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_field_attrs.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_file.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_image.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_numeric.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_phone.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_private_file.html.erb +4 -0
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_radio.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select_eval.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_area.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_box.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_url.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_users.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_video.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +8 -0
- data/app/views/camaleon_cms/admin/settings/site.html.erb +1 -20
- data/app/views/camaleon_cms/admin/settings/theme.html.erb +20 -0
- data/app/views/camaleon_cms/admin/user_roles/form.html.erb +2 -2
- data/app/views/camaleon_cms/default_theme/admin/settings.html.erb +0 -1
- data/app/views/camaleon_cms/default_theme/partials/_comments.html.erb +0 -2
- data/app/views/camaleon_cms/default_theme/partials/_search_form.html.erb +1 -1
- data/app/views/camaleon_cms/default_theme/partials/_sidebar.html.erb +3 -3
- data/app/views/layouts/camaleon_cms/admin/_footer.html.erb +1 -1
- data/config/initializers/action_view.rb +12 -7
- data/config/initializers/custom_initializers.rb +6 -12
- data/config/locales/camaleon_cms/admin/en.yml +1 -0
- data/config/locales/camaleon_cms/admin/es.yml +4 -0
- data/config/locales/camaleon_cms/admin/it.yml +1 -24
- data/config/locales/camaleon_cms/admin/js.yml +41 -0
- data/config/locales/camaleon_cms/admin/{pt_br.yml → pt-BR.yml} +48 -18
- data/config/locales/camaleon_cms/common.yml +66 -0
- data/config/locales/camaleon_cms/languages.yml +13 -0
- data/config/locales/camaleon_cms/routes.yml +2 -2
- data/config/routes/admin.rb +3 -0
- data/config/system.json +3 -3
- data/db/migrate/20160606135421_improve_menus_structure.rb +7 -0
- data/db/migrate/20160609121449_add_group_to_custom_field_values.rb +5 -0
- data/lib/camaleon_cms/engine.rb +4 -3
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/ext/string.rb +20 -0
- data/lib/ext/translator.rb +2 -2
- data/lib/generators/camaleon_cms/gem_plugin_generator.rb +1 -1
- data/lib/generators/camaleon_cms/gem_plugin_template/config/camaleon_plugin.json +1 -1
- data/lib/generators/camaleon_cms/install_generator.rb +1 -0
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb +1 -4
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/index.html.erb +1 -25
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +17 -18
- data/lib/plugin_routes.rb +4 -4
- metadata +25 -48
- data/app/apps/plugins/contact_form/admin_forms_controller.rb +0 -85
- data/app/apps/plugins/contact_form/assets/css/admin/form-builder/formbuilder.css +0 -70
- data/app/apps/plugins/contact_form/assets/css/contact-form.css +0 -8
- data/app/apps/plugins/contact_form/assets/css/front/railsform.scss +0 -94
- data/app/apps/plugins/contact_form/assets/css/readme.txt +0 -1
- data/app/apps/plugins/contact_form/assets/js/contact_form.js +0 -2
- data/app/apps/plugins/contact_form/assets/js/form-builder/formbuilder.js +0 -1271
- data/app/apps/plugins/contact_form/assets/js/form-builder/vendor.js +0 -3072
- data/app/apps/plugins/contact_form/assets/js/readme.txt +0 -1
- data/app/apps/plugins/contact_form/config/config.json +0 -35
- data/app/apps/plugins/contact_form/config/custom_models.rb +0 -3
- data/app/apps/plugins/contact_form/config/locales/readme.txt +0 -1
- data/app/apps/plugins/contact_form/config/locales/translation.yml +0 -315
- data/app/apps/plugins/contact_form/config/routes_admin.txt +0 -4
- data/app/apps/plugins/contact_form/config/routes_front.txt +0 -2
- data/app/apps/plugins/contact_form/contact_form_helper.rb +0 -154
- data/app/apps/plugins/contact_form/contact_form_html_helper.rb +0 -140
- data/app/apps/plugins/contact_form/front_controller.rb +0 -50
- data/app/apps/plugins/contact_form/models/contact_form.rb +0 -26
- data/app/apps/plugins/contact_form/views/admin_forms/_form.html.erb +0 -33
- data/app/apps/plugins/contact_form/views/admin_forms/edit.html.erb +0 -338
- data/app/apps/plugins/contact_form/views/admin_forms/index.html.erb +0 -65
- data/app/apps/plugins/contact_form/views/admin_forms/responses.html.erb +0 -60
- data/app/apps/plugins/contact_form/views/contact_form/_email_content.html.erb +0 -26
- data/app/apps/plugins/contact_form/views/forms_shorcode.html.erb +0 -28
- data/app/apps/plugins/contact_form/views/front/index.html.erb +0 -3
- data/app/apps/themes/camaleon_first/views/admin/settings.html.erb +0 -4
- data/app/apps/themes/new/assets/css/bootstrap/bootstrap.min.css +0 -6735
- data/app/apps/themes/new/assets/js/plugins/bootstrap/bootstrap.min.js +0 -6
- data/app/apps/themes/new/assets/js/plugins/jquery/jquery.min.js +0 -4
- data/lib/generators/camaleon_cms/gem_theme_generator.rb +0 -97
- data/lib/generators/camaleon_cms/gem_theme_template/app/assets/images/themes/my_plugin/image.png +0 -0
- data/lib/generators/camaleon_cms/gem_theme_template/app/assets/javascripts/themes/my_plugin/main.js +0 -14
- data/lib/generators/camaleon_cms/gem_theme_template/app/assets/stylesheets/themes/my_plugin/main.css +0 -13
- data/lib/generators/camaleon_cms/gem_theme_template/app/helpers/themes/my_plugin/main_helper.rb +0 -26
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/admin/settings.html.erb +0 -4
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/index.html.erb +0 -25
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/layouts/index.html.erb +0 -70
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/partials/readme.txt +0 -1
- data/lib/generators/camaleon_cms/gem_theme_template/config/camaleon_theme.json +0 -14
@@ -95,7 +95,7 @@ class CamaleonCms::Admin::UsersController < CamaleonCms::AdminController
|
|
95
95
|
private
|
96
96
|
|
97
97
|
def validate_role
|
98
|
-
(params[:id].present? && cama_current_user.id == params[:id]) || authorize!(:
|
98
|
+
(params[:id].present? && cama_current_user.id == params[:id]) || authorize!(:manage, :users)
|
99
99
|
end
|
100
100
|
|
101
101
|
def set_user
|
@@ -19,6 +19,9 @@ class CamaleonCms::Apps::PluginsAdminController < CamaleonCms::AdminController
|
|
19
19
|
redirect_to cama_root_url
|
20
20
|
return
|
21
21
|
end
|
22
|
-
|
22
|
+
if !@plugin.settings["gem_mode"].present?
|
23
|
+
lookup_context.prefixes.delete_if{|t| t =~ /plugins\/(.*)\/views/i }
|
24
|
+
lookup_context.prefixes.prepend(params[:controller].sub("plugins/#{plugin_name}", "plugins/#{plugin_name}/views"))
|
25
|
+
end
|
23
26
|
end
|
24
27
|
end
|
@@ -8,13 +8,7 @@
|
|
8
8
|
=end
|
9
9
|
class CamaleonCms::Apps::PluginsFrontController < CamaleonCms::FrontendController
|
10
10
|
before_action :init_plugin
|
11
|
-
layout Proc.new { |controller|
|
12
|
-
if current_theme.settings["gem_mode"]
|
13
|
-
"themes/#{current_theme.slug}/layouts/index"
|
14
|
-
else
|
15
|
-
"themes/#{current_theme.slug}/views/layouts/index"
|
16
|
-
end
|
17
|
-
}
|
11
|
+
layout Proc.new { |controller| "themes/#{current_theme.slug}/views/layouts/index" }
|
18
12
|
|
19
13
|
private
|
20
14
|
def init_plugin
|
@@ -25,8 +19,9 @@ class CamaleonCms::Apps::PluginsFrontController < CamaleonCms::FrontendControlle
|
|
25
19
|
redirect_to cama_root_url
|
26
20
|
return
|
27
21
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
if !@plugin.settings["gem_mode"].present?
|
23
|
+
lookup_context.prefixes.delete_if{|t| t =~ /plugins\/(.*)\/views/i }
|
24
|
+
lookup_context.prefixes.prepend(params[:controller].sub("plugins/#{plugin_name}", "plugins/#{plugin_name}/views"))
|
25
|
+
end
|
31
26
|
end
|
32
27
|
end
|
@@ -15,9 +15,6 @@ class CamaleonCms::Apps::ThemesFrontController < CamaleonCms::FrontendController
|
|
15
15
|
theme_name = params[:controller].split("/")[1]
|
16
16
|
@theme = current_theme
|
17
17
|
return render_error(404) unless current_theme.slug == theme_name
|
18
|
-
lookup_context.prefixes
|
19
|
-
lookup_context.prefixes.prepend(params[:controller].sub("themes/#{theme_name}", "themes/#{theme_name}/views")) unless current_theme.settings["gem_mode"]
|
20
|
-
lookup_context.prefixes.append("themes/#{current_theme.slug}") if current_theme.settings["gem_mode"]
|
21
|
-
lookup_context.prefixes.append("themes/#{current_theme.slug}/views") unless current_theme.settings["gem_mode"]
|
18
|
+
lookup_context.prefixes.prepend(params[:controller].sub("themes/#{theme_name}", "themes/#{theme_name}/views"))
|
22
19
|
end
|
23
20
|
end
|
@@ -10,6 +10,7 @@ class CamaleonCms::CamaleonController < ApplicationController
|
|
10
10
|
add_flash_types :warning
|
11
11
|
add_flash_types :error
|
12
12
|
add_flash_types :notice
|
13
|
+
add_flash_types :info
|
13
14
|
|
14
15
|
include CamaleonCms::CamaleonHelper
|
15
16
|
include CamaleonCms::SessionHelper
|
@@ -26,7 +27,8 @@ class CamaleonCms::CamaleonController < ApplicationController
|
|
26
27
|
include CamaleonCms::EmailHelper
|
27
28
|
include Mobu::DetectMobile
|
28
29
|
|
29
|
-
|
30
|
+
PluginRoutes.all_helpers.each{|h| include h.constantize }
|
31
|
+
|
30
32
|
before_action :cama_site_check_existence, except: [:render_error, :captcha]
|
31
33
|
before_action :cama_before_actions, except: [:render_error, :captcha]
|
32
34
|
after_action :cama_after_actions, except: [:render_error, :captcha]
|
@@ -52,7 +54,7 @@ class CamaleonCms::CamaleonController < ApplicationController
|
|
52
54
|
private
|
53
55
|
def cama_before_actions
|
54
56
|
# including all helpers (system, themes, plugins) for this site
|
55
|
-
PluginRoutes.enabled_apps(current_site, current_theme.slug).each{|plugin| plugin_load_helpers(plugin) }
|
57
|
+
# PluginRoutes.enabled_apps(current_site, current_theme.slug).each{|plugin| plugin_load_helpers(plugin) }
|
56
58
|
|
57
59
|
# initializing short codes
|
58
60
|
shortcodes_init()
|
@@ -73,10 +75,6 @@ class CamaleonCms::CamaleonController < ApplicationController
|
|
73
75
|
self.prepend_view_path(File.join($camaleon_engine_dir, views_dir).to_s)
|
74
76
|
self.prepend_view_path(Rails.root.join(views_dir).to_s)
|
75
77
|
|
76
|
-
# past plugins version support
|
77
|
-
self.prepend_view_path(File.join($camaleon_engine_dir, "app", "apps", "plugins"))
|
78
|
-
self.prepend_view_path(Rails.root.join("app", "apps", 'plugins'))
|
79
|
-
|
80
78
|
CamaleonCms::PostDefault.current_user = cama_current_user
|
81
79
|
CamaleonCms::PostDefault.current_site = current_site
|
82
80
|
end
|
@@ -96,13 +94,6 @@ class CamaleonCms::CamaleonController < ApplicationController
|
|
96
94
|
redirect_to cama_root_path
|
97
95
|
end
|
98
96
|
|
99
|
-
# include CamaleonCms::all custom models created by installed plugins or themes for current site
|
100
|
-
def cama_load_custom_models
|
101
|
-
if current_site.present?
|
102
|
-
site_load_custom_models(current_site)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
97
|
# check if current site exist, if not, this will be redirected to main domain
|
107
98
|
# Also, check current site status
|
108
99
|
def cama_site_check_existence()
|
@@ -7,8 +7,8 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
10
|
+
before_action :init_frontent
|
10
11
|
include CamaleonCms::FrontendConcern
|
11
|
-
prepend_before_action :init_frontent
|
12
12
|
include CamaleonCms::Frontend::ApplicationHelper
|
13
13
|
layout Proc.new { |controller| params[:cama_ajax_request].present? ? "cama_ajax" : 'index' }
|
14
14
|
|
@@ -69,7 +69,11 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
69
69
|
# render contents for the post tag
|
70
70
|
def post_tag
|
71
71
|
begin
|
72
|
-
|
72
|
+
if params[:post_tag_slug].present?
|
73
|
+
@post_tag = current_site.post_tags.find_by_slug(params[:post_tag_id]).decorate
|
74
|
+
else
|
75
|
+
@post_tag = current_site.post_tags.find(params[:post_tag_id]).decorate
|
76
|
+
end
|
73
77
|
@post_type = @post_tag.the_post_type
|
74
78
|
rescue
|
75
79
|
return page_not_found
|
@@ -210,7 +214,7 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
210
214
|
# if url hasn't a locale, then it will use default locale set on application.rb
|
211
215
|
def init_frontent
|
212
216
|
# preview theme initializing
|
213
|
-
if cama_sign_in? && params[:ccc_theme_preview].present? && can?(:
|
217
|
+
if cama_sign_in? && params[:ccc_theme_preview].present? && can?(:manage, :themes)
|
214
218
|
@_current_theme = (current_site.themes.where(slug: params[:ccc_theme_preview]).first_or_create!.decorate)
|
215
219
|
end
|
216
220
|
|
@@ -224,14 +228,16 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
224
228
|
lookup_context.prefixes.delete("application")
|
225
229
|
lookup_context.prefixes.delete("camaleon_cms/frontend")
|
226
230
|
lookup_context.prefixes.delete("camaleon_cms/camaleon")
|
231
|
+
lookup_context.prefixes.delete("camaleon_cms/apps/plugins_front")
|
232
|
+
lookup_context.prefixes.delete("camaleon_cms/apps/themes_front")
|
233
|
+
lookup_context.prefixes.delete_if{|t| t =~ /themes\/(.*)\/views/i || t == "camaleon_cms/default_theme" || t == "themes/#{current_site.id}/views" }
|
234
|
+
|
235
|
+
lookup_context.prefixes.append("themes/#{current_site.id}/views") if Dir.exist?(Rails.root.join('app', 'apps', 'themes', current_site.id.to_s).to_s)
|
236
|
+
lookup_context.prefixes.append("themes/#{current_theme.slug}/views")
|
237
|
+
lookup_context.prefixes.append("camaleon_cms/default_theme")
|
227
238
|
|
228
|
-
if ['camaleon_cms/frontend', 'frontend'].include?(params[:controller]) # 'frontend' will be removed in new versions (move into camaleon_cms/frontend)
|
229
|
-
lookup_context.prefixes.prepend("camaleon_cms/default_theme")
|
230
|
-
lookup_context.prefixes.prepend("themes/#{current_theme.slug}") if current_theme.settings["gem_mode"]
|
231
|
-
lookup_context.prefixes.prepend("themes/#{current_theme.slug}/views") unless current_theme.settings["gem_mode"]
|
232
|
-
lookup_context.prefixes.prepend("themes/#{current_site.id}/views")
|
233
|
-
end
|
234
239
|
lookup_context.prefixes = lookup_context.prefixes.uniq
|
240
|
+
lookup_context.use_camaleon_partial_prefixes = true
|
235
241
|
theme_init()
|
236
242
|
end
|
237
243
|
|
@@ -36,22 +36,31 @@ module CamaleonCms::FrontendConcern extend ActiveSupport::Concern
|
|
36
36
|
# save comment from a post
|
37
37
|
def save_comment
|
38
38
|
@post = current_site.posts.find_by_id(params[:post_id]).decorate
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
comment_data[:
|
44
|
-
comment_data[:
|
39
|
+
user = current_user
|
40
|
+
comment_data = {}
|
41
|
+
if !user.present? && current_site.get_option('permit_anonimos_comment', false)
|
42
|
+
user = current_site.get_anonymous_user
|
43
|
+
comment_data[:is_anonymous] = true
|
44
|
+
comment_data[:author] = params[:post_comment][:name]
|
45
|
+
comment_data[:author_email] = params[:post_comment][:email]
|
46
|
+
else
|
47
|
+
comment_data[:author] = user.fullname
|
48
|
+
comment_data[:author_email] = user.email
|
49
|
+
end
|
50
|
+
|
51
|
+
if @post.can_commented? && user.present?
|
52
|
+
comment_data[:user_id] = user.id
|
53
|
+
comment_data[:author_url] = params[:post_comment][:url] || ""
|
45
54
|
comment_data[:author_IP] = request.remote_ip.to_s
|
46
55
|
comment_data[:approved] = current_site.front_comment_status
|
47
56
|
comment_data[:agent] = request.user_agent.force_encoding("ISO-8859-1").encode("UTF-8")
|
48
57
|
comment_data[:content] = params[:post_comment][:content]
|
49
|
-
@comment = @post.comments.main.new(comment_data)
|
58
|
+
@comment = params[:post_comment][:parent_id].present? ? @post.comments.find_by_id(params[:post_comment][:parent_id]).children.new(comment_data) : @post.comments.main.new(comment_data)
|
50
59
|
if @comment.save
|
51
60
|
flash[:notice] = t('camaleon_cms.admin.comments.message.created')
|
52
61
|
redirect_to :back
|
53
62
|
else
|
54
|
-
flash[:error] = t('camaleon_cms.
|
63
|
+
flash[:error] = "#{t('camaleon_cms.common.comment_error', default: 'An error was occurred on save comment')}:<br> #{@comment.errors.full_messages.join(', ')}"
|
55
64
|
redirect_to :back
|
56
65
|
end
|
57
66
|
else
|
@@ -51,12 +51,12 @@ class CamaleonCms::ApplicationDecorator < Draper::Decorator
|
|
51
51
|
|
52
52
|
# get the locale for current decorator
|
53
53
|
def get_locale(locale = nil)
|
54
|
-
locale || @_deco_locale || h.cama_get_i18n_frontend || I18n.locale
|
54
|
+
locale || @_deco_locale || (h.cama_get_i18n_frontend rescue false) || I18n.locale
|
55
55
|
end
|
56
56
|
|
57
57
|
# return the current locale prefixed to add in frontend routes
|
58
58
|
def _calc_locale(_l)
|
59
|
-
_l = (_l || @_deco_locale || h.cama_get_i18n_frontend || I18n.locale).to_s
|
59
|
+
_l = (_l || @_deco_locale || (h.cama_get_i18n_frontend rescue false) || I18n.locale).to_s
|
60
60
|
"_#{_l}"
|
61
61
|
end
|
62
|
-
end
|
62
|
+
end
|
@@ -44,21 +44,36 @@ module CamaleonCms::CustomFieldsConcern
|
|
44
44
|
def the_attribute_fields(field_key)
|
45
45
|
r = []
|
46
46
|
object.get_fields(field_key).each do |text|
|
47
|
-
_r = JSON.parse(text || '{}')
|
48
|
-
_r
|
49
|
-
|
47
|
+
_r = JSON.parse(text || '{}').with_indifferent_access
|
48
|
+
_r.keys.each do |k|
|
49
|
+
_r[k] = h.do_shortcode(_r[k].to_s.translate(@_deco_locale), object)
|
50
|
+
end
|
50
51
|
r << _r
|
51
52
|
end
|
52
53
|
r
|
53
54
|
end
|
54
55
|
|
56
|
+
# the same function as get_fields_grouped(..) but this returns translated and shortcodes evaluated
|
57
|
+
def the_fields_grouped(field_keys)
|
58
|
+
res = []
|
59
|
+
object.get_fields_grouped(field_keys).each do |_group|
|
60
|
+
group = {}.with_indifferent_access
|
61
|
+
_group.keys.each do |k|
|
62
|
+
group[k] = _group[k].map{|v| h.do_shortcode(v.to_s.translate(@_deco_locale), object) }
|
63
|
+
end
|
64
|
+
res << group
|
65
|
+
end
|
66
|
+
res
|
67
|
+
end
|
68
|
+
|
55
69
|
# return custom field content with key field_key (only for type attributes)
|
56
70
|
# translated and short codes evaluated like the content
|
57
71
|
# default_val: default value returned when this field was not registered
|
58
72
|
def the_attribute_field(field_key, default_val = '')
|
59
|
-
r = JSON.parse(object.get_field(field_key, default_val) || '{}')
|
60
|
-
r
|
61
|
-
|
73
|
+
r = JSON.parse(object.get_field(field_key, default_val) || '{}').with_indifferent_access
|
74
|
+
r.keys.each do |k|
|
75
|
+
r[k] = h.do_shortcode(r[k].to_s.translate(@_deco_locale), object)
|
76
|
+
end
|
62
77
|
r
|
63
78
|
end
|
64
79
|
end
|
@@ -20,7 +20,28 @@ class CamaleonCms::PostCommentDecorator < Draper::Decorator
|
|
20
20
|
end
|
21
21
|
alias_method :the_author, :the_user
|
22
22
|
|
23
|
+
def the_post
|
24
|
+
object.post.decorate
|
25
|
+
end
|
26
|
+
|
23
27
|
def the_content
|
24
28
|
object.content
|
25
29
|
end
|
30
|
+
|
31
|
+
def the_answers
|
32
|
+
object.children.approveds
|
33
|
+
end
|
34
|
+
|
35
|
+
def the_author_name
|
36
|
+
object.author.presence || object.user.full_name
|
37
|
+
end
|
38
|
+
|
39
|
+
def the_author_email
|
40
|
+
object.author_email.presence || object.user.email
|
41
|
+
end
|
42
|
+
|
43
|
+
def the_author_url
|
44
|
+
object.author_url.presence || (object.user.username == 'anonymous' ? '' : object.user.decorate.the_url)
|
45
|
+
end
|
46
|
+
|
26
47
|
end
|
@@ -26,9 +26,9 @@ class CamaleonCms::SiteDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
26
26
|
# return all contents from this site registered for post_type = slug (filter visibility, hidden, expired, ...)
|
27
27
|
# slug_or_id: slug or id of the post_type or array of slugs of post_types, default 'post'
|
28
28
|
def the_contents(slug_or_id = "post")
|
29
|
-
return h.verify_front_visibility(object.posts.where("#{CamaleonCms::TermTaxonomy.table_name}.id = ?", slug_or_id))
|
30
|
-
return h.verify_front_visibility(object.posts.where("#{CamaleonCms::TermTaxonomy.table_name}.slug = ?", slug_or_id))
|
31
|
-
return h.verify_front_visibility(object.posts.where("#{CamaleonCms::TermTaxonomy.table_name}.slug in (?)", slug_or_id))
|
29
|
+
return h.verify_front_visibility(object.posts.where("#{CamaleonCms::TermTaxonomy.table_name}.id = ?", slug_or_id)) if slug_or_id.is_a?(Integer)
|
30
|
+
return h.verify_front_visibility(object.posts.where("#{CamaleonCms::TermTaxonomy.table_name}.slug = ?", slug_or_id)) if slug_or_id.is_a?(String)
|
31
|
+
return h.verify_front_visibility(object.posts.where("#{CamaleonCms::TermTaxonomy.table_name}.slug in (?)", slug_or_id)) if slug_or_id.is_a?(Array)
|
32
32
|
end
|
33
33
|
|
34
34
|
# return all contents for this site filteredby (visibility, hidden, expired, ...)
|
@@ -41,7 +41,7 @@ class CamaleonCms::SiteDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
41
41
|
if slug_or_id.present?
|
42
42
|
the_contents(slug_or_id)
|
43
43
|
else
|
44
|
-
h.verify_front_visibility(object.posts)
|
44
|
+
h.verify_front_visibility(object.posts)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -101,7 +101,7 @@ class CamaleonCms::SiteDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
101
101
|
|
102
102
|
# return all post types for this site
|
103
103
|
def the_post_types
|
104
|
-
object.post_types
|
104
|
+
object.post_types
|
105
105
|
end
|
106
106
|
|
107
107
|
# return a post_type object with id or slug = slug_or_id
|
@@ -12,4 +12,14 @@ class CamaleonCms::ThemeDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
12
12
|
def the_id
|
13
13
|
object.id
|
14
14
|
end
|
15
|
+
|
16
|
+
def the_settings_url
|
17
|
+
h.cama_admin_settings_theme_url
|
18
|
+
end
|
19
|
+
|
20
|
+
def the_settings_link
|
21
|
+
return '' unless h.cama_current_user.present?
|
22
|
+
attrs = {target: "_blank", style: "font-size:11px !important;cursor:pointer;"}.merge(attrs)
|
23
|
+
h.link_to("→ #{title || h.ct("edit", default: 'Edit')}".html_safe, the_settings_url, attrs)
|
24
|
+
end
|
15
25
|
end
|
@@ -26,8 +26,8 @@ class CamaleonCms::UserDecorator < CamaleonCms::ApplicationDecorator
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# return the avatar for this user, default: assets/admin/img/no_image.jpg
|
29
|
-
def the_avatar
|
30
|
-
avatar_exists? ? object.get_meta("avatar") : h.asset_url("camaleon_cms/admin/img/no_image.jpg")
|
29
|
+
def the_avatar(default_avatar = nil)
|
30
|
+
avatar_exists? ? object.get_meta("avatar") : (default_avatar || h.asset_url("camaleon_cms/admin/img/no_image.jpg"))
|
31
31
|
end
|
32
32
|
|
33
33
|
# return the slogan for this user, default: Hello World
|
@@ -203,8 +203,14 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
203
203
|
{
|
204
204
|
type: 'text_box',
|
205
205
|
key: 'dimension',
|
206
|
-
label: '
|
207
|
-
description: 'Crop
|
206
|
+
label: t('camaleon_cms.admin.custom_field.fields.image_dimension', default: 'Dimension'),
|
207
|
+
description: t('camaleon_cms.admin.custom_field.fields.image_dimension_descr', default: 'Crop the image with indicated dimension (widthxheight), sample: 400x300 <br>Possible values: 400x300 | 400x | x300 | ?400x?500 | ?1400x (? => maximum, empty => auto)'),
|
208
|
+
},
|
209
|
+
{
|
210
|
+
type: 'text_box',
|
211
|
+
key: 'versions',
|
212
|
+
label: t('camaleon_cms.admin.custom_field.fields.image_versions_descr', default: 'Versions'),
|
213
|
+
description: t('camaleon_cms.admin.custom_field.fields.image_versions_descr', default: 'Create addtional multiple versions of the image uploaded, sample: \'300x300,505x350\' ==> Will create two extra images with these dimensions')
|
208
214
|
}
|
209
215
|
]
|
210
216
|
}
|
@@ -303,6 +309,22 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
303
309
|
translate: true
|
304
310
|
}
|
305
311
|
}
|
312
|
+
items[:private_file] = {
|
313
|
+
key: 'private_file',
|
314
|
+
label: t('camaleon_cms.admin.custom_field.fields.private_file', default: 'Private File'),
|
315
|
+
options: {
|
316
|
+
required: true,
|
317
|
+
multiple: true,
|
318
|
+
default_value: ''
|
319
|
+
},
|
320
|
+
extra_fields:[
|
321
|
+
{
|
322
|
+
type: 'text_box',
|
323
|
+
key: 'formats',
|
324
|
+
label: 'File Formats (image,video,audio)'
|
325
|
+
}
|
326
|
+
]
|
327
|
+
}
|
306
328
|
r = {fields: items}; hooks_run("extra_custom_fields", r)
|
307
329
|
@_cama_custom_field_elements = r[:fields]
|
308
330
|
end
|
@@ -11,7 +11,6 @@ module CamaleonCms::Admin::MenusHelper
|
|
11
11
|
|
12
12
|
def admin_menus_add_commons
|
13
13
|
admin_menu_add_menu("dashboard", {icon: "dashboard", title: t('camaleon_cms.admin.sidebar.dashboard'), url: cama_admin_dashboard_path})
|
14
|
-
#if can? :manager, :content
|
15
14
|
items = []
|
16
15
|
|
17
16
|
current_site.post_types.eager_load(:metas).visible_menu.all.each do |pt|
|
@@ -30,20 +29,20 @@ module CamaleonCms::Admin::MenusHelper
|
|
30
29
|
admin_menu_add_menu("content", {icon: "database", title: t('camaleon_cms.admin.sidebar.contents'), url: "", items: items, datas: "data-intro='#{t("camaleon_cms.admin.intro.content")}' data-position='right' data-wait='600'"}) if items.present?
|
31
30
|
#end
|
32
31
|
|
33
|
-
admin_menu_add_menu("media", {icon: "picture-o", title: t('camaleon_cms.admin.sidebar.media'), url: cama_admin_media_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.media")}' data-position='right'"}) if can? :
|
34
|
-
admin_menu_add_menu("comments", {icon: "comments", title: t('camaleon_cms.admin.sidebar.comments'), url: cama_admin_comments_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.comments")}' data-position='right'"}) if can? :
|
32
|
+
admin_menu_add_menu("media", {icon: "picture-o", title: t('camaleon_cms.admin.sidebar.media'), url: cama_admin_media_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.media")}' data-position='right'"}) if can? :manage, :media
|
33
|
+
admin_menu_add_menu("comments", {icon: "comments", title: t('camaleon_cms.admin.sidebar.comments'), url: cama_admin_comments_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.comments")}' data-position='right'"}) if can? :manage, :comments
|
35
34
|
|
36
35
|
items = []
|
37
|
-
items << {icon: "desktop", title: t('camaleon_cms.admin.sidebar.themes'), url: cama_admin_appearances_themes_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.themes")}' data-position='right'"} if can? :
|
38
|
-
items << {icon: "archive", title: t('camaleon_cms.admin.sidebar.widgets'), url: cama_admin_appearances_widgets_main_index_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.widgets")}' data-position='right'"} if can? :
|
39
|
-
items << {icon: "list", title: t('camaleon_cms.admin.sidebar.menus'), url: cama_admin_appearances_nav_menus_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.menus", image: view_context.asset_path("camaleon_cms/admin/intro/menus.png"))}' data-position='right'"} if can? :
|
40
|
-
items << {icon: "code", title: t('camaleon_cms.admin.sidebar.shortcodes', default: "Shortcodes"), url: cama_admin_settings_shortcodes_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.shortcodes")}' data-position='right'"} if can? :
|
36
|
+
items << {icon: "desktop", title: t('camaleon_cms.admin.sidebar.themes'), url: cama_admin_appearances_themes_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.themes")}' data-position='right'"} if can? :manage, :themes
|
37
|
+
items << {icon: "archive", title: t('camaleon_cms.admin.sidebar.widgets'), url: cama_admin_appearances_widgets_main_index_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.widgets")}' data-position='right'"} if can? :manage, :widgets
|
38
|
+
items << {icon: "list", title: t('camaleon_cms.admin.sidebar.menus'), url: cama_admin_appearances_nav_menus_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.menus", image: view_context.asset_path("camaleon_cms/admin/intro/menus.png"))}' data-position='right'"} if can? :manage, :nav_menu
|
39
|
+
items << {icon: "code", title: t('camaleon_cms.admin.sidebar.shortcodes', default: "Shortcodes"), url: cama_admin_settings_shortcodes_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.shortcodes")}' data-position='right'"} if can? :manage, :shortcodes
|
41
40
|
admin_menu_add_menu("appearance", {icon: "paint-brush", title: t('camaleon_cms.admin.sidebar.appearance'), url: "", items: items, datas: "data-intro='#{t("camaleon_cms.admin.intro.appearance")}' data-position='right' data-wait='500'"}) if items.present?
|
42
41
|
|
43
42
|
|
44
|
-
admin_menu_add_menu("plugins", {icon: "plug", title: "#{t('camaleon_cms.admin.sidebar.plugins')} <small class='label label-primary'>#{PluginRoutes.all_plugins.clone.delete_if{|plugin| plugin[:domain].present? && !plugin[:domain].split(",").include?(current_site.the_slug) }.size}</small>", url: cama_admin_plugins_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.plugins")}' data-position='right'"}) if can? :
|
43
|
+
admin_menu_add_menu("plugins", {icon: "plug", title: "#{t('camaleon_cms.admin.sidebar.plugins')} <small class='label label-primary'>#{PluginRoutes.all_plugins.clone.delete_if{|plugin| plugin[:domain].present? && !plugin[:domain].split(",").include?(current_site.the_slug) }.size}</small>", url: cama_admin_plugins_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.plugins")}' data-position='right'"}) if can? :manage, :plugins
|
45
44
|
|
46
|
-
if can? :
|
45
|
+
if can? :manage, :users
|
47
46
|
items = []
|
48
47
|
items << {icon: "list", title: t('camaleon_cms.admin.users.all_users'), url: cama_admin_users_path}
|
49
48
|
items << {icon: "plus", title: t('camaleon_cms.admin.users.add_user'), url: new_cama_admin_user_path}
|
@@ -51,16 +50,18 @@ module CamaleonCms::Admin::MenusHelper
|
|
51
50
|
admin_menu_add_menu("users", {icon: "users", title: t('camaleon_cms.admin.sidebar.users'), url: "", items: items, datas: "data-intro='#{t("camaleon_cms.admin.intro.users")}' data-position='right' data-wait='500'"})
|
52
51
|
end
|
53
52
|
|
54
|
-
|
55
|
-
|
53
|
+
items = []
|
54
|
+
if can? :manage, :settings
|
56
55
|
items << {icon: "desktop", title: t('camaleon_cms.admin.sidebar.general_site'), url: cama_admin_settings_site_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.gral_site")}' data-position='right'"}
|
57
56
|
items << {icon: "cog", title: t('camaleon_cms.admin.sidebar.sites'), url: cama_admin_settings_sites_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.sites")}' data-position='right'"} if current_site.manage_sites?
|
58
57
|
items << {icon: "files-o", title: t('camaleon_cms.admin.sidebar.content_groups'), url: cama_admin_settings_post_types_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.post_type")}' data-position='right'"}
|
59
58
|
items << {icon: "cog", title: t('camaleon_cms.admin.sidebar.custom_fields'), url: cama_admin_settings_custom_fields_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.custom_fields")}' data-position='right'"}
|
60
59
|
items << {icon: "language", title: t('camaleon_cms.admin.sidebar.languages'), url: cama_admin_settings_languages_path, datas: "data-intro='#{t("camaleon_cms.admin.intro.languages")}' data-position='right'"}
|
61
|
-
admin_menu_add_menu("settings", {icon: "cogs", title: t('camaleon_cms.admin.sidebar.settings'), url: "", items: items, datas: "data-intro='#{t("camaleon_cms.admin.intro.settings")}' data-position='right' data-wait='500'"})
|
62
60
|
end
|
63
61
|
|
62
|
+
items << {icon: "windows", title: t('camaleon_cms.admin.settings.theme_setting', default: 'Theme Settings'), url: cama_admin_settings_theme_path} if can? :manage, :theme_settings
|
63
|
+
admin_menu_add_menu("settings", {icon: "cogs", title: t('camaleon_cms.admin.sidebar.settings'), url: "", items: items, datas: "data-intro='#{t("camaleon_cms.admin.intro.settings")}' data-position='right' data-wait='500'"}) if items.present?
|
64
|
+
|
64
65
|
end
|
65
66
|
|
66
67
|
# add menu item to admin menu at the the end
|