camaleon_cms 2.4.3.5 → 2.4.3.6
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 +5 -5
- data/app/apps/themes/camaleon_first/views/layouts/{mailer.html.erb → camaleon_cms/mailer.html.erb} +0 -0
- data/app/apps/themes/camaleon_first/views/{html_mailer/mailer.html.erb → mailer.html.erb} +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/jquery.validate.js +3 -3
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/zh-CN.js +10 -1
- data/app/assets/stylesheets/camaleon_cms/admin/uploader/_uploadfile.css.scss +14 -2
- data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +4 -3
- data/app/controllers/camaleon_cms/admin/categories_controller.rb +3 -0
- data/app/controllers/camaleon_cms/admin/comments_controller.rb +1 -0
- data/app/controllers/camaleon_cms/admin/posts/drafts_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/posts_controller.rb +21 -7
- data/app/controllers/camaleon_cms/admin/sessions_controller.rb +0 -2
- data/app/controllers/camaleon_cms/admin/settings_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/users_controller.rb +14 -3
- data/app/controllers/camaleon_cms/frontend_controller.rb +1 -1
- data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +4 -4
- data/app/decorators/camaleon_cms/application_decorator.rb +1 -1
- data/app/decorators/camaleon_cms/post_decorator.rb +2 -2
- data/app/decorators/camaleon_cms/post_type_decorator.rb +3 -1
- data/app/decorators/camaleon_cms/user_decorator.rb +4 -0
- data/app/helpers/camaleon_cms/admin/application_helper.rb +1 -1
- data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +8 -8
- data/app/helpers/camaleon_cms/admin/menus_helper.rb +1 -1
- data/app/helpers/camaleon_cms/camaleon_helper.rb +5 -0
- data/app/helpers/camaleon_cms/uploader_helper.rb +1 -1
- data/app/models/camaleon_cms/post.rb +13 -6
- data/app/models/camaleon_cms/post_type.rb +1 -1
- data/app/models/camaleon_cms/site.rb +1 -1
- data/app/models/camaleon_cms/user_role.rb +8 -0
- data/app/models/concerns/camaleon_cms/custom_fields_read.rb +9 -7
- data/app/models/concerns/camaleon_cms/user_methods.rb +11 -1
- data/app/uploaders/camaleon_cms_local_uploader.rb +4 -2
- data/app/uploaders/camaleon_cms_uploader.rb +1 -1
- data/app/views/camaleon_cms/admin/categories/index.html.erb +2 -2
- data/app/views/camaleon_cms/admin/post_tags/index.html.erb +2 -2
- data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +1 -1
- data/app/views/camaleon_cms/admin/posts/index.html.erb +3 -2
- data/app/views/camaleon_cms/admin/sessions/forgot.html.erb +2 -2
- data/app/views/camaleon_cms/admin/sessions/login.html.erb +3 -5
- data/app/views/camaleon_cms/admin/sessions/register.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +1 -1
- data/app/views/camaleon_cms/admin/user_roles/index.html.erb +8 -2
- data/app/views/camaleon_cms/admin/users/form.html.erb +2 -2
- data/app/views/camaleon_cms/admin/users/index.html.erb +8 -1
- data/app/views/layouts/camaleon_cms/admin.html.erb +2 -2
- data/config/initializers/active_record_extension.rb +9 -0
- data/config/initializers/assets.rb +1 -1
- data/config/locales/camaleon_cms/admin/en.yml +1 -1
- data/config/locales/camaleon_cms/admin/es.yml +2 -2
- data/config/locales/camaleon_cms/admin/fr.yml +1 -1
- data/config/locales/camaleon_cms/admin/it.yml +1 -1
- data/config/locales/camaleon_cms/admin/js.yml +40 -40
- data/config/locales/camaleon_cms/admin/nl.yml +1 -1
- data/config/locales/camaleon_cms/admin/pt-BR.yml +1 -1
- data/config/locales/camaleon_cms/admin/pt.yml +1 -1
- data/config/locales/camaleon_cms/admin/ru.yml +1 -1
- data/config/locales/camaleon_cms/admin/zh-CH.yml +56 -30
- data/config/routes/frontend.rb +53 -14
- data/lib/camaleon_cms/engine.rb +4 -2
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/ext/string.rb +10 -2
- data/lib/generators/camaleon_cms/gem_plugin_generator.rb +3 -2
- data/spec/dummy/db/schema.rb +11 -0
- data/spec/dummy/log/test.log +56824 -0
- data/spec/features/pages_spec.rb +2 -1
- data/spec/features/posts_spec.rb +3 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/support/common.rb +2 -2
- metadata +6 -10
- data/app/assets/javascripts/camaleon_cms/admin/login.js.coffee +0 -7
- data/app/assets/javascripts/camaleon_cms/admin/login_manifest.js +0 -15
- data/app/assets/javascripts/camaleon_cms/gibberish-aes.js +0 -1017
- data/lib/ext/aes_crypt.rb +0 -246
- data/spec/dummy/db/test.sqlite3 +0 -0
@@ -9,7 +9,7 @@ module CamaleonCms::Admin::MenusHelper
|
|
9
9
|
pt = pt.decorate
|
10
10
|
items_i = []
|
11
11
|
items_i << {icon: "list", title: "#{t('camaleon_cms.admin.post_type.all')}", url: cama_admin_post_type_posts_path(pt.id)} if can? :posts, pt
|
12
|
-
items_i << {icon: "plus", title: "#{t('camaleon_cms.admin.post_type.add_new')}
|
12
|
+
items_i << {icon: "plus", title: "#{t('camaleon_cms.admin.post_type.add_new', type_title: pt.the_title)}", url: new_cama_admin_post_type_post_path(pt.id)} if can? :create_post, pt
|
13
13
|
if pt.manage_categories?
|
14
14
|
items_i << {icon: "folder-open", title: t('camaleon_cms.admin.post_type.categories'), url: cama_admin_post_type_categories_path(pt.id)} if can? :categories, pt
|
15
15
|
end
|
@@ -80,4 +80,9 @@ module CamaleonCms::CamaleonHelper
|
|
80
80
|
args[:default] = I18n.t(key, args.dup.merge(locale: :en)) unless args[:default].present?
|
81
81
|
I18n.t(key, args)
|
82
82
|
end
|
83
|
+
|
84
|
+
# function that converts string into plural format
|
85
|
+
def cama_pluralize_text(text)
|
86
|
+
text.try(:pluralize)
|
87
|
+
end
|
83
88
|
end
|
@@ -228,7 +228,7 @@ module CamaleonCms::UploaderHelper
|
|
228
228
|
uploaded_io = File.open(uploaded_io) if uploaded_io.is_a?(String)
|
229
229
|
return {error: "#{ct("file_format_error")} (#{args[:formats]})"} unless cama_uploader.class.validate_file_format(_tmp_name || uploaded_io.path, args[:formats])
|
230
230
|
return {error: "#{ct("file_size_exceeded", default: "File size exceeded")} (#{number_to_human_size(args[:maximum])})"} if args[:maximum].present? && args[:maximum] < (uploaded_io.size rescue File.size(uploaded_io))
|
231
|
-
name = args[:name] || uploaded_io.path.split("/").last; name = "#{File.basename(name, File.extname(name)).underscore}#{File.extname(name)}"
|
231
|
+
name = args[:name] || uploaded_io.try(:original_filename) || uploaded_io.path.split("/").last; name = "#{File.basename(name, File.extname(name)).underscore}#{File.extname(name)}"
|
232
232
|
path ||= uploader_verify_name(File.join(tmp_path, name))
|
233
233
|
File.open(path, "wb"){|f| f.write(uploaded_io.read) } unless saved
|
234
234
|
path = cama_resize_upload(path, args[:dimension]) if args[:dimension].present?
|
@@ -1,10 +1,13 @@
|
|
1
1
|
class CamaleonCms::PostUniqValidator < ActiveModel::Validator
|
2
2
|
def validate(record)
|
3
|
-
|
3
|
+
unless record.draft?
|
4
4
|
slug_array = record.slug.to_s.translations_array
|
5
5
|
ptype = record.post_type
|
6
6
|
if ptype.present? # only for posts that belongs to a post type model
|
7
|
-
posts = ptype.site.posts
|
7
|
+
posts = ptype.site.posts
|
8
|
+
.where("(#{slug_array.map {|s| "#{CamaleonCms::Post.table_name}.slug LIKE '%-->#{s}<!--%'"}.join(" OR ")} ) OR #{CamaleonCms::Post.table_name}.slug = ?", record.slug)
|
9
|
+
.where("#{CamaleonCms::Post.table_name}.status != 'draft' AND #{CamaleonCms::Post.table_name}.status != 'draft_child'")
|
10
|
+
.where.not(id: record.id)
|
8
11
|
if posts.size > 0
|
9
12
|
if slug_array.size > 1
|
10
13
|
record.errors[:base] << "#{I18n.t('camaleon_cms.admin.post.message.requires_different_slug')}: #{posts.pluck(:slug).map{|slug| record.slug.to_s.translations.map{|lng, r_slug| "#{r_slug} (#{lng})" if slug.translations_array.include?(r_slug) }.join(",") }.join(",").split(",").uniq.clean_empty.join(", ")} "
|
@@ -37,7 +40,7 @@ class CamaleonCms::Post < CamaleonCms::PostDefault
|
|
37
40
|
has_many :categories, class_name: "CamaleonCms::Category", through: :term_relationships, :source => :term_taxonomies
|
38
41
|
has_many :post_tags, class_name: "CamaleonCms::PostTag", through: :term_relationships, :source => :term_taxonomies
|
39
42
|
has_many :comments, class_name: "CamaleonCms::PostComment", foreign_key: :post_id, dependent: :destroy
|
40
|
-
has_many :drafts, ->{where(status: '
|
43
|
+
has_many :drafts, ->{where(status: 'draft_child')}, class_name: "CamaleonCms::Post", foreign_key: :post_parent, dependent: :destroy
|
41
44
|
has_many :children, class_name: "CamaleonCms::Post", foreign_key: :post_parent, dependent: :destroy, primary_key: :id
|
42
45
|
|
43
46
|
belongs_to :owner, class_name: PluginRoutes.static_system_info['user_model'].presence || 'CamaleonCms::User', foreign_key: :user_id
|
@@ -52,8 +55,8 @@ class CamaleonCms::Post < CamaleonCms::PostDefault
|
|
52
55
|
scope :no_trash, -> {where.not(status: 'trash')}
|
53
56
|
scope :published, -> {where(status: 'published')}
|
54
57
|
scope :root_posts, -> {where(post_parent: [nil, ''])}
|
55
|
-
scope :drafts, -> {where(status:
|
56
|
-
scope :
|
58
|
+
scope :drafts, -> {where(status: %w(draft draft_child))}
|
59
|
+
scope :pending, -> {where(status: 'pending')}
|
57
60
|
scope :latest, -> {reorder(created_at: :desc)}
|
58
61
|
|
59
62
|
validates_with CamaleonCms::PostUniqValidator
|
@@ -99,7 +102,11 @@ class CamaleonCms::Post < CamaleonCms::PostDefault
|
|
99
102
|
|
100
103
|
# check if this is in draft status
|
101
104
|
def draft?
|
102
|
-
status == 'draft'
|
105
|
+
status == 'draft' || status == 'draft_child'
|
106
|
+
end
|
107
|
+
|
108
|
+
def draft_child?
|
109
|
+
status == 'draft_child'
|
103
110
|
end
|
104
111
|
|
105
112
|
# check if this is in trash status
|
@@ -219,7 +219,7 @@ class CamaleonCms::Site < CamaleonCms::TermTaxonomy
|
|
219
219
|
# update all routes of the system
|
220
220
|
# reload system routes for this site
|
221
221
|
def update_routes
|
222
|
-
PluginRoutes.reload if
|
222
|
+
PluginRoutes.reload if cama_attr_changed?(:slug)
|
223
223
|
end
|
224
224
|
|
225
225
|
def reload_routes
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class CamaleonCms::UserRole < CamaleonCms::TermTaxonomy
|
2
|
+
after_destroy :set_users_as_cilent
|
3
|
+
|
2
4
|
default_scope { where(taxonomy: :user_roles) }
|
3
5
|
has_many :metas, ->{ where(object_class: 'UserRole')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
|
4
6
|
belongs_to :site, :class_name => "CamaleonCms::Site", foreign_key: :parent_id
|
@@ -127,4 +129,10 @@ class CamaleonCms::UserRole < CamaleonCms::TermTaxonomy
|
|
127
129
|
}
|
128
130
|
]
|
129
131
|
}
|
132
|
+
|
133
|
+
private
|
134
|
+
|
135
|
+
def set_users_as_cilent
|
136
|
+
site.users.where(role: slug).update_all(role: 'client')
|
137
|
+
end
|
130
138
|
end
|
@@ -193,13 +193,15 @@ module CamaleonCms::CustomFieldsRead extend ActiveSupport::Concern
|
|
193
193
|
# }
|
194
194
|
def set_field_values(datas = {})
|
195
195
|
if datas.present?
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
196
|
+
ActiveRecord::Base.transaction do
|
197
|
+
self.field_values.delete_all
|
198
|
+
datas.each do |index, fields_data|
|
199
|
+
fields_data.each do |field_key, values|
|
200
|
+
if values[:values].present?
|
201
|
+
order_value = -1
|
202
|
+
((values[:values].is_a?(Hash) || values[:values].is_a?(ActionController::Parameters)) ? values[:values].values : values[:values]).each do |value|
|
203
|
+
item = self.field_values.create!({custom_field_id: values[:id], custom_field_slug: field_key, value: fix_meta_value(value), term_order: order_value += 1, group_number: values[:group_number] || 0})
|
204
|
+
end
|
203
205
|
end
|
204
206
|
end
|
205
207
|
end
|
@@ -9,11 +9,13 @@ module CamaleonCms::UserMethods extend ActiveSupport::Concern
|
|
9
9
|
# callbacks
|
10
10
|
before_validation :cama_before_validation
|
11
11
|
before_destroy :reassign_posts
|
12
|
+
after_destroy :reassign_comments
|
12
13
|
before_create { generate_token(:auth_token) }
|
13
14
|
|
14
15
|
# relations
|
15
16
|
has_many :metas, ->{ where(object_class: 'User')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
|
16
17
|
has_many :all_posts, class_name: "CamaleonCms::Post"
|
18
|
+
has_many :all_comments, class_name: "CamaleonCms::PostComment"
|
17
19
|
|
18
20
|
#scopes
|
19
21
|
scope :admin_scope, -> { where(:role => 'admin') }
|
@@ -119,4 +121,12 @@ module CamaleonCms::UserMethods extend ActiveSupport::Concern
|
|
119
121
|
end
|
120
122
|
end
|
121
123
|
end
|
122
|
-
|
124
|
+
|
125
|
+
def reassign_comments
|
126
|
+
all_comments.includes(post: {post_type: :site}).each do |comment|
|
127
|
+
site = comment.post.post_type.site
|
128
|
+
user = site.get_anonymous_user
|
129
|
+
comment.update_column(:user_id, user.id)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -82,12 +82,14 @@ class CamaleonCmsLocalUploader < CamaleonCmsUploader
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def delete_folder(key)
|
85
|
-
|
85
|
+
file = File.join(@root_folder, key)
|
86
|
+
FileUtils.rm(file) if File.exist? file
|
86
87
|
reload
|
87
88
|
end
|
88
89
|
|
89
90
|
def delete_file(key)
|
90
|
-
|
91
|
+
file = File.join(@root_folder, key)
|
92
|
+
FileUtils.rm(file) if File.exist? file
|
91
93
|
reload
|
92
94
|
end
|
93
95
|
|
@@ -124,7 +124,7 @@ class CamaleonCmsUploader
|
|
124
124
|
def self.validate_file_format(key, valid_formats = "*")
|
125
125
|
return true if valid_formats == "*" || !valid_formats.present?
|
126
126
|
valid_formats = valid_formats.gsub(' ', '').downcase.split(',') + get_file_format_extensions(valid_formats).split(',')
|
127
|
-
valid_formats.include?(File.extname(key).sub(".", "").split('?').first.downcase)
|
127
|
+
valid_formats.include?(File.extname(key).sub(".", "").split('?').first.try(:downcase))
|
128
128
|
end
|
129
129
|
|
130
130
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<div class="panel panel-default">
|
13
13
|
<div class="panel-heading ui-draggable-handle">
|
14
14
|
<h4>
|
15
|
-
<span class="fa fa-folder"></span> <%= "#{@post_type.decorate.the_title
|
15
|
+
<span class="fa fa-folder"></span> <%= "#{@post_type.decorate.the_title} / " if @post_type.present? %> <%= t('camaleon_cms.admin.post_type.categories', default: 'Categories') %>
|
16
16
|
</h4>
|
17
17
|
</div>
|
18
18
|
<div class="panel-body">
|
@@ -39,7 +39,7 @@
|
|
39
39
|
<%= r = {html: "", post_type: @post_type, category: item}; hooks_run("category_list_body", r); raw(r[:html]); %>
|
40
40
|
<td>
|
41
41
|
<%= link_to raw('<i class="fa fa-eye"></i>'), item.the_url, target: '_blank', class: "btn btn-info btn-xs", title: "#{t('camaleon_cms.common.visit')}" %>
|
42
|
-
<%= link_to raw('<i class="fa fa-list"></i>'), cama_admin_post_type_taxonomy_posts_path(@post_type.id, "category", item.id), class: "btn btn-default btn-xs cama_ajax_request", title: "#{@post_type.decorate.the_title
|
42
|
+
<%= link_to raw('<i class="fa fa-list"></i>'), cama_admin_post_type_taxonomy_posts_path(@post_type.id, "category", item.id), class: "btn btn-default btn-xs cama_ajax_request", title: "#{cama_pluralize_text(@post_type.decorate.the_title)} - #{item.the_title.to_s.titleize}" if @post_type.present? && (can? :posts, @post_type) %>
|
43
43
|
<%= link_to raw('<i class="fa fa-pencil"></i>'), {action: :edit, id: item.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.edit')}" %>
|
44
44
|
<%= link_to raw('<i class="fa fa-times"></i>'), { action: :destroy, id: item.id },method: :delete, data: { confirm: t('camaleon_cms.admin.message.delete') }, class: "btn btn-danger btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.delete')}" unless item.get_option('not_deleted', false) %>
|
45
45
|
</td>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<div class="col-md-4">
|
4
4
|
<div class="panel panel-default">
|
5
5
|
<div class="panel-heading ui-draggable-handle">
|
6
|
-
<h4><span class="fa fa-folder"></span> <%= "#{@post_type.decorate.the_title
|
6
|
+
<h4><span class="fa fa-folder"></span> <%= "#{cama_pluralize_text(@post_type.decorate.the_title)} / " if @post_type.present? %> <%= cama_pluralize_text(t('camaleon_cms.admin.post_type.tags').to_s.titleize) %></h4>
|
7
7
|
</div>
|
8
8
|
<%= render partial: 'form' %>
|
9
9
|
</div>
|
@@ -37,7 +37,7 @@
|
|
37
37
|
<td><%= tag.count %></td>
|
38
38
|
<td>
|
39
39
|
<%= link_to raw('<i class="fa fa-eye"></i>'), tag.the_url, target: '_blank', class: "btn btn-info btn-xs", title: "#{t('camaleon_cms.common.visit')}" %>
|
40
|
-
<%= link_to raw('<i class="fa fa-list"></i>'), cama_admin_post_type_taxonomy_posts_path(@post_type.id, "post_tag", tag.id), class: "btn btn-default btn-xs cama_ajax_request", title: "#{@post_type.decorate.the_title
|
40
|
+
<%= link_to raw('<i class="fa fa-list"></i>'), cama_admin_post_type_taxonomy_posts_path(@post_type.id, "post_tag", tag.id), class: "btn btn-default btn-xs cama_ajax_request", title: "#{cama_pluralize_text(@post_type.decorate.the_title)}-#{tag.slug.to_s.titleize}" if @post_type.present? %>
|
41
41
|
<%= link_to raw('<i class="fa fa-pencil"></i>'), {action: :edit, id: tag.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.edit')}" %>
|
42
42
|
<%= link_to raw('<i class="fa fa-times"></i>'), { action: :destroy, id: tag.id }, method: :delete, data: { confirm: t('camaleon_cms.admin.message.delete') }, class: "btn btn-danger btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.delete')}" unless tag.get_option('not_deleted', false) %>
|
43
43
|
</td>
|
@@ -43,7 +43,7 @@
|
|
43
43
|
<option class="" value="published" <%= (@post[:status] == "published") ? "selected": "" %> ><%= t('camaleon_cms.admin.post_type.published')%></option>
|
44
44
|
<% end %>
|
45
45
|
<option value="pending" <%= (@post[:status] == "pending") ? "selected": "" %>><%= t('camaleon_cms.admin.table.pending')%></option>
|
46
|
-
<option value="draft" <%= (@post[:status] == "draft") ? "selected": "" %>><%= t('camaleon_cms.admin.table.draft')%></option>
|
46
|
+
<option value="draft" <%= (@post[:status] == "draft" || @post[:status] == "draft_child") ? "selected": "" %>><%= t('camaleon_cms.admin.table.draft')%></option>
|
47
47
|
</select>
|
48
48
|
</div>
|
49
49
|
<!-- templates -->
|
@@ -2,7 +2,8 @@
|
|
2
2
|
<div class="panel-heading">
|
3
3
|
<div class="row">
|
4
4
|
<div class="col-md-12">
|
5
|
-
<h4 class="pull-left"
|
5
|
+
<h4 class="pull-left">
|
6
|
+
<%= t('camaleon_cms.admin.page_title.list_of', post_type: @post_type.the_title) %>
|
6
7
|
<b>(slug = <%= @post_type.the_slug %>)</b> <%= link_to("<i class='fa fa-eye'></i> #{t("camaleon_cms.common.visit")}".html_safe, @post_type.the_url, class: 'btn btn-xs', target: '_blank') %>
|
7
8
|
</h4>
|
8
9
|
<%= link_to raw("<i class='fa fa-plus'></i> #{t('camaleon_cms.admin.post_type.add')} #{@post_type.the_title}"), {action: :new}, class: "btn btn-primary pull-right cama_ajax_request" if can? :create_post, @post_type %>
|
@@ -107,4 +108,4 @@
|
|
107
108
|
<%= content_tag("div", raw(t('camaleon_cms.admin.message.data_found_list')), class: "alert alert-warning") if @posts.empty? %>
|
108
109
|
<%= raw cama_do_pagination(@posts) %>
|
109
110
|
</div>
|
110
|
-
</div>
|
111
|
+
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= render "camaleon_cms/flash_messages" %>
|
4
4
|
<% if @form_reset.present? %>
|
5
5
|
<h3 class="login-title"><%= t('camaleon_cms.admin.login.reset_password') %></h3>
|
6
|
-
<%= form_for(@user, as: "user", :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal" }, :url => cama_admin_forgot_path({h: params[:h]}) ) do |f| %>
|
6
|
+
<%= form_for(@user, as: "user", :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal cama_form_validate" }, :url => cama_admin_forgot_path({h: params[:h]}) ) do |f| %>
|
7
7
|
<div class="form-group">
|
8
8
|
<div class="col-md-12">
|
9
9
|
<%= f.password_field :password, :class => "form-control", :placeholder => t('camaleon_cms.admin.table.password', default: 'Password') %>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<% end %>
|
23
23
|
<% else %>
|
24
24
|
<h3 class="login-title"><%= raw t('camaleon_cms.admin.login.reset_password_html')%> </h3>
|
25
|
-
<%= form_for(@user, as: "user", :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal" }, :url => cama_admin_forgot_path ) do |f| %>
|
25
|
+
<%= form_for(@user, as: "user", :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal cama_form_validate" }, :url => cama_admin_forgot_path ) do |f| %>
|
26
26
|
<div class="form-group">
|
27
27
|
<div class="col-md-12">
|
28
28
|
<%= f.email_field :email, :class => "form-control", :placeholder => t("camaleon_cms.admin.login.email", default: 'Email') %>
|
@@ -1,17 +1,15 @@
|
|
1
|
-
<script>var kk = "<%= cama_get_session_id %>";</script>
|
2
|
-
<%= javascript_include_tag "camaleon_cms/admin/login_manifest" %>
|
3
1
|
<div class="login-body">
|
4
2
|
<h3 class="login-box-msg"><%= raw t('camaleon_cms.admin.login.welcome_login_html', default: 'Please Login') %> </h3>
|
5
3
|
<%= render "camaleon_cms/flash_messages" %>
|
6
|
-
<%= form_for(@user, as: "user", :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal" }, :url => cama_admin_login_path ) do |f| %>
|
4
|
+
<%= form_for(@user, as: "user", :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal cama_form_validate" }, :url => cama_admin_login_path ) do |f| %>
|
7
5
|
<div class="form-group">
|
8
6
|
<div class="col-md-12">
|
9
|
-
<%= f.text_field :username, :class => "form-control", :placeholder => t("camaleon_cms.admin.login.username", default: 'Username') %>
|
7
|
+
<%= f.text_field :username, :class => "form-control required", autofocus: true, :placeholder => t("camaleon_cms.admin.login.username", default: 'Username') %>
|
10
8
|
</div>
|
11
9
|
</div>
|
12
10
|
<div class="form-group">
|
13
11
|
<div class="col-md-12">
|
14
|
-
<%= f.password_field :password, :class => "form-control", :placeholder => t("camaleon_cms.admin.login.password", default: 'Password') %>
|
12
|
+
<%= f.password_field :password, :class => "form-control required", :placeholder => t("camaleon_cms.admin.login.password", default: 'Password') %>
|
15
13
|
</div>
|
16
14
|
</div>
|
17
15
|
<div class="form-group">
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= render "camaleon_cms/flash_messages" %>
|
4
4
|
|
5
5
|
<h3 class="login-title"><%= raw t('camaleon_cms.admin.login.msg_registration_html') %></h3>
|
6
|
-
<%= form_for(@user, as: "user", :url => cama_admin_register_path, :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal" } ) do |f| %>
|
6
|
+
<%= form_for(@user, as: "user", :url => cama_admin_register_path, :html => { method: "post", role: "form", id:"login_user", class: "form-horizontal cama_form_validate" } ) do |f| %>
|
7
7
|
<%= render partial: 'layouts/camaleon_cms/admin/form_error', locals: {data: @user} %>
|
8
8
|
<h4><%= t('camaleon_cms.admin.login.personal_info') %></h4>
|
9
9
|
<div class="form-group">
|
@@ -10,7 +10,7 @@
|
|
10
10
|
</div>
|
11
11
|
|
12
12
|
<div class="form-group">
|
13
|
-
<%= f.label t('.status', default: 'Site Status') %><br>
|
13
|
+
<%= f.label t('camaleon_cms.admin.table.status', default: 'Site Status') %><br>
|
14
14
|
<%= f.select :status, current_site.the_status_options, {}, :class => "form-control" %>
|
15
15
|
</div>
|
16
16
|
<div class="hidden site_options_for_status status_maintenance">
|
@@ -68,4 +68,4 @@
|
|
68
68
|
form.find('.site_options_for_status').hide().removeClass('hidden').filter('.status_'+$(this).val()).slideDown();
|
69
69
|
}).trigger('change');
|
70
70
|
})
|
71
|
-
</script>
|
71
|
+
</script>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<option value=""></option>
|
4
4
|
<% if field.options[:post_types].present? %>
|
5
5
|
<% (field.options[:post_types].include?("all") ? current_site.post_types : current_site.post_types.where(id: field.options[:post_types])).each do |pt| %>
|
6
|
-
<optgroup label="<%= pt.
|
6
|
+
<optgroup label="<%= pt.decorate.the_title %>">
|
7
7
|
<% pt.posts.public_posts.each do |post| post = post.decorate %>
|
8
8
|
<option value="<%= post.id %>"><%= post.the_title %></option>
|
9
9
|
<% end %>
|
@@ -30,8 +30,14 @@
|
|
30
30
|
<td><%= f.the_content %></td>
|
31
31
|
<td>
|
32
32
|
<%= link_to raw('<i class="fa fa-pencil"></i>'), {action: :edit, id: f.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.edit')}" %>
|
33
|
-
|
34
|
-
|
33
|
+
<% if f.editable? %>
|
34
|
+
<%= link_to raw('<i class="fa fa-times"></i>'), { action: :destroy, id: f.id },
|
35
|
+
method: :delete, data: { confirm: t('camaleon_cms.admin.message.delete_item') }, class: "btn btn-danger btn-xs cama_ajax_request", title: t('camaleon_cms.admin.button.delete') %>
|
36
|
+
<% else %>
|
37
|
+
<%= link_to 'javascript:;', disabled: true, class: 'btn btn-danger btn-xs cama_ajax_request', title: t('camaleon_cms.admin.users.message.role_can_not_be_deleted', default: 'This role can not be deleted') do %>
|
38
|
+
<i class="fa fa-times"></i>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
35
41
|
</td>
|
36
42
|
</tr>
|
37
43
|
<% end %>
|
@@ -54,7 +54,7 @@
|
|
54
54
|
<div class="">
|
55
55
|
<%= f.label "#{t('camaleon_cms.admin.table.role')}", class: "control-label" %>
|
56
56
|
<div class="">
|
57
|
-
<%= f.select :role,current_site.user_roles.reorder(:name).decorate.map{|role| [role.the_title, role.slug]}, {}, {:class => "form-control required"}%>
|
57
|
+
<%= f.select :role,current_site.user_roles.reorder(:name).decorate.map{|role| [role.the_title, role.slug]}, {}, {:class => "form-control required", disabled: !current_user.role_grantor?(@user)}%>
|
58
58
|
</div>
|
59
59
|
</div>
|
60
60
|
<hr>
|
@@ -158,4 +158,4 @@
|
|
158
158
|
<script type="application/javascript">
|
159
159
|
jQuery(function ($) { init_profile_form(); });
|
160
160
|
</script>
|
161
|
-
<!-- EOF MODALS -->
|
161
|
+
<!-- EOF MODALS -->
|
@@ -36,8 +36,15 @@
|
|
36
36
|
<td><%= l(f.last_login_at, format: :long) if f.last_login_at.present? %></td>
|
37
37
|
<td>
|
38
38
|
<%= link_to raw('<i class="fa fa-pencil"></i>'), {action: :edit, id: f.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.edit')}" %>
|
39
|
-
|
39
|
+
<% if current_user.id == f.id %>
|
40
|
+
<%= link_to 'javascript:;', class: 'btn btn-danger btn-xs cama_ajax_request', disabled: true,
|
41
|
+
title: t('camaleon_cms.admin.users.message.user_can_not_delete_own_account', default: 'User can not delete own account') do %>
|
42
|
+
<i class="fa fa-times"></i>
|
43
|
+
<% end %>
|
44
|
+
<% else %>
|
45
|
+
<%= link_to raw('<i class="fa fa-times"></i>'), { action: :destroy, id: f.id },
|
40
46
|
method: :delete, data: { confirm: t('camaleon_cms.admin.message.delete_item') }, class: "btn btn-danger btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.delete')}" %>
|
47
|
+
<% end %>
|
41
48
|
<%= link_to raw('<i class="fa fa-retweet"></i>'), {action: :impersonate, id: f.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{cama_t('camaleon_cms.admin.users.impersonate')}" if can? :impersonate, f %>
|
42
49
|
</td>
|
43
50
|
</tr>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
var CURRENT_LOCALE = '<%= current_locale %>';
|
15
15
|
var ADMIN_TRANSLATIONS = <%= raw current_site.get_languages.to_json %>;
|
16
16
|
var tinymce_global_settings = {language_url: "<%= asset_path("camaleon_cms/admin/tinymce/langs/#{current_locale}.js") %>", custom_css: [], custom_toolbar: [], post_render: [], init: [], setups: [], settings: []};
|
17
|
-
var I18n_data = <%= I18n.backend.send(:translations)[current_locale.to_sym][:camaleon_cms][:admin][:js].to_json.html_safe rescue "{}" %>
|
17
|
+
var I18n_data = <%= I18n.backend.respond_to?(:translations) ? I18n.backend.send(:translations)[current_locale.to_sym][:camaleon_cms][:admin][:js].to_json.html_safe : !!(I18n.backend.backends[1] && I18n.backend.backends[1].backends[1]) ? I18n.backend.backends[1].backends[1].send(:translations)[current_locale.to_sym][:camaleon_cms][:admin][:js].to_json.html_safe : "{}" rescue "{}" %>
|
18
18
|
</script>
|
19
19
|
<%= javascript_include_tag "camaleon_cms/admin/admin-manifest" %>
|
20
20
|
|
@@ -52,4 +52,4 @@
|
|
52
52
|
<%= raw cama_content_after_draw %>
|
53
53
|
<%= yield :after_content if content_for? :after_content %>
|
54
54
|
</body>
|
55
|
-
</html>
|
55
|
+
</html>
|
@@ -83,4 +83,13 @@ ActiveRecord::Base.class_eval do
|
|
83
83
|
def cama_build_cache_key(key)
|
84
84
|
_key = "cama_cache_#{self.class.name}_#{self.id}_#{key}"
|
85
85
|
end
|
86
|
+
|
87
|
+
# check if an attribute was changed
|
88
|
+
def cama_attr_changed?(attr_name)
|
89
|
+
if PluginRoutes.isRails5?
|
90
|
+
self.saved_change_to_attribute?(attr_name.to_sym)
|
91
|
+
else
|
92
|
+
self.send("#{attr_name}_changed?")
|
93
|
+
end
|
94
|
+
end
|
86
95
|
end
|
@@ -15,7 +15,7 @@ Rails.application.config.assets.precompile << Proc.new { |path|
|
|
15
15
|
if File.dirname(path).start_with?('plugins/') || File.dirname(path).start_with?('themes/')
|
16
16
|
name = File.basename(path)
|
17
17
|
content_type = MIME::Types.type_for(name).first.content_type rescue ""
|
18
|
-
if (path =~ /\.(css|js|svg|ttf|woff|eot|swf|pdf)\z/ || content_type.scan(/(javascript|image\/|audio|video|font)/).any?) && !name.start_with?("_") && !path.include?('/views/')
|
18
|
+
if (path =~ /\.(css|js|svg|ttf|woff|eot|swf|pdf|png|jpg)\z/ || content_type.scan(/(javascript|image\/|audio|video|font)/).any?) && !name.start_with?("_") && !path.include?('/views/')
|
19
19
|
res = true
|
20
20
|
end
|
21
21
|
end
|
@@ -219,7 +219,7 @@ es:
|
|
219
219
|
edit: 'Editar'
|
220
220
|
add: 'Añadir'
|
221
221
|
list: 'Lista'
|
222
|
-
list_of: 'Lista de'
|
222
|
+
list_of: 'Lista de %{post_type}'
|
223
223
|
new_site: 'Nuevo sitio'
|
224
224
|
edit_site: 'Editar Sitio'
|
225
225
|
update: 'Actualizar'
|
@@ -649,4 +649,4 @@ es:
|
|
649
649
|
status_options:
|
650
650
|
active: 'Activo'
|
651
651
|
inactive: 'In activo'
|
652
|
-
maintenance: 'En Mantenimiento'
|
652
|
+
maintenance: 'En Mantenimiento'
|