camaleon_cms 2.0.4.1 → 2.1.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/app/apps/plugins/contact_form/contact_form_helper.rb +1 -1
- data/app/apps/plugins/contact_form/views/forms_shorcode.html.erb +1 -0
- data/app/apps/plugins/front_cache/front_cache_helper.rb +1 -1
- data/app/apps/themes/camaleon_first/assets/css/main.css +1 -0
- data/app/apps/themes/camaleon_first/views/layouts/index.html.erb +0 -1
- data/app/apps/themes/new/assets/css/main.css +1 -0
- data/app/apps/themes/new/views/layouts/index.html.erb +0 -1
- data/app/assets/javascripts/camaleon_cms/admin/_libraries.js +15 -13
- data/app/assets/javascripts/camaleon_cms/admin/_post.js +2 -3
- data/app/assets/javascripts/camaleon_cms/admin/uploader/_jquery.form.js +1277 -0
- data/app/assets/javascripts/camaleon_cms/admin/uploader/uploader_manifest.js +1 -0
- data/app/assets/stylesheets/camaleon_cms/admin/admin-basic-manifest.css +1 -0
- data/app/assets/stylesheets/camaleon_cms/admin/admin-manifest.css +1 -0
- data/app/assets/stylesheets/camaleon_cms/admin/uploader/_uploadfile.css.scss +6 -8
- data/app/controllers/camaleon_cms/admin/posts/drafts_controller.rb +8 -5
- data/app/controllers/camaleon_cms/admin/sessions_controller.rb +31 -4
- data/app/controllers/camaleon_cms/camaleon_controller.rb +1 -0
- data/app/controllers/camaleon_cms/frontend_controller.rb +2 -1
- data/app/decorators/camaleon_cms/application_decorator.rb +3 -2
- data/app/decorators/camaleon_cms/custom_field_decorator.rb +3 -8
- data/app/decorators/camaleon_cms/post_decorator.rb +8 -8
- data/app/decorators/camaleon_cms/term_taxonomy_decorator.rb +2 -2
- data/app/helpers/camaleon_cms/admin/menus_helper.rb +2 -2
- data/app/helpers/camaleon_cms/camaleon_helper.rb +2 -2
- data/app/helpers/camaleon_cms/email_helper.rb +27 -0
- data/app/helpers/camaleon_cms/frontend/seo_helper.rb +17 -20
- data/app/helpers/camaleon_cms/frontend/site_helper.rb +6 -5
- data/app/helpers/camaleon_cms/html_helper.rb +21 -0
- data/app/helpers/camaleon_cms/plugins_helper.rb +2 -1
- data/app/helpers/camaleon_cms/session_helper.rb +2 -1
- data/app/mailers/camaleon_cms/html_mailer.rb +14 -13
- data/app/models/camaleon_cms/nav_menu_item.rb +4 -6
- data/app/models/camaleon_cms/site.rb +5 -0
- data/app/models/camaleon_cms/term_taxonomy.rb +0 -3
- data/app/models/camaleon_cms/user.rb +6 -1
- data/app/models/camaleon_cms/user_relationship.rb +0 -2
- data/app/models/camaleon_cms/user_role.rb +1 -0
- data/app/models/concerns/camaleon_cms/custom_fields_read.rb +1 -0
- data/app/views/camaleon_cms/admin/media/index.html.erb +31 -14
- data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +2 -2
- 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/post_types/_form.html.erb +7 -0
- data/app/views/camaleon_cms/default_theme/layouts/index.html.erb +0 -1
- data/app/views/camaleon_cms/default_theme/partials/_render_custom_field.html.erb +1 -3
- data/app/views/camaleon_cms/html_mailer/confirm_email.html.erb +3 -0
- data/app/views/camaleon_cms/shortcode_templates/widget.html.erb +2 -2
- data/app/views/layouts/camaleon_cms/admin.html.erb +0 -1
- data/app/views/layouts/camaleon_cms/admin/_footer.html.erb +1 -1
- data/app/views/layouts/camaleon_cms/admin/installer.html.erb +0 -1
- data/app/views/layouts/camaleon_cms/login.html.erb +0 -1
- data/config/initializers/sass.rb +6 -6
- data/config/locales/camaleon_cms/admin/en.yml +10 -0
- data/config/locales/camaleon_cms/admin/es.yml +10 -0
- data/config/routes/admin.rb +1 -2
- data/config/routes/frontend.rb +2 -2
- data/db/migrate/20151212095328_add_confirm_token_to_users.rb +7 -0
- data/lib/camaleon_cms/engine.rb +1 -0
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/generators/camaleon_cms/gem_theme_template/app/assets/stylesheets/themes/my_plugin/main.css +1 -0
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/layouts/index.html.erb +0 -1
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/assets/css/main.css +1 -0
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +0 -1
- metadata +20 -20
- data/public/docs/index.html +0 -70
- data/public/docs/swagger-ui/css/highlight.default.css +0 -135
- data/public/docs/swagger-ui/css/screen.css +0 -1070
- data/public/docs/swagger-ui/images/logo_small.png +0 -0
- data/public/docs/swagger-ui/images/throbber.gif +0 -0
- data/public/docs/swagger-ui/lib/backbone-min.js +0 -38
- data/public/docs/swagger-ui/lib/handlebars-1.0.0.js +0 -2278
- data/public/docs/swagger-ui/lib/highlight.7.3.pack.js +0 -1
- data/public/docs/swagger-ui/lib/jquery-1.8.0.min.js +0 -2
- data/public/docs/swagger-ui/lib/jquery.ba-bbq.min.js +0 -18
- data/public/docs/swagger-ui/lib/jquery.slideto.min.js +0 -1
- data/public/docs/swagger-ui/lib/jquery.wiggle.min.js +0 -8
- data/public/docs/swagger-ui/lib/shred.bundle.js +0 -2765
- data/public/docs/swagger-ui/lib/shred/content.js +0 -193
- data/public/docs/swagger-ui/lib/swagger.js +0 -1253
- data/public/docs/swagger-ui/lib/underscore-min.js +0 -32
- data/public/docs/swagger-ui/swagger-ui.js +0 -2039
- data/public/docs/swagger-ui/swagger-ui.min.js +0 -1
@@ -85,7 +85,7 @@ margin: 5px 10px 5px 0px;
|
|
85
85
|
font-size: 16px;
|
86
86
|
font-weight: bold;
|
87
87
|
padding: 15px 20px;
|
88
|
-
cursor:pointer;
|
88
|
+
cursor:pointer;
|
89
89
|
line-height:20px;
|
90
90
|
height:25px;
|
91
91
|
margin:0 10px 10px 0;
|
@@ -99,17 +99,17 @@ margin: 5px 10px 5px 0px;
|
|
99
99
|
-moz-border-radius: 3px;
|
100
100
|
-moz-box-shadow: 0 2px 0 0 #e8e8e8;
|
101
101
|
-webkit-box-shadow: 0 2px 0 0 #e8e8e8;
|
102
|
-
box-shadow: 0 2px 0 0 #e8e8e8;
|
103
|
-
padding: 6px 10px 4px 10px;
|
102
|
+
box-shadow: 0 2px 0 0 #e8e8e8;
|
103
|
+
padding: 6px 10px 4px 10px;
|
104
104
|
color: #fff;
|
105
105
|
background: #2f8ab9;
|
106
106
|
border: none;
|
107
107
|
-moz-box-shadow: 0 2px 0 0 #13648d;
|
108
108
|
-webkit-box-shadow: 0 2px 0 0 #13648d;
|
109
|
-
box-shadow: 0 2px 0 0 #13648d;
|
110
|
-
vertical-align: middle;
|
109
|
+
box-shadow: 0 2px 0 0 #13648d;
|
110
|
+
vertical-align: middle;
|
111
111
|
}
|
112
|
-
|
112
|
+
|
113
113
|
.ajax-file-upload:hover {
|
114
114
|
background: #3396c9;
|
115
115
|
-moz-box-shadow: 0 2px 0 0 #15719f;
|
@@ -137,9 +137,7 @@ margin: 5px 10px 5px 0px;
|
|
137
137
|
margin:20px 0px 20px 0px;
|
138
138
|
}
|
139
139
|
#cama_media_gallery{
|
140
|
-
background-color: #fff;
|
141
140
|
position: relative;
|
142
|
-
padding-top: 37px;
|
143
141
|
.media_browser_list{
|
144
142
|
background-color: #fff;
|
145
143
|
border-right: 1px solid #3C8DBC;
|
@@ -16,14 +16,17 @@ class CamaleonCms::Admin::Posts::DraftsController < CamaleonCms::Admin::PostsCon
|
|
16
16
|
def create
|
17
17
|
if params[:post_id].present?
|
18
18
|
@post_draft = CamaleonCms::Post.drafts.where(post_parent: params[:post_id]).first
|
19
|
-
|
19
|
+
if @post_draft.present?
|
20
|
+
@post_draft.set_option('draft_status', @post_draft.status)
|
21
|
+
@post_draft.attributes = @post_data
|
22
|
+
end
|
20
23
|
end
|
21
24
|
@post_draft = @post_type.posts.new(@post_data) unless @post_draft.present?
|
22
|
-
r = {post: @post_draft, post_type:
|
25
|
+
r = {post: @post_draft, post_type: @post_type}; hooks_run("create_post_draft", r)
|
23
26
|
if @post_draft.save(:validate => false)
|
24
27
|
@post_draft.set_params(params[:meta], params[:field_options], @post_data[:keywords])
|
25
28
|
msg = {draft: {id: @post_draft.id}, _drafts_path: cama_admin_post_type_draft_path(@post_type.id, @post_draft)}
|
26
|
-
r = {post: @post_draft, post_type: ""}; hooks_run("
|
29
|
+
r = {post: @post_draft, post_type: ""}; hooks_run("created_post_draft", r)
|
27
30
|
else
|
28
31
|
msg = {error: @post_draft.errors.full_messages}
|
29
32
|
end
|
@@ -34,10 +37,10 @@ class CamaleonCms::Admin::Posts::DraftsController < CamaleonCms::Admin::PostsCon
|
|
34
37
|
def update
|
35
38
|
@post_draft = CamaleonCms::Post.drafts.find(params[:id])
|
36
39
|
@post_draft.attributes = @post_data
|
37
|
-
r = {post: @post_draft, post_type:
|
40
|
+
r = {post: @post_draft, post_type: @post_type}; hooks_run("update_post", r)
|
38
41
|
if @post_draft.save(validate: false)
|
39
42
|
@post_draft.set_params(params[:meta], params[:field_options], @post_data[:keywords])
|
40
|
-
hooks_run("
|
43
|
+
hooks_run("updated_post_draft", {post: @post_draft, post_type: ""})
|
41
44
|
msg = {draft: {id: @post_draft.id}}
|
42
45
|
else
|
43
46
|
msg = {error: @post_draft.errors.full_messages}
|
@@ -18,6 +18,7 @@ class CamaleonCms::Admin::SessionsController < CamaleonCms::CamaleonController
|
|
18
18
|
if signin?
|
19
19
|
return redirect_to (params[:return_to].present? ? params[:return_to] : cama_admin_dashboard_path)
|
20
20
|
else
|
21
|
+
cookies[:return_to] = params[:return_to] if params[:return_to].present?
|
21
22
|
@user ||= current_site.users.new
|
22
23
|
end
|
23
24
|
render "login"
|
@@ -32,9 +33,16 @@ class CamaleonCms::Admin::SessionsController < CamaleonCms::CamaleonController
|
|
32
33
|
r = {user: @user, params: params, password: data_user[:password], captcha_validate: captcha_validate, stop_process: false}; hooks_run("user_before_login", r)
|
33
34
|
return if r[:stop_process] # permit to redirect for data completion
|
34
35
|
if captcha_validate && @user && @user.authenticate(data_user[:password])
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
#Email validation if is necessary
|
37
|
+
if @user.is_valid_email? || !current_site.need_validate_email?
|
38
|
+
cama_captcha_reset_attack("login")
|
39
|
+
r={user: @user, redirect_to: nil}; hooks_run('after_login', r)
|
40
|
+
login_user(@user, params[:remember_me].present?, r[:redirect_to])
|
41
|
+
else
|
42
|
+
flash[:error] = t('camaleon_cms.admin.login.message.email_not_validated')
|
43
|
+
@user = current_site.users.new(data_user)
|
44
|
+
login
|
45
|
+
end
|
38
46
|
else
|
39
47
|
cama_captcha_increment_attack("login")
|
40
48
|
if captcha_validate
|
@@ -69,7 +77,7 @@ class CamaleonCms::Admin::SessionsController < CamaleonCms::CamaleonController
|
|
69
77
|
if params[:user].present?
|
70
78
|
if @user.update(params[:user].permit(:password, :password_confirmation))
|
71
79
|
flash[:notice] = t('camaleon_cms.admin.login.message.reset_password_succes')
|
72
|
-
redirect_to
|
80
|
+
redirect_to cama_admin_login_path
|
73
81
|
return
|
74
82
|
else
|
75
83
|
flash[:error] = t('camaleon_cms.admin.login.message.reset_password_error')
|
@@ -110,6 +118,7 @@ class CamaleonCms::Admin::SessionsController < CamaleonCms::CamaleonController
|
|
110
118
|
@user ||= current_site.users.new
|
111
119
|
if params[:user].present?
|
112
120
|
params[:user][:role] = PluginRoutes.system_info["default_user_role"]
|
121
|
+
params[:user][:is_valid_email] = false if current_site.need_validate_email?
|
113
122
|
user_data = params[:user]
|
114
123
|
result = cama_register_user(user_data, params[:meta])
|
115
124
|
if result[:result] == false && result[:type] == :captcha_error
|
@@ -120,6 +129,7 @@ class CamaleonCms::Admin::SessionsController < CamaleonCms::CamaleonController
|
|
120
129
|
render 'register'
|
121
130
|
elsif result[:result]
|
122
131
|
flash[:notice] = result[:message]
|
132
|
+
send_user_confirm_email(@user) if current_site.need_validate_email?
|
123
133
|
r = {user: @user, redirect_url: result[:redirect_url]}; hooks_run('user_registered', r)
|
124
134
|
redirect_to r[:redirect_url]
|
125
135
|
else
|
@@ -132,6 +142,23 @@ class CamaleonCms::Admin::SessionsController < CamaleonCms::CamaleonController
|
|
132
142
|
end
|
133
143
|
end
|
134
144
|
|
145
|
+
def confirm_email
|
146
|
+
@user = current_site.users.new
|
147
|
+
if params[:h]
|
148
|
+
@user = current_site.users.where(confirm_email_token: params[:h]).first
|
149
|
+
if @user.nil?
|
150
|
+
flash[:error] = t('camaleon_cms.admin.login.message.confirm_email_token_incorrect')
|
151
|
+
elsif @user.confirm_email_sent_at.nil? || @user.confirm_email_sent_at < 2.hours.ago
|
152
|
+
flash[:error] = t('camaleon_cms.admin.login.message.confirm_email_token_expired')
|
153
|
+
else
|
154
|
+
flash[:notice] = t('camaleon_cms.admin.login.message.confirm_email_success')
|
155
|
+
@user.is_valid_email = true
|
156
|
+
@user.save!
|
157
|
+
end
|
158
|
+
end
|
159
|
+
redirect_to cama_admin_login_path
|
160
|
+
end
|
161
|
+
|
135
162
|
private
|
136
163
|
|
137
164
|
def before_hook_session
|
@@ -23,6 +23,7 @@ class CamaleonCms::CamaleonController < ApplicationController
|
|
23
23
|
include CamaleonCms::ContentHelper
|
24
24
|
include CamaleonCms::CaptchaHelper
|
25
25
|
include CamaleonCms::UploaderHelper
|
26
|
+
include CamaleonCms::EmailHelper
|
26
27
|
include Mobu::DetectMobile
|
27
28
|
|
28
29
|
prepend_before_action :cama_load_custom_models
|
@@ -82,7 +82,8 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
82
82
|
# search contents
|
83
83
|
def search
|
84
84
|
breadcrumb_add(ct("search"))
|
85
|
-
@cama_visited_search =
|
85
|
+
@cama_visited_search = true
|
86
|
+
@param_search = params[:q]
|
86
87
|
layout_ = lookup_context.template_exists?("layouts/search") ? "search" : (self.send :_layout)
|
87
88
|
r = {layout: layout_, render: "search", posts: nil}; hooks_run("on_render_search", r)
|
88
89
|
@posts = r[:posts] != nil ? r[:posts] : current_site.the_posts.where("title LIKE ? OR content_filtered LIKE ?", "%#{params[:q]}%", "%#{params[:q]}%")
|
@@ -18,8 +18,8 @@ class CamaleonCms::ApplicationDecorator < Draper::Decorator
|
|
18
18
|
k.to_s.translate(get_locale)
|
19
19
|
end
|
20
20
|
|
21
|
-
def the_slug
|
22
|
-
object.slug.translate(get_locale)
|
21
|
+
def the_slug(locale = nil)
|
22
|
+
object.slug.translate(get_locale(locale))
|
23
23
|
end
|
24
24
|
|
25
25
|
# return the identifier
|
@@ -53,6 +53,7 @@ class CamaleonCms::ApplicationDecorator < Draper::Decorator
|
|
53
53
|
# if the request is not for frontend, then this will show current locale visited
|
54
54
|
def get_locale(locale = nil)
|
55
55
|
l = locale || @_deco_locale
|
56
|
+
return l if l.present?
|
56
57
|
(h.cama_is_admin_request? rescue false) ? h.current_site.get_languages.first : l
|
57
58
|
end
|
58
59
|
|
@@ -10,15 +10,10 @@ class CamaleonCms::CustomFieldDecorator < Draper::Decorator
|
|
10
10
|
delegate_all
|
11
11
|
|
12
12
|
def the_name
|
13
|
-
|
13
|
+
h.cama_print_i18n_value(object.name)
|
14
14
|
end
|
15
|
+
|
15
16
|
def the_description
|
16
|
-
|
17
|
-
eval(object.description.sub('t(', 'I18n.t('))
|
18
|
-
elsif object.description.start_with?('eval(')
|
19
|
-
eval(object.description)
|
20
|
-
else
|
21
|
-
object.description
|
22
|
-
end
|
17
|
+
h.cama_print_i18n_value(object.description)
|
23
18
|
end
|
24
19
|
end
|
@@ -11,8 +11,8 @@ class CamaleonCms::PostDecorator < CamaleonCms::ApplicationDecorator
|
|
11
11
|
delegate_all
|
12
12
|
|
13
13
|
|
14
|
-
def the_title
|
15
|
-
r = {title: object.title.to_s.translate(get_locale), post: object}
|
14
|
+
def the_title(locale = nil)
|
15
|
+
r = {title: object.title.to_s.translate(get_locale(locale)), post: object}
|
16
16
|
h.hooks_run("post_the_title", r)
|
17
17
|
r[:title]
|
18
18
|
end
|
@@ -64,9 +64,9 @@ class CamaleonCms::PostDecorator < CamaleonCms::ApplicationDecorator
|
|
64
64
|
# Return String URL
|
65
65
|
def the_url(*args)
|
66
66
|
args = args.extract_options!
|
67
|
-
args[:slug] = the_slug
|
68
67
|
args[:locale] = get_locale unless args.include?(:locale)
|
69
68
|
args[:format] = "html"
|
69
|
+
args[:slug] = the_slug(args[:locale])
|
70
70
|
p = args.delete(:as_path).present? ? "path" : "url"
|
71
71
|
l = _calc_locale(args[:locale])
|
72
72
|
ptype = object.post_type.decorate
|
@@ -74,25 +74,25 @@ class CamaleonCms::PostDecorator < CamaleonCms::ApplicationDecorator
|
|
74
74
|
case p_url_format
|
75
75
|
when "post_of_post_type"
|
76
76
|
args[:post_type_id] = ptype.id
|
77
|
-
args[:title] = ptype.the_title.parameterize
|
77
|
+
args[:title] = ptype.the_title(args[:locale]).parameterize
|
78
78
|
when "post_of_category"
|
79
79
|
if ptype.manage_categories?
|
80
80
|
cat = object.categories.first.decorate rescue ptype.default_category.decorate
|
81
81
|
args[:category_id] = cat.id
|
82
|
-
args[:title] = cat.the_title.parameterize
|
82
|
+
args[:title] = cat.the_title(args[:locale]).parameterize
|
83
83
|
else
|
84
84
|
p_url_format = "post"
|
85
85
|
l = ""
|
86
86
|
end
|
87
87
|
when "post_of_posttype"
|
88
|
-
args[:post_type_title] = ptype.the_title.parameterize
|
88
|
+
args[:post_type_title] = ptype.the_title(args[:locale]).parameterize
|
89
89
|
l = ""
|
90
90
|
when "post_of_category_post_type"
|
91
91
|
if ptype.manage_categories?
|
92
92
|
cat = object.categories.first.decorate rescue ptype.default_category.decorate
|
93
|
-
args[:post_type_title] = ptype.the_title.parameterize
|
93
|
+
args[:post_type_title] = ptype.the_title(args[:locale]).parameterize
|
94
94
|
args[:category_id] = cat.id
|
95
|
-
args[:title] = cat.the_title.parameterize
|
95
|
+
args[:title] = cat.the_title(args[:locale]).parameterize
|
96
96
|
else
|
97
97
|
p_url_format = "post"
|
98
98
|
l = ""
|
@@ -11,8 +11,8 @@ class CamaleonCms::TermTaxonomyDecorator < CamaleonCms::ApplicationDecorator
|
|
11
11
|
delegate_all
|
12
12
|
|
13
13
|
# return the title for current locale
|
14
|
-
def the_title
|
15
|
-
r = {title: object.name.translate(get_locale), object: object}
|
14
|
+
def the_title(locale = nil)
|
15
|
+
r = {title: object.name.translate(get_locale(locale)), object: object}
|
16
16
|
h.hooks_run("taxonomy_the_title", r) rescue nil # avoid error for command the_url for categories
|
17
17
|
r[:title]
|
18
18
|
end
|
@@ -25,7 +25,7 @@ module CamaleonCms::Admin::MenusHelper
|
|
25
25
|
if pt.manage_tags?
|
26
26
|
items_i << {icon: "tags", title: t('camaleon_cms.admin.post_type.tags'), url: cama_admin_post_type_post_tags_path(pt.id)} if can? :post_tags, pt
|
27
27
|
end
|
28
|
-
items << {icon: "copy", title: pt.the_title, url: "", items: items_i } if items_i.present? #if can? :posts, pt
|
28
|
+
items << {icon: pt.get_option('icon', "copy"), title: pt.the_title, url: "", items: items_i } if items_i.present? #if can? :posts, pt
|
29
29
|
end
|
30
30
|
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
31
|
#end
|
@@ -37,6 +37,7 @@ module CamaleonCms::Admin::MenusHelper
|
|
37
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? :manager, :themes
|
38
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? :manager, :widgets
|
39
39
|
items << {icon: "list", title: t('camaleon_cms.admin.sidebar.menus'), url: cama_admin_appearances_nav_menus_menu_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? :manager, :nav_menu
|
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? :manager, :shortcodes
|
40
41
|
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?
|
41
42
|
|
42
43
|
|
@@ -57,7 +58,6 @@ module CamaleonCms::Admin::MenusHelper
|
|
57
58
|
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'"}
|
58
59
|
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'"}
|
59
60
|
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'"}
|
60
|
-
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'"}
|
61
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
62
|
end
|
63
63
|
|
@@ -16,9 +16,9 @@ module CamaleonCms::CamaleonHelper
|
|
16
16
|
# layout_name: path of the template to render
|
17
17
|
# template_name: template name to render in template_path
|
18
18
|
def sendmail(email,subject='Tiene una notificacion',content='',from=nil,attachs=[],template_name = 'mailer', layout_name = 'camaleon_cms/mailer')
|
19
|
-
|
19
|
+
Thread.abort_on_exception=true
|
20
20
|
Thread.new do
|
21
|
-
HtmlMailer.sender(email, subject, content, from, attachs, cama_root_url, current_site, template_name, layout_name).deliver_now
|
21
|
+
HtmlMailer.sender(email, subject, content, from, attachs, cama_root_url, current_site, template_name, layout_name, {}).deliver_now
|
22
22
|
ActiveRecord::Base.connection.close
|
23
23
|
end
|
24
24
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module CamaleonCms::EmailHelper
|
2
|
+
|
3
|
+
# send and email
|
4
|
+
# email: email to
|
5
|
+
# subject: Subject of the email
|
6
|
+
# content: content of the email
|
7
|
+
# from: email figured as from
|
8
|
+
# attachs: array of files to be attached to the email
|
9
|
+
# layout_name: path of the template to render
|
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 = 'mailer', layout_name = 'camaleon_cms/mailer', extra_data = {})
|
12
|
+
# Thread.abort_on_exception=true
|
13
|
+
Thread.new do
|
14
|
+
HtmlMailer.sender(email, subject, content, from, attachs, cama_root_url, current_site, template_name, layout_name, extra_data).deliver_now
|
15
|
+
ActiveRecord::Base.connection.close
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def send_user_confirm_email(user_to_confirm)
|
20
|
+
user_to_confirm.send_confirm_email
|
21
|
+
confirm_email_url = cama_admin_confirm_email_url({h: @user.confirm_email_token})
|
22
|
+
Rails.logger.info "Sending email verification to #{user_to_confirm}"
|
23
|
+
extra_data = {:url => confirm_email_url, :fullname => user_to_confirm.fullname}
|
24
|
+
send_email(user_to_confirm.email, t('camaleon_cms.admin.login.confirm.text'), '', nil, [], 'confirm_email', 'camaleon_cms/mailer', extra_data)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -13,55 +13,52 @@ module CamaleonCms::Frontend::SeoHelper
|
|
13
13
|
if is_home?
|
14
14
|
data2 = {}
|
15
15
|
elsif is_page?
|
16
|
-
data2 = {image: @cama_visited_post.the_thumb_url, title: @cama_visited_post.the_title, description: @cama_visited_post.the_excerpt, keywords: @cama_visited_post.the_keywords, object: @cama_visited_post }
|
16
|
+
data2 = {image: @cama_visited_post.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_post.the_title}", description: @cama_visited_post.the_excerpt, keywords: @cama_visited_post.the_keywords, object: @cama_visited_post }
|
17
17
|
elsif is_ajax?
|
18
18
|
data2 = {}
|
19
19
|
elsif is_search?
|
20
20
|
data2 = {title: "#{current_site.the_title} | #{ct("search_title", default: "Search")}"}
|
21
21
|
elsif is_post_type?
|
22
|
-
data2 = {image: @cama_visited_post_type.the_thumb_url, title: @cama_visited_post_type.the_title, description: @cama_visited_post_type.the_excerpt, keywords: @cama_visited_post_type.the_keywords, object: @cama_visited_post_type }
|
22
|
+
data2 = {image: @cama_visited_post_type.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_post_type.the_title}", description: @cama_visited_post_type.the_excerpt, keywords: @cama_visited_post_type.the_keywords, object: @cama_visited_post_type }
|
23
23
|
elsif is_post_tag?
|
24
|
-
data2 = {image: @cama_visited_tag.the_thumb_url, title: @cama_visited_tag.the_title, description: @cama_visited_tag.the_excerpt, keywords: @cama_visited_tag.the_keywords, object: @cama_visited_tag }
|
24
|
+
data2 = {image: @cama_visited_tag.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_tag.the_title}", description: @cama_visited_tag.the_excerpt, keywords: @cama_visited_tag.the_keywords, object: @cama_visited_tag }
|
25
25
|
elsif is_category?
|
26
|
-
data2 = {image: @cama_visited_category.the_thumb_url, title: @cama_visited_category.the_title, description: @cama_visited_category.the_excerpt, keywords: @cama_visited_category.the_keywords, object: @cama_visited_category }
|
26
|
+
data2 = {image: @cama_visited_category.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_category.the_title}", description: @cama_visited_category.the_excerpt, keywords: @cama_visited_category.the_keywords, object: @cama_visited_category }
|
27
27
|
else
|
28
28
|
data2 = {}
|
29
29
|
end
|
30
|
-
cama_build_seo((@
|
30
|
+
cama_build_seo(data2.merge(@_cama_seo_setting_values || {}).merge(data))
|
31
31
|
end
|
32
32
|
|
33
|
-
# permit to define
|
34
|
-
# @Sample:
|
35
|
-
def
|
36
|
-
@
|
37
|
-
@
|
33
|
+
# permit to define seo attributes by code without hooks (check here for more attributes: https://github.com/kpumuk/meta-tags)
|
34
|
+
# @Sample: cama_seo_settings({title: "my custom title", description: "my descr", keywords: "my keywords", image: 'my img url'})
|
35
|
+
def cama_seo_settings(options)
|
36
|
+
@_cama_seo_setting_values ||= {}
|
37
|
+
@_cama_seo_setting_values = @_cama_seo_setting_values.merge(options)
|
38
38
|
end
|
39
39
|
|
40
40
|
# create seo attributes with options + default attributes
|
41
41
|
def cama_build_seo(options = {})
|
42
|
-
options[:image] =
|
43
|
-
options[:title] = I18n.transliterate(options[:title].present? ?
|
42
|
+
options[:image] = current_site.get_option("screenshot", current_site.the_logo) unless options[:image].present?
|
43
|
+
options[:title] = I18n.transliterate(options[:title].present? ? options[:title] : current_site.the_title)
|
44
44
|
options[:description] = I18n.transliterate(options[:description].present? ? options[:description].to_s : current_site.the_option("seo_description"))
|
45
|
-
options[:keywords] = I18n.transliterate(options[:keywords].present? ? options[:keywords] : current_site.the_option("keywords"))
|
46
45
|
options[:url] = request.original_url
|
47
46
|
s = {
|
48
|
-
|
49
|
-
description: options[:description],
|
50
|
-
keywords: options[:keywords],
|
51
|
-
image: options[:image],
|
47
|
+
keywords: I18n.transliterate(options[:keywords].present? ? options[:keywords] : current_site.the_option("keywords")),
|
52
48
|
author: current_site.get_option('seo_author'),
|
49
|
+
icon: current_site.the_icon,
|
53
50
|
og: {
|
54
51
|
title: options[:title],
|
55
52
|
description: options[:description],
|
56
53
|
type: 'website',
|
57
|
-
url:
|
54
|
+
url: options[:url],
|
58
55
|
image: options[:image]
|
59
56
|
},
|
60
57
|
twitter: {
|
61
58
|
card: 'summary',
|
62
59
|
title: options[:title],
|
63
60
|
description: options[:description],
|
64
|
-
url:
|
61
|
+
url: options[:url],
|
65
62
|
image: options[:image],
|
66
63
|
site: current_site.get_option('twitter_card'),
|
67
64
|
creator: current_site.get_option('twitter_card'),
|
@@ -70,7 +67,7 @@ module CamaleonCms::Frontend::SeoHelper
|
|
70
67
|
alternate: [
|
71
68
|
{ type: 'application/rss+xml', href: cama_rss_url }
|
72
69
|
]
|
73
|
-
}
|
70
|
+
}.merge(options.except(:object))
|
74
71
|
|
75
72
|
l = current_site.get_languages
|
76
73
|
if l.size > 1
|
@@ -21,7 +21,7 @@ module CamaleonCms::Frontend::SiteHelper
|
|
21
21
|
#**************** section is a? ****************#
|
22
22
|
# check if current section visited is home page
|
23
23
|
def is_home?
|
24
|
-
@cama_visited_home.present?
|
24
|
+
@cama_visited_home.present?
|
25
25
|
end
|
26
26
|
|
27
27
|
# check if current section visited is for post
|
@@ -41,7 +41,7 @@ module CamaleonCms::Frontend::SiteHelper
|
|
41
41
|
|
42
42
|
# check if current section visited is for search
|
43
43
|
def is_search?
|
44
|
-
@cama_visited_search.present?
|
44
|
+
@cama_visited_search.present?
|
45
45
|
end
|
46
46
|
|
47
47
|
# check if current section visited is for post type
|
@@ -58,6 +58,7 @@ module CamaleonCms::Frontend::SiteHelper
|
|
58
58
|
def is_category?
|
59
59
|
@cama_visited_category.present?
|
60
60
|
end
|
61
|
+
|
61
62
|
#**************** end section is a? ****************#
|
62
63
|
|
63
64
|
# show custom assets added by plugins
|
@@ -65,8 +66,8 @@ module CamaleonCms::Frontend::SiteHelper
|
|
65
66
|
# seo_attrs: Custom attributes for seo in Hash format
|
66
67
|
# show_seo: (Boolean) control to append or not the seo attributes
|
67
68
|
def the_head(seo_attrs = {}, show_seo = true)
|
68
|
-
|
69
|
-
js
|
70
|
-
|
69
|
+
js = "<script>var ROOT_URL = '#{cama_root_url}'; var LANGUAGE = '#{I18n.locale}'; </script>".html_safe
|
70
|
+
js += cama_draw_pre_asset_contents
|
71
|
+
(csrf_meta_tag || "") + "\n" + display_meta_tags(cama_the_seo(seo_attrs)) + "\n" + js + "\n" + cama_draw_custom_assets
|
71
72
|
end
|
72
73
|
end
|