camaleon_cms 2.1.1 → 2.1.1.4
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 +35 -1
- data/app/apps/plugins/attack/config/locales/translation.yml +20 -1
- data/app/apps/plugins/contact_form/config/locales/translation.yml +106 -1
- data/app/apps/plugins/contact_form/contact_form_helper.rb +44 -27
- data/app/apps/plugins/front_cache/config/locales/translation.yml +21 -1
- data/app/apps/plugins/front_cache/front_cache_helper.rb +1 -1
- data/app/apps/plugins/visibility_post/assets/js/form.js +1 -3
- data/app/apps/plugins/visibility_post/visibility_post_helper.rb +2 -4
- data/app/assets/images/camaleon_cms/language/de.png +0 -0
- data/app/assets/images/camaleon_cms/language/en.png +0 -0
- data/app/assets/images/camaleon_cms/language/es.png +0 -0
- data/app/assets/images/camaleon_cms/language/fr.png +0 -0
- data/app/assets/images/camaleon_cms/language/it.png +0 -0
- data/app/assets/images/camaleon_cms/language/nl.png +0 -0
- data/app/assets/images/camaleon_cms/language/pl.png +0 -0
- data/app/assets/images/camaleon_cms/language/pt.png +0 -0
- data/app/assets/images/camaleon_cms/language/pt_br.png +0 -0
- data/app/assets/images/camaleon_cms/language/ru.png +0 -0
- data/app/assets/images/camaleon_cms/language/zh.png +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +3 -11
- data/app/assets/javascripts/camaleon_cms/admin/_data.js +2 -6
- data/app/assets/javascripts/camaleon_cms/admin/_libraries.js +11 -229
- data/app/assets/javascripts/camaleon_cms/admin/_modal.js +11 -37
- data/app/assets/javascripts/camaleon_cms/admin/_post.js +27 -22
- data/app/assets/javascripts/camaleon_cms/admin/_translator.js +2 -1
- data/app/assets/javascripts/camaleon_cms/admin/admin-manifest.js +6 -2
- data/app/assets/javascripts/camaleon_cms/admin/bootstrap-datepicker.js +2557 -1689
- data/app/assets/javascripts/camaleon_cms/admin/jquery.validate.js +119 -1361
- data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/nl.js +33 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/_moment.js +3606 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ar.js +136 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ca.js +79 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/de.js +76 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/es.js +79 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/fr.js +62 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/it.js +70 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ja.js +65 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/nl.js +71 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/pl.js +105 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/pt.js +64 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/pt_br.js +60 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ru.js +166 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/zh.js +127 -0
- data/app/assets/javascripts/camaleon_cms/admin/nav-menu.js +15 -25
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/nl.js +219 -0
- data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +82 -19
- data/app/assets/javascripts/camaleon_cms/admin/user_profile.js +8 -8
- data/app/assets/stylesheets/camaleon_cms/admin/_custom_admin.css.scss +19 -2
- data/app/assets/stylesheets/camaleon_cms/admin/admin-manifest.css +0 -4
- data/app/assets/stylesheets/camaleon_cms/admin/bootstrap-datepicker.css.scss +315 -414
- data/app/assets/stylesheets/camaleon_cms/admin/uploader/_uploadfile.css.scss +7 -3
- data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +9 -5
- data/app/controllers/camaleon_cms/admin/categories_controller.rb +5 -0
- data/app/controllers/camaleon_cms/admin/media_controller.rb +27 -10
- data/app/controllers/camaleon_cms/admin/posts_controller.rb +9 -19
- data/app/controllers/camaleon_cms/admin/sessions_controller.rb +3 -10
- data/app/controllers/camaleon_cms/admin/settings/custom_fields_controller.rb +0 -1
- data/app/controllers/camaleon_cms/admin/settings/sites_controller.rb +6 -1
- data/app/controllers/camaleon_cms/admin/users_controller.rb +1 -8
- data/app/controllers/camaleon_cms/admin_controller.rb +5 -4
- data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +0 -8
- data/app/controllers/camaleon_cms/camaleon_controller.rb +6 -1
- data/app/controllers/camaleon_cms/frontend_controller.rb +11 -8
- data/app/decorators/camaleon_cms/category_decorator.rb +2 -1
- data/app/decorators/camaleon_cms/post_decorator.rb +28 -1
- data/app/decorators/camaleon_cms/post_tag_decorator.rb +1 -0
- data/app/decorators/camaleon_cms/post_type_decorator.rb +17 -0
- data/app/decorators/camaleon_cms/site_decorator.rb +22 -7
- data/app/decorators/camaleon_cms/user_decorator.rb +1 -0
- data/app/helpers/camaleon_cms/admin/application_helper.rb +3 -2
- data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +13 -25
- data/app/helpers/camaleon_cms/admin/post_type_helper.rb +27 -2
- data/app/helpers/camaleon_cms/camaleon_helper.rb +0 -16
- data/app/helpers/camaleon_cms/captcha_helper.rb +9 -3
- data/app/helpers/camaleon_cms/email_helper.rb +27 -8
- data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +21 -17
- data/app/helpers/camaleon_cms/frontend/seo_helper.rb +5 -3
- data/app/helpers/camaleon_cms/html_helper.rb +2 -2
- data/app/helpers/camaleon_cms/site_helper.rb +10 -14
- data/app/helpers/camaleon_cms/uploader_helper.rb +119 -31
- data/app/mailers/camaleon_cms/html_mailer.rb +26 -20
- data/app/models/camaleon_cms/custom_field.rb +1 -0
- data/app/models/camaleon_cms/custom_field_group.rb +2 -1
- data/app/models/camaleon_cms/nav_menu.rb +6 -7
- data/app/models/camaleon_cms/nav_menu_item.rb +2 -1
- data/app/models/camaleon_cms/post.rb +29 -2
- data/app/models/camaleon_cms/post_type.rb +20 -1
- data/app/models/camaleon_cms/site.rb +19 -19
- data/app/models/camaleon_cms/term_taxonomy.rb +1 -1
- data/app/models/concerns/camaleon_cms/custom_fields_read.rb +6 -4
- data/app/models/concerns/camaleon_cms/metas.rb +5 -4
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_fields.html.erb +4 -2
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_external_menu.html.erb +1 -1
- data/app/views/camaleon_cms/admin/appearances/nav_menus/index.html.erb +3 -6
- data/app/views/camaleon_cms/admin/categories/index.html.erb +1 -0
- data/app/views/camaleon_cms/admin/media/_files_list.html.erb +3 -3
- data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +3 -2
- data/app/views/camaleon_cms/admin/media/index.html.erb +31 -4
- data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +10 -1
- data/app/views/camaleon_cms/admin/posts/form.html.erb +6 -2
- data/app/views/camaleon_cms/admin/posts/index.html.erb +4 -4
- data/app/views/camaleon_cms/admin/search.html.erb +5 -3
- data/app/views/camaleon_cms/admin/settings/_file_system_settings.html.erb +5 -5
- data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +2 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_date.html.erb +3 -4
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_image.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/post_types/_form.html.erb +11 -1
- data/app/views/camaleon_cms/admin/settings/post_types/index.html.erb +1 -0
- data/app/views/camaleon_cms/admin/users/form.html.erb +30 -55
- data/app/views/camaleon_cms/html_mailer/mailer.html.erb +1 -1
- data/app/views/camaleon_cms/html_mailer/password_reset.html.erb +3 -0
- data/app/views/layouts/camaleon_cms/admin.html.erb +4 -1
- data/app/views/layouts/camaleon_cms/admin/_ajax.html.erb +3 -1
- data/app/views/layouts/camaleon_cms/admin/_footer.html.erb +1 -1
- data/app/views/layouts/camaleon_cms/admin/_header.html.erb +1 -1
- data/config/initializers/assets.rb +4 -2
- data/config/initializers/model_alias.rb +11 -0
- data/config/locales/camaleon_cms/admin/en.yml +2 -0
- data/config/locales/camaleon_cms/admin/es.yml +2 -1
- data/config/locales/camaleon_cms/admin/it.yml +1 -0
- data/config/locales/camaleon_cms/admin/js.yml +42 -1
- data/config/locales/camaleon_cms/admin/nl.yml +659 -0
- data/config/locales/camaleon_cms/admin/pt_br.yml +1 -0
- data/config/locales/camaleon_cms/admin/ru.yml +659 -0
- data/config/locales/camaleon_cms/common.yml +127 -0
- data/config/locales/camaleon_cms/languages.yml +16 -0
- data/config/locales/camaleon_cms/routes.yml +8 -0
- data/config/locales/nl.yml +209 -0
- data/config/routes.rb +1 -1
- data/config/routes/admin.rb +5 -4
- data/config/routes/frontend.rb +16 -3
- data/config/system.json +2 -3
- data/lib/camaleon_cms/engine.rb +5 -1
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/ext/array.rb +5 -0
- data/lib/generators/camaleon_cms/gem_plugin_generator.rb +1 -1
- data/lib/generators/camaleon_cms/gem_plugin_template/app/models/plugins/my_plugin/my_plugin.rb +1 -2
- data/lib/generators/camaleon_cms/gem_plugin_template/config/{custom_models.rb → initializers/custom_models.rb} +0 -0
- data/lib/plugin_routes.rb +38 -63
- data/lib/tasks/camaleon_cms/camaleon_tasks.rake +18 -0
- data/lib/tasks/camaleon_cms/rspec_test.rake +7 -4
- metadata +43 -54
- data/app/assets/javascripts/camaleon_cms/admin/bootstrap-datetimepicker.min.js +0 -26
- data/app/assets/javascripts/camaleon_cms/admin/plugins.js +0 -637
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/visualblocks/css/visualblocks.css +0 -135
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/content.min.css.scss +0 -4
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.svg +0 -62
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.svg +0 -83
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/object.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/themes/modern/theme.min.js +0 -1
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/tinymce.min.js +0 -11
- data/app/assets/stylesheets/camaleon_cms/admin/bootstrap-datetimepicker.css.scss +0 -339
@@ -14,6 +14,7 @@ class CamaleonCms::PostTagDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
14
14
|
args = args.extract_options!
|
15
15
|
args[:post_tag_id] = the_id
|
16
16
|
args[:title] = the_title.parameterize
|
17
|
+
args[:title] = the_slug unless args[:title].present?
|
17
18
|
args[:locale] = get_locale unless args.include?(:locale)
|
18
19
|
args[:format] = "html"
|
19
20
|
as_path = args.delete(:as_path)
|
@@ -10,10 +10,27 @@ class CamaleonCms::PostTypeDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
10
10
|
delegate_all
|
11
11
|
|
12
12
|
# return the public url for this post type
|
13
|
+
# Sample: http://localhost/my-group.html
|
13
14
|
def the_url(*args)
|
15
|
+
args = args.extract_options!
|
16
|
+
args[:post_type_id] = the_id
|
17
|
+
args[:locale] = get_locale unless args.include?(:locale)
|
18
|
+
args[:format] = "html"
|
19
|
+
as_path = args.delete(:as_path)
|
20
|
+
begin
|
21
|
+
h.cama_url_to_fixed("cama_post_type_#{self.id}#{_calc_locale(args[:locale])}_#{as_path.present? ? "path" : "url"}", args)
|
22
|
+
rescue
|
23
|
+
the_group_url(args)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# return the public url with group structure
|
28
|
+
# Sample: http://localhost/group/10-my-group.html
|
29
|
+
def the_group_url(*args)
|
14
30
|
args = args.extract_options!
|
15
31
|
args[:post_type_id] = the_id
|
16
32
|
args[:title] = the_title.parameterize
|
33
|
+
args[:title] = the_slug unless args[:title].present?
|
17
34
|
args[:locale] = get_locale unless args.include?(:locale)
|
18
35
|
args[:format] = "html"
|
19
36
|
as_path = args.delete(:as_path)
|
@@ -127,7 +127,7 @@ class CamaleonCms::SiteDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
127
127
|
lan.each do |lang|
|
128
128
|
path = lang.to_s+'.png'
|
129
129
|
img = "<img src='#{h.asset_path("camaleon_cms/language/#{path}")}'/>"
|
130
|
-
res << "<li class='#{ current_class if I18n.locale.to_s == lang.to_s}'> <a href='#{h.cama_url_to_fixed(current_page ? "url_for" : "cama_root_url", {locale: lang})}'>#{img}</a> </li>"
|
130
|
+
res << "<li class='#{ current_class if I18n.locale.to_s == lang.to_s}'> <a href='#{h.cama_url_to_fixed(current_page ? "url_for" : "cama_root_url", {locale: lang, cama_set_language: lang})}'>#{img}</a> </li>"
|
131
131
|
end
|
132
132
|
res << "</ul>"
|
133
133
|
res.join("")
|
@@ -154,12 +154,27 @@ class CamaleonCms::SiteDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
154
154
|
# return root url for this site
|
155
155
|
def the_url(*args)
|
156
156
|
args = args.extract_options!
|
157
|
-
args[:
|
158
|
-
|
157
|
+
unless args[:as_path]
|
158
|
+
args[:host] = object.main_site? ? object.slug : (object.slug.include?(".") ? object.slug : "#{object.slug}.#{Cama::Site.main_site.slug}")
|
159
|
+
args[:port] = (args[:host].split(":")[1] rescue nil)
|
160
|
+
args[:host] = args[:host].split(":").first
|
161
|
+
end
|
159
162
|
args[:locale] = @_deco_locale unless args.include?(:locale)
|
160
|
-
|
161
|
-
args.delete(:as_path)
|
162
|
-
|
163
|
+
postfix = 'url'
|
164
|
+
postfix = 'path' if args.delete(:as_path)
|
165
|
+
begin
|
166
|
+
h.cama_url_to_fixed("cama_root_#{postfix}", args)
|
167
|
+
rescue # undefined method `host' for nil:NilClass (called from rake:tasks)
|
168
|
+
parms = args.except(:host, :port, :locale, :as_path)
|
169
|
+
"http://#{args[:host]}#{":#{args[:port]}" if args[:port].present?}#{"/#{args[:locale]}" if args[:locale].present?}/#{"?#{parms.to_param}" if parms.present?}"
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# return the path for this site
|
174
|
+
def the_path(*args)
|
175
|
+
args = args.extract_options!
|
176
|
+
args[:as_path] = true
|
177
|
+
the_url(args)
|
163
178
|
end
|
164
179
|
|
165
180
|
# draw bread crumb for current site
|
@@ -170,7 +185,7 @@ class CamaleonCms::SiteDecorator < CamaleonCms::TermTaxonomyDecorator
|
|
170
185
|
# =============================== ADMIN =======================
|
171
186
|
# admin root url for this site
|
172
187
|
def the_admin_url
|
173
|
-
host = object.main_site? ?
|
188
|
+
host = object.main_site? ? object.slug : (object.slug.include?(".") ? object.slug : "#{object.slug}.#{Cama::Site.main_site.slug}")
|
174
189
|
port = (host.split(":")[1] rescue nil)
|
175
190
|
h.cama_url_to_fixed("cama_admin_dashboard_url", host: host, port: port, locale: false)
|
176
191
|
end
|
@@ -40,6 +40,7 @@ class CamaleonCms::UserDecorator < CamaleonCms::ApplicationDecorator
|
|
40
40
|
args = args.extract_options!
|
41
41
|
args[:user_id] = the_id
|
42
42
|
args[:user_name] = the_name.parameterize
|
43
|
+
args[:user_name] = the_username unless args[:user_name].present?
|
43
44
|
args[:locale] = get_locale unless args.include?(:locale)
|
44
45
|
args[:format] = "html"
|
45
46
|
as_path = args.delete(:as_path)
|
@@ -11,6 +11,7 @@ module CamaleonCms::Admin::ApplicationHelper
|
|
11
11
|
include CamaleonCms::Admin::MenusHelper
|
12
12
|
include CamaleonCms::Admin::PostTypeHelper
|
13
13
|
include CamaleonCms::Admin::CategoryHelper
|
14
|
+
include CamaleonCms::Admin::CustomFieldsHelper
|
14
15
|
|
15
16
|
# load system notification
|
16
17
|
def admin_system_notifications(args)
|
@@ -34,10 +35,10 @@ module CamaleonCms::Admin::ApplicationHelper
|
|
34
35
|
will_paginate_options.delete(:panel_class)
|
35
36
|
"<div class='row #{custom_class} pagination_panel cama_ajax_request'>
|
36
37
|
<div class='col-md-6'>
|
37
|
-
#{will_paginate
|
38
|
+
#{will_paginate(items, will_paginate_options) rescue '' }
|
38
39
|
</div>
|
39
40
|
<div class='col-md-6 text-right total-items'>
|
40
|
-
<strong>Total: #{items.total_entries} </strong>
|
41
|
+
<strong>Total: #{items.total_entries rescue items.count} </strong>
|
41
42
|
</div>
|
42
43
|
</div>"
|
43
44
|
end
|
@@ -8,9 +8,9 @@
|
|
8
8
|
=end
|
9
9
|
#encoding: utf-8
|
10
10
|
module CamaleonCms::Admin::CustomFieldsHelper
|
11
|
-
def
|
11
|
+
def cama_custom_field_elements
|
12
|
+
return @_cama_custom_field_elements if @_cama_custom_field_elements.present?
|
12
13
|
items = {}
|
13
|
-
|
14
14
|
items[:text_box] = {
|
15
15
|
key: 'text_box',
|
16
16
|
label: t('camaleon_cms.admin.custom_field.fields.text_box'),
|
@@ -72,7 +72,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
72
72
|
show_frontend: true
|
73
73
|
}
|
74
74
|
}
|
75
|
-
|
76
75
|
items[:checkboxes] = {
|
77
76
|
key: 'checkboxes',
|
78
77
|
label: 'Checkboxes',
|
@@ -86,7 +85,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
86
85
|
show_frontend: true
|
87
86
|
}
|
88
87
|
}
|
89
|
-
|
90
88
|
items[:audio] = {
|
91
89
|
key: 'audio',
|
92
90
|
label: 'Audio',
|
@@ -97,9 +95,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
97
95
|
show_frontend: true
|
98
96
|
}
|
99
97
|
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
98
|
items[:colorpicker] = {
|
104
99
|
key: 'colorpicker',
|
105
100
|
label: t('camaleon_cms.admin.custom_field.fields.colorpicker'),
|
@@ -131,7 +126,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
131
126
|
show_frontend: true
|
132
127
|
}
|
133
128
|
}
|
134
|
-
|
135
129
|
items[:date] = {
|
136
130
|
key: 'date',
|
137
131
|
label: t('camaleon_cms.admin.custom_field.fields.date'),
|
@@ -158,7 +152,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
158
152
|
show_frontend: true
|
159
153
|
}
|
160
154
|
}
|
161
|
-
|
162
155
|
items[:editor] = {
|
163
156
|
key: 'editor',
|
164
157
|
label: 'Editor',
|
@@ -170,7 +163,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
170
163
|
show_frontend: true
|
171
164
|
}
|
172
165
|
}
|
173
|
-
|
174
166
|
items[:email] = {
|
175
167
|
key: 'email',
|
176
168
|
label: t('camaleon_cms.admin.custom_field.fields.email'),
|
@@ -181,7 +173,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
181
173
|
show_frontend: true
|
182
174
|
}
|
183
175
|
}
|
184
|
-
|
185
176
|
items[:file] = {
|
186
177
|
key: 'file',
|
187
178
|
label: t('camaleon_cms.admin.custom_field.fields.file'),
|
@@ -199,7 +190,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
199
190
|
}
|
200
191
|
]
|
201
192
|
}
|
202
|
-
|
203
193
|
items[:image] = {
|
204
194
|
key: 'image',
|
205
195
|
label: t('camaleon_cms.admin.custom_field.fields.image'),
|
@@ -208,9 +198,16 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
208
198
|
multiple: true,
|
209
199
|
default_value: true,
|
210
200
|
show_frontend: true
|
211
|
-
}
|
201
|
+
},
|
202
|
+
extra_fields:[
|
203
|
+
{
|
204
|
+
type: 'text_box',
|
205
|
+
key: 'dimension',
|
206
|
+
label: 'Dimensions',
|
207
|
+
description: 'Crop images with dimension (widthxheight), sample:<br>400x300 | 400x | x300 | ?400x?500 | ?1400x (? => maximum, empty => auto)'
|
208
|
+
}
|
209
|
+
]
|
212
210
|
}
|
213
|
-
|
214
211
|
items[:numeric] = {
|
215
212
|
key: 'numeric',
|
216
213
|
label: t('camaleon_cms.admin.custom_field.fields.numeric'),
|
@@ -221,7 +218,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
221
218
|
show_frontend: true
|
222
219
|
}
|
223
220
|
}
|
224
|
-
|
225
221
|
items[:phone] = {
|
226
222
|
key: 'phone',
|
227
223
|
label: t('camaleon_cms.admin.custom_field.fields.phone'),
|
@@ -232,8 +228,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
232
228
|
show_frontend: true
|
233
229
|
}
|
234
230
|
}
|
235
|
-
|
236
|
-
|
237
231
|
items[:url] = {
|
238
232
|
key: 'url',
|
239
233
|
label: 'URL',
|
@@ -254,7 +248,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
254
248
|
show_frontend: true
|
255
249
|
}
|
256
250
|
}
|
257
|
-
|
258
251
|
items[:users] = {
|
259
252
|
key: 'users',
|
260
253
|
label: t('camaleon_cms.admin.custom_field.fields.users'),
|
@@ -264,7 +257,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
264
257
|
show_frontend: true
|
265
258
|
}
|
266
259
|
}
|
267
|
-
|
268
260
|
items[:posts] = {
|
269
261
|
key: 'posts',
|
270
262
|
label: t('camaleon_cms.admin.custom_field.fields.posts'),
|
@@ -282,7 +274,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
282
274
|
}
|
283
275
|
]
|
284
276
|
}
|
285
|
-
|
286
277
|
# evaluate the content of command value on listing
|
287
278
|
# sample: get_select_options({})
|
288
279
|
items[:select_eval] = {
|
@@ -302,7 +293,6 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
302
293
|
}
|
303
294
|
]
|
304
295
|
}
|
305
|
-
|
306
296
|
items[:field_attrs] = {
|
307
297
|
key: 'field_attrs',
|
308
298
|
label: t('camaleon_cms.admin.custom_field.fields.field_attrs'),
|
@@ -312,10 +302,8 @@ module CamaleonCms::Admin::CustomFieldsHelper
|
|
312
302
|
show_frontend: true
|
313
303
|
}
|
314
304
|
}
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
items
|
305
|
+
r = {fields: items}; hooks_run("extra_custom_fields", r)
|
306
|
+
@_cama_custom_field_elements = r[:fields]
|
319
307
|
end
|
320
308
|
|
321
309
|
# add your model class into custom fields editor
|
@@ -30,6 +30,31 @@ module CamaleonCms::Admin::PostTypeHelper
|
|
30
30
|
return html
|
31
31
|
end
|
32
32
|
|
33
|
+
|
34
|
+
# sort array of posts to build post's tree
|
35
|
+
# skip_non_parent_posts: don't include post's where root post doesn't exist
|
36
|
+
# internal control for recursive items
|
37
|
+
def cama_hierarchy_post_list(posts_list, parent_id = nil, skip_non_parent_posts = false)
|
38
|
+
res = []
|
39
|
+
@_cama_hierarchy_post_list_no_parent ||= posts_list.clone
|
40
|
+
posts_list.each do |element|
|
41
|
+
if element.post_parent.to_s == parent_id.to_s
|
42
|
+
res << element
|
43
|
+
@_cama_hierarchy_post_list_no_parent.delete_item(element)
|
44
|
+
res += cama_hierarchy_post_list(posts_list, element.id)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
if !parent_id.present? && !skip_non_parent_posts
|
49
|
+
@_cama_hierarchy_post_list_no_parent.each do |element|
|
50
|
+
element.show_title_with_parent = true
|
51
|
+
res << element
|
52
|
+
res += cama_hierarchy_post_list(posts_list, element.id)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
res
|
56
|
+
end
|
57
|
+
|
33
58
|
private
|
34
59
|
|
35
60
|
def post_type_taxonomy_html_(categories, taxonomy="categories", name="categories", type="checkbox", values=[], class_cat="", required = false)
|
@@ -38,13 +63,13 @@ module CamaleonCms::Admin::PostTypeHelper
|
|
38
63
|
categories.decorate.each do |f|
|
39
64
|
html += "<li>"
|
40
65
|
html += "<label class='class_slug' data-post_link_edit='#{f.the_edit_url}'> "
|
41
|
-
html += "<input type='#{type}' name='#{name}[]' #{ values.to_i.include?(f.id) ? "checked" : ""} value='#{f.id}' class = '#{ "required" if required }' />"
|
66
|
+
html += "<input data-error-place='#validation_error_list_#{name}' type='#{type}' name='#{name}[]' #{ values.to_i.include?(f.id) ? "checked" : ""} value='#{f.id}' class = '#{ "required" if required }' />"
|
42
67
|
html += "#{f.the_title} </label> "
|
43
68
|
html += post_type_html_inputs(f, "children" , name, type, values, "children") if f.children.present?
|
44
69
|
html += "</li>"
|
45
70
|
end
|
46
71
|
|
47
|
-
html += "</ul>"
|
72
|
+
html += "</ul><div id='validation_error_list_#{name}'></div>"
|
48
73
|
return html
|
49
74
|
end
|
50
75
|
end
|
@@ -7,22 +7,6 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
module CamaleonCms::CamaleonHelper
|
10
|
-
# send and email
|
11
|
-
# email: email to
|
12
|
-
# subject: Subject of the email
|
13
|
-
# content: content of the email
|
14
|
-
# from: email figured as from
|
15
|
-
# attachs: array of files to be attached to the email
|
16
|
-
# layout_name: path of the template to render
|
17
|
-
# template_name: template name to render in template_path
|
18
|
-
def sendmail(email,subject='Tiene una notificacion',content='',from=nil,attachs=[],template_name = 'mailer', layout_name = 'camaleon_cms/mailer')
|
19
|
-
Thread.abort_on_exception=true
|
20
|
-
Thread.new do
|
21
|
-
HtmlMailer.sender(email, subject, content, from, attachs, cama_root_url, current_site, template_name, layout_name, {}).deliver_now
|
22
|
-
ActiveRecord::Base.connection.close
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
10
|
# create the html link with the url passed
|
27
11
|
# verify if current user is logged in, if not, then return nil
|
28
12
|
# return html link
|
@@ -15,7 +15,7 @@ module CamaleonCms::CaptchaHelper
|
|
15
15
|
text = cama_rand_str(len)
|
16
16
|
session[:captcha] = text
|
17
17
|
img.combine_options do |c|
|
18
|
-
c.resize "150x40"
|
18
|
+
# c.resize "150x40"
|
19
19
|
c.gravity 'Center'
|
20
20
|
c.fill("#FFFFFF")
|
21
21
|
c.draw "text 0,5 #{text}"
|
@@ -28,10 +28,16 @@ module CamaleonCms::CaptchaHelper
|
|
28
28
|
# build a captcha tag (image with captcha)
|
29
29
|
# img_args: attributes for image_tag
|
30
30
|
# input_args: attributes for input field
|
31
|
-
def cama_captcha_tag(len = 5, img_args = {alt: ""}, input_args = {})
|
31
|
+
def cama_captcha_tag(len = 5, img_args = {alt: ""}, input_args = {}, bootstrap_group_mode = false)
|
32
32
|
input_args[:placeholder] = "Please enter the text of the image" unless input_args[:placeholder].present?
|
33
33
|
img_args["onclick"] = "this.src = \"#{cama_captcha_url(len: len)}\"+\"&t=\"+(new Date().getTime());"
|
34
|
-
"<
|
34
|
+
img = "<img style='cursor: pointer;' src='#{cama_captcha_url(len: len)}' #{img_args.collect{|k, v| "#{k}='#{v}'" }.join(" ") } />"
|
35
|
+
input = "<input type='text' name='captcha' #{input_args.collect{|k, v| "#{k}='#{v}'" }.join(" ") } />"
|
36
|
+
if bootstrap_group_mode
|
37
|
+
"<div class='input-group input-group-captcha'><span class='input-group-btn' style='vertical-align: top;'>#{img}</span>#{input}</div>"
|
38
|
+
else
|
39
|
+
"<div class='input-group-captcha'>#{img}#{input}</div>"
|
40
|
+
end
|
35
41
|
end
|
36
42
|
|
37
43
|
# verify captcha value
|
@@ -8,20 +8,39 @@ module CamaleonCms::EmailHelper
|
|
8
8
|
# attachs: array of files to be attached to the email
|
9
9
|
# layout_name: path of the template to render
|
10
10
|
# template_name: template name to render in template_path
|
11
|
-
def send_email(email, subject='Tiene una notificacion', content='', from=nil, attachs=[], template_name =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
def send_email(email, subject='Tiene una notificacion', content='', from=nil, attachs=[], template_name = nil, layout_name = nil, extra_data = {})
|
12
|
+
args = {template_name: template_name, layout_name: layout_name, from: from || current_site.get_option("email"), url_base: cama_root_url, content: content, attachs: attachs, extra_data: extra_data, current_site: current_site}
|
13
|
+
cama_send_email(email, subject, args)
|
14
|
+
end
|
15
|
+
|
16
|
+
# short method of send_email
|
17
|
+
def cama_send_email(email_to, subject, args = {})
|
18
|
+
args = {from: current_site.get_option("email"), url_base: cama_root_url, current_site: current_site, cc_to: [], template_name: 'mailer', layout_name: 'camaleon_cms/mailer', format: 'html', subject: subject}.merge(args)
|
19
|
+
args[:attachments] = args[:attachs] if args[:attachs].present?
|
20
|
+
args[:current_site] = args[:current_site].id
|
21
|
+
|
22
|
+
# run hook "email" to customize values
|
23
|
+
hooks_run("email", args)
|
24
|
+
CamaleonCms::HtmlMailer.sender(email_to, args[:subject], args).deliver_later
|
17
25
|
end
|
18
26
|
|
19
27
|
def send_user_confirm_email(user_to_confirm)
|
20
28
|
user_to_confirm.send_confirm_email
|
21
|
-
confirm_email_url = cama_admin_confirm_email_url({h:
|
29
|
+
confirm_email_url = cama_admin_confirm_email_url({h: user_to_confirm.confirm_email_token})
|
22
30
|
Rails.logger.info "Sending email verification to #{user_to_confirm}"
|
23
31
|
extra_data = {:url => confirm_email_url, :fullname => user_to_confirm.fullname}
|
24
32
|
send_email(user_to_confirm.email, t('camaleon_cms.admin.login.confirm.text'), '', nil, [], 'confirm_email', 'camaleon_cms/mailer', extra_data)
|
25
33
|
end
|
26
34
|
|
27
|
-
|
35
|
+
def send_password_reset_email(user_to_send)
|
36
|
+
user_to_send.send_password_reset
|
37
|
+
reset_url = cama_admin_forgot_url({h: user_to_send.password_reset_token})
|
38
|
+
extra_data = {
|
39
|
+
:url => reset_url,
|
40
|
+
:fullname => user_to_send.fullname,
|
41
|
+
:user => user_to_send
|
42
|
+
}
|
43
|
+
send_email(user_to_send.email, t('camaleon_cms.admin.login.message.subject_email'), '', nil, [], 'password_reset', 'camaleon_cms/mailer', extra_data)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -38,6 +38,7 @@ module CamaleonCms::Frontend::NavMenuHelper
|
|
38
38
|
# settings: (Hash) menu settings
|
39
39
|
# index: (Integer) Index Position of this menu
|
40
40
|
# link_attrs: (String) Here you can add your custom attrs for current link, sample: id='my_id' data-title='#{args[:link][:name]}'
|
41
|
+
# item_container_attrs: (String) Here you can add your custom attrs for link container.
|
41
42
|
# In settings you can change the values for this item, like after, before, ..:
|
42
43
|
# sample: lambda{|args| args[:settings][:after] = "<span class='caret'></span>" if args[:has_children]; args[:link_attrs] = "id='#{menu_item.id}'"; }
|
43
44
|
# sample: lambda{|args| args[:settings][:before] = "<i class='fa fa-home'></i>" if args[:level] == 0 && args[:index] == 0; }
|
@@ -83,6 +84,7 @@ module CamaleonCms::Frontend::NavMenuHelper
|
|
83
84
|
settings: _args,
|
84
85
|
has_children: has_children,
|
85
86
|
link_attrs: '',
|
87
|
+
item_container_attrs: '',
|
86
88
|
index: index
|
87
89
|
}
|
88
90
|
args[:callback_item].call(r)
|
@@ -95,8 +97,8 @@ module CamaleonCms::Frontend::NavMenuHelper
|
|
95
97
|
end
|
96
98
|
parent_current = true if _is_current || current_children
|
97
99
|
|
98
|
-
html += "<#{_args[:item_container]} class='#{_args[:item_class]} #{_args[:item_class_parent] if has_children} #{"#{_args[:item_current]}" if _is_current} #{"current-menu-ancestor" if current_children }'>#{_args[:link_before]}
|
99
|
-
<a #{r[:link_attrs]} href='#{data_nav_item[:link]}' class='#{args[:link_current] if _is_current} #{_args[:link_class_parent] if has_children} #{_args[:link_class]}' >#{_args[:before]}#{data_nav_item[:name]}#{_args[:after]}</a> #{_args[:link_after]}
|
100
|
+
html += "<#{_args[:item_container]} #{r[:item_container_attrs]} class='#{_args[:item_class]} #{_args[:item_class_parent] if has_children} #{"#{_args[:item_current]}" if _is_current} #{"current-menu-ancestor" if current_children }'>#{_args[:link_before]}
|
101
|
+
<a #{r[:link_attrs]} href='#{data_nav_item[:link]}' class='#{args[:link_current] if _is_current} #{_args[:link_class_parent] if has_children} #{_args[:link_class]}' #{"data-toggle='dropdown'" if has_children } >#{_args[:before]}#{data_nav_item[:name]}#{_args[:after]}</a> #{_args[:link_after]}
|
100
102
|
#{ html_children }
|
101
103
|
</#{_args[:item_container]}>"
|
102
104
|
index += 1
|
@@ -110,12 +112,6 @@ module CamaleonCms::Frontend::NavMenuHelper
|
|
110
112
|
end
|
111
113
|
end
|
112
114
|
|
113
|
-
# check if menu is the current menu
|
114
|
-
def cama_is_current_menu?(menu_item)
|
115
|
-
r = _get_link_nav_menu(menu_item)
|
116
|
-
r[:current] || site_current_path == r[:link] || site_current_path.sub(".html", "") == r[:link].sub(".html", "") if r.present?
|
117
|
-
end
|
118
|
-
|
119
115
|
#******************* BREADCRUMBS *******************
|
120
116
|
# draw the breadcrumb as html list
|
121
117
|
def breadcrumb_draw
|
@@ -150,26 +146,34 @@ module CamaleonCms::Frontend::NavMenuHelper
|
|
150
146
|
when 'post'
|
151
147
|
post = CamaleonCms::Post.find(nav_menu_item.get_option('object_id')).decorate
|
152
148
|
return false unless post.can_visit?
|
153
|
-
{link: post.the_url(as_path: true), name: post.the_title, type_menu: type_menu, current: @cama_visited_post.present? && @cama_visited_post.id == post.id}
|
149
|
+
r = {link: post.the_url(as_path: true), name: post.the_title, type_menu: type_menu, current: @cama_visited_post.present? && @cama_visited_post.id == post.id}
|
154
150
|
when 'category'
|
155
151
|
category = CamaleonCms::Category.find(nav_menu_item.get_option('object_id')).decorate
|
156
|
-
{link: category.the_url(as_path: true), name: category.the_title, type_menu: type_menu, current: @cama_visited_category.present? && @cama_visited_category.id == category.id}
|
152
|
+
r = {link: category.the_url(as_path: true), name: category.the_title, type_menu: type_menu, current: @cama_visited_category.present? && @cama_visited_category.id == category.id}
|
157
153
|
when 'post_tag'
|
158
154
|
post_tag = CamaleonCms::PostTag.find(nav_menu_item.get_option('object_id')).decorate
|
159
|
-
{link: post_tag.the_url(as_path: true), name: post_tag.the_title, type_menu: type_menu, current: @cama_visited_tag.present? && @cama_visited_tag.id == post_tag.id}
|
155
|
+
r = {link: post_tag.the_url(as_path: true), name: post_tag.the_title, type_menu: type_menu, current: @cama_visited_tag.present? && @cama_visited_tag.id == post_tag.id}
|
160
156
|
when 'post_type'
|
161
157
|
post_type = CamaleonCms::PostType.find(nav_menu_item.get_option('object_id')).decorate
|
162
|
-
{link: post_type.the_url(as_path: true), name: post_type.the_title, type_menu: type_menu, current: @cama_visited_post_type.present? && @cama_visited_post_type.id == post_type.id}
|
158
|
+
r = {link: post_type.the_url(as_path: true), name: post_type.the_title, type_menu: type_menu, current: @cama_visited_post_type.present? && @cama_visited_post_type.id == post_type.id}
|
163
159
|
when 'external'
|
164
|
-
r = {link: nav_menu_item.get_option('object_id', ""), name: nav_menu_item.name.to_s.translate, type_menu: type_menu, current: false}
|
160
|
+
r = {link: nav_menu_item.get_option('object_id', "").to_s.translate, name: nav_menu_item.name.to_s.translate, type_menu: type_menu, current: false}
|
161
|
+
r[:link] = cama_root_path if r[:link] == "root_url"
|
162
|
+
r[:link] = site_current_path if site_current_path == "#{current_site.the_path}#{r[:link]}"
|
165
163
|
r[:current] = r[:link] == site_current_url || r[:link] == site_current_path
|
166
|
-
r[:link] = cama_url_to_fixed("cama_root_url") if r[:link] == "root_url"
|
167
164
|
r
|
168
165
|
else
|
169
|
-
false
|
166
|
+
return false
|
170
167
|
end
|
171
|
-
rescue
|
172
|
-
|
168
|
+
rescue => e
|
169
|
+
puts "-------------------------- menu item error: #{e.message}"
|
170
|
+
return false
|
173
171
|
end
|
172
|
+
|
173
|
+
# permit to mark as a current menu custom paths
|
174
|
+
# sample: @cama_current_menu_path = '/my_section'
|
175
|
+
# sample2: @cama_current_menu_path = ['/my_section', '/mi_seccion'] # multi language support
|
176
|
+
r[:current] = true if @cama_current_menu_path.present? && !r[:current] && (@cama_current_menu_path.is_a?(String) ? @cama_current_menu_path == r[:link] : @cama_current_menu_path.include?(r[:link]))
|
177
|
+
r
|
174
178
|
end
|
175
179
|
end
|