camaleon_cms 2.4.3.5 → 2.4.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/app/apps/themes/camaleon_first/views/layouts/{mailer.html.erb → camaleon_cms/mailer.html.erb} +0 -0
  4. data/app/apps/themes/camaleon_first/views/{html_mailer/mailer.html.erb → mailer.html.erb} +0 -0
  5. data/app/assets/javascripts/camaleon_cms/admin/jquery.validate.js +3 -3
  6. data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/zh-CN.js +10 -1
  7. data/app/assets/stylesheets/camaleon_cms/admin/uploader/_uploadfile.css.scss +14 -2
  8. data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +4 -3
  9. data/app/controllers/camaleon_cms/admin/categories_controller.rb +3 -0
  10. data/app/controllers/camaleon_cms/admin/comments_controller.rb +1 -0
  11. data/app/controllers/camaleon_cms/admin/posts/drafts_controller.rb +1 -1
  12. data/app/controllers/camaleon_cms/admin/posts_controller.rb +21 -7
  13. data/app/controllers/camaleon_cms/admin/sessions_controller.rb +0 -2
  14. data/app/controllers/camaleon_cms/admin/settings_controller.rb +1 -1
  15. data/app/controllers/camaleon_cms/admin/users_controller.rb +14 -3
  16. data/app/controllers/camaleon_cms/frontend_controller.rb +1 -1
  17. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +4 -4
  18. data/app/decorators/camaleon_cms/application_decorator.rb +1 -1
  19. data/app/decorators/camaleon_cms/post_decorator.rb +2 -2
  20. data/app/decorators/camaleon_cms/post_type_decorator.rb +3 -1
  21. data/app/decorators/camaleon_cms/user_decorator.rb +4 -0
  22. data/app/helpers/camaleon_cms/admin/application_helper.rb +1 -1
  23. data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +8 -8
  24. data/app/helpers/camaleon_cms/admin/menus_helper.rb +1 -1
  25. data/app/helpers/camaleon_cms/camaleon_helper.rb +5 -0
  26. data/app/helpers/camaleon_cms/uploader_helper.rb +1 -1
  27. data/app/models/camaleon_cms/post.rb +13 -6
  28. data/app/models/camaleon_cms/post_type.rb +1 -1
  29. data/app/models/camaleon_cms/site.rb +1 -1
  30. data/app/models/camaleon_cms/user_role.rb +8 -0
  31. data/app/models/concerns/camaleon_cms/custom_fields_read.rb +9 -7
  32. data/app/models/concerns/camaleon_cms/user_methods.rb +11 -1
  33. data/app/uploaders/camaleon_cms_local_uploader.rb +4 -2
  34. data/app/uploaders/camaleon_cms_uploader.rb +1 -1
  35. data/app/views/camaleon_cms/admin/categories/index.html.erb +2 -2
  36. data/app/views/camaleon_cms/admin/post_tags/index.html.erb +2 -2
  37. data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +1 -1
  38. data/app/views/camaleon_cms/admin/posts/index.html.erb +3 -2
  39. data/app/views/camaleon_cms/admin/sessions/forgot.html.erb +2 -2
  40. data/app/views/camaleon_cms/admin/sessions/login.html.erb +3 -5
  41. data/app/views/camaleon_cms/admin/sessions/register.html.erb +1 -1
  42. data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +2 -2
  43. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +1 -1
  44. data/app/views/camaleon_cms/admin/user_roles/index.html.erb +8 -2
  45. data/app/views/camaleon_cms/admin/users/form.html.erb +2 -2
  46. data/app/views/camaleon_cms/admin/users/index.html.erb +8 -1
  47. data/app/views/layouts/camaleon_cms/admin.html.erb +2 -2
  48. data/config/initializers/active_record_extension.rb +9 -0
  49. data/config/initializers/assets.rb +1 -1
  50. data/config/locales/camaleon_cms/admin/en.yml +1 -1
  51. data/config/locales/camaleon_cms/admin/es.yml +2 -2
  52. data/config/locales/camaleon_cms/admin/fr.yml +1 -1
  53. data/config/locales/camaleon_cms/admin/it.yml +1 -1
  54. data/config/locales/camaleon_cms/admin/js.yml +40 -40
  55. data/config/locales/camaleon_cms/admin/nl.yml +1 -1
  56. data/config/locales/camaleon_cms/admin/pt-BR.yml +1 -1
  57. data/config/locales/camaleon_cms/admin/pt.yml +1 -1
  58. data/config/locales/camaleon_cms/admin/ru.yml +1 -1
  59. data/config/locales/camaleon_cms/admin/zh-CH.yml +56 -30
  60. data/config/routes/frontend.rb +53 -14
  61. data/lib/camaleon_cms/engine.rb +4 -2
  62. data/lib/camaleon_cms/version.rb +1 -1
  63. data/lib/ext/string.rb +10 -2
  64. data/lib/generators/camaleon_cms/gem_plugin_generator.rb +3 -2
  65. data/spec/dummy/db/schema.rb +11 -0
  66. data/spec/dummy/log/test.log +56824 -0
  67. data/spec/features/pages_spec.rb +2 -1
  68. data/spec/features/posts_spec.rb +3 -1
  69. data/spec/spec_helper.rb +2 -2
  70. data/spec/support/common.rb +2 -2
  71. metadata +6 -10
  72. data/app/assets/javascripts/camaleon_cms/admin/login.js.coffee +0 -7
  73. data/app/assets/javascripts/camaleon_cms/admin/login_manifest.js +0 -15
  74. data/app/assets/javascripts/camaleon_cms/gibberish-aes.js +0 -1017
  75. data/lib/ext/aes_crypt.rb +0 -246
  76. data/spec/dummy/db/test.sqlite3 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a70abf6d23b59ecc47fdf7666258242f837fe8af
4
- data.tar.gz: 3e1bc98690fd647da857231f85be2f9bb844d2e1
3
+ metadata.gz: 6b264403b317f1fc7b159a14442421358ab80d98
4
+ data.tar.gz: bd2ddf3797fc12138f8d0080767ae8517af75e36
5
5
  SHA512:
6
- metadata.gz: 4fba30af329005cdbfd531987208ee1d763b7d80be12b5b44f2a0e00fb13ac50b941c17bbda2a80361272fab3ecad728acc92e6e94c7623bbc64abd37badae14
7
- data.tar.gz: 8c31ce3068330cd538ac544e5a641b4171c9ee80011e443d5a203ff5f9633e0643743be3db1c24cf40f94c2a49972d0d44d646e667a54d0e54bf8d18f0c06ba3
6
+ metadata.gz: 7e739c3983fb4c3cb399f1c53ac56505821fb810468af2e014c8e413d0be7f9362a8b0a18c02d73a2691ba8fd75522b1dd45909fb5dda600a1f3e6cfc87d75fc
7
+ data.tar.gz: b668dba2056ce6b4daa25b149a876316f0143e8c15a98730ab6b255b966d9488cea61d09629b1436378896e65a317cd4e1c23c071152ed5e6eb3e350fb862479
data/README.md CHANGED
@@ -46,15 +46,15 @@
46
46
 
47
47
  Add in your Gemfile draper for Rails 5
48
48
  ```
49
- gem 'draper', github: 'drapergem/draper'
49
+ gem 'draper', '~> 3'
50
50
  ```
51
- In your Gemfile, change sass-rails into (Camaleon doesn't support for sprockets >= 4 which is included in sass-rails >= 6)
51
+ Be careful with sass-rails, recommended v5 (Camaleon doesn't support for sprockets >= 4 which is included in sass-rails 6)
52
52
  ```
53
53
  gem 'sass-rails', '~> 5.0'
54
54
  ```
55
- Add this configuration to your config/application.rb
55
+ Update bundle
56
56
  ```
57
- config.active_record.belongs_to_required_by_default = false
57
+ bundle update
58
58
  ```
59
59
 
60
60
  * Install required Gem and dependencies
@@ -172,7 +172,7 @@ http://camaleon.tuzitio.com/license.html
172
172
  RAILS_ENV=test bundle exec rake app:db:migrate
173
173
  RAILS_ENV=test bundle exec rake app:db:test:prepare
174
174
  ```
175
- * Configure/Install Poltergaist and change your phanthomjs path in spec/spec_helper.rb
175
+ * Configure/Install Poltergeist and change your phanthomjs path in spec/spec_helper.rb
176
176
 
177
177
  * Run testing
178
178
  ```
@@ -5,8 +5,7 @@
5
5
 
6
6
  //***************customization*****************/
7
7
  // jquery custom validations and default values
8
- (function ($) {
9
-
8
+ jQuery(function(){
10
9
  // file formats
11
10
  $.file_formats = {
12
11
  jpg: "image",
@@ -120,4 +119,5 @@
120
119
  jQuery.validator.addClassRules({
121
120
  file_format: {file_format: true}
122
121
  });
123
- })(jQuery);
122
+ $('form.cama_form_validate').validate();
123
+ });
@@ -129,6 +129,15 @@ tinymce.addI18n('zh-CN',{
129
129
  "Poster": "\u5c01\u9762",
130
130
  "Alternative source": "\u955c\u50cf",
131
131
  "Paste your embed code below:": "\u5c06\u5185\u5d4c\u4ee3\u7801\u7c98\u8d34\u5728\u4e0b\u9762:",
132
+ "Insert file": "插入文件",
133
+ "Media": "媒体文件",
134
+ "Image": "图片",
135
+ "Link": "链接",
136
+ "New line at the end": "在末尾插入新行",
137
+ "New line": "新行",
138
+ "Date/time": "日期/时间",
139
+ "Template": "模板",
140
+ "Insert/edit media": "插入/编辑媒体文件",
132
141
  "Insert video": "\u63d2\u5165\u89c6\u9891",
133
142
  "Embed": "\u5185\u5d4c",
134
143
  "Nonbreaking space": "\u4e0d\u95f4\u65ad\u7a7a\u683c",
@@ -216,4 +225,4 @@ tinymce.addI18n('zh-CN',{
216
225
  "View": "\u89c6\u56fe",
217
226
  "Table": "\u8868\u683c",
218
227
  "Format": "\u683c\u5f0f"
219
- });
228
+ });
@@ -10,6 +10,11 @@
10
10
  padding: 5px 5px 5px 15px
11
11
  }
12
12
 
13
+ .ajax-file-upload-filename {
14
+ overflow: auto;
15
+ max-width: 100%;
16
+ }
17
+
13
18
  .ajax-file-upload-filesize {
14
19
  width: 50px;
15
20
  height: auto;
@@ -20,7 +25,7 @@ vertical-align:middle;
20
25
  .ajax-file-upload-progress {
21
26
  margin: 5px 10px 5px 0px;
22
27
  position: relative;
23
- width: 250px;
28
+ width: 98%;
24
29
  border: 1px solid #ddd;
25
30
  padding: 1px;
26
31
  border-radius: 3px;
@@ -221,6 +226,13 @@ margin: 5px 10px 5px 0px;
221
226
  font-size: 120px;
222
227
  }
223
228
  }
229
+ .p_label {
230
+ span {
231
+ overflow: auto;
232
+ max-width: 100%;
233
+ display: inline-block;
234
+ }
235
+ }
224
236
  .p_footer{
225
237
  border-top: 1px solid #ccc;
226
238
  margin-top: 12px;
@@ -241,4 +253,4 @@ margin: 5px 10px 5px 0px;
241
253
  width: 100% !important;
242
254
  }
243
255
  }
244
- }
256
+ }
@@ -55,7 +55,7 @@ class CamaleonCms::Admin::Appearances::NavMenusController < CamaleonCms::AdminCo
55
55
  def save_custom_settings
56
56
  @nav_menu_item = current_site.nav_menu_items.find(params[:id])
57
57
  @nav_menu_item.set_field_values(params.require(:field_options).permit!)
58
- render nothing: true
58
+ head :ok
59
59
  end
60
60
 
61
61
  # render edit external menu item
@@ -75,7 +75,7 @@ class CamaleonCms::Admin::Appearances::NavMenusController < CamaleonCms::AdminCo
75
75
  def delete_menu_item
76
76
  # @nav_menu = current_site.nav_menus.find(params[:nav_menu_id])
77
77
  current_site.nav_menu_items.find(params[:id]).destroy
78
- render nothing: true
78
+ head :ok
79
79
  end
80
80
 
81
81
  # update the reorder of items
@@ -102,7 +102,8 @@ class CamaleonCms::Admin::Appearances::NavMenusController < CamaleonCms::AdminCo
102
102
 
103
103
  if params[:custom_items].present? # custom menu items
104
104
  params[:custom_items].each do |index, item|
105
- item = @nav_menu.append_menu_item({label: item['label'], link: item['url'], type: item['kind'] || 'external'})
105
+ type = item['kind'].present? ? item['kind'] : 'external'
106
+ item = @nav_menu.append_menu_item({label: item['label'], link: item['url'], type: type})
106
107
  items << item
107
108
  end
108
109
  end
@@ -17,9 +17,12 @@ class CamaleonCms::Admin::CategoriesController < CamaleonCms::AdminController
17
17
  end
18
18
 
19
19
  def update
20
+ hooks_run("update_category", {category: @category, post_type: @post_type})
21
+
20
22
  if @category.update(params.require(:category).permit!)
21
23
  @category.set_options(params[:meta])
22
24
  @category.set_field_values(params[:field_options])
25
+ hooks_run("updated_category", {category: @category, post_type: @post_type})
23
26
  flash[:notice] = t('camaleon_cms.admin.post_type.message.updated')
24
27
  redirect_to action: :index
25
28
  else
@@ -1,3 +1,4 @@
1
+ require 'will_paginate/array'
1
2
  class CamaleonCms::Admin::CommentsController < CamaleonCms::AdminController
2
3
  include CamaleonCms::CommentHelper
3
4
  add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.comments"), :cama_admin_comments_url
@@ -48,7 +48,7 @@ class CamaleonCms::Admin::Posts::DraftsController < CamaleonCms::Admin::PostsCon
48
48
  post_data = params.require(:post).permit!
49
49
  post_data.delete(:created_at) unless params[:post][:created_at].present?
50
50
  post_data.delete(:updated_at) unless params[:post][:updated_at].present?
51
- post_data[:status] = 'draft'
51
+ post_data[:status] = 'draft_child'
52
52
  post_data[:post_parent] = params[:post_id]
53
53
  post_data[:user_id] = cama_current_user.id unless post_data[:user_id].present?
54
54
  post_data[:data_tags] = params[:tags].to_s
@@ -35,14 +35,15 @@ class CamaleonCms::Admin::PostsController < CamaleonCms::AdminController
35
35
  @lists_tab = params[:s]
36
36
  add_breadcrumb I18n.t("camaleon_cms.admin.post_type.#{params[:s]}") if params[:s].present?
37
37
  case params[:s]
38
- when "published", "pending", "draft", "trash"
39
- @posts = @posts.where(status: params[:s])
40
-
38
+ when "published", "pending", "trash"
39
+ @posts = @posts.send(params[:s])
40
+ when "draft"
41
+ @posts = @posts.drafts
41
42
  when "all"
42
43
  @posts = @posts.no_trash
43
44
  end
44
45
 
45
- @btns = {published: "#{t('camaleon_cms.admin.post_type.published')} (#{posts_all.where(status: "published").size})", all: "#{t('camaleon_cms.admin.post_type.all')} (#{posts_all.no_trash.size})", pending: "#{t('camaleon_cms.admin.post_type.pending')} (#{posts_all.where(status: "pending").size})", draft: "#{t('camaleon_cms.admin.post_type.draft')} (#{posts_all.where(status: "draft").size})", trash: "#{t('camaleon_cms.admin.post_type.trash')} (#{posts_all.where(status: "trash").size})"}
46
+ @btns = {published: "#{t('camaleon_cms.admin.post_type.published')} (#{posts_all.published.size})", all: "#{t('camaleon_cms.admin.post_type.all')} (#{posts_all.no_trash.size})", pending: "#{t('camaleon_cms.admin.post_type.pending')} (#{posts_all.pending.size})", draft: "#{t('camaleon_cms.admin.post_type.draft')} (#{posts_all.drafts.size})", trash: "#{t('camaleon_cms.admin.post_type.trash')} (#{posts_all.trash.size})"}
46
47
  r = {posts: @posts, post_type: @post_type, btns: @btns, all_posts: posts_all, render: 'index', per_page: per_page }
47
48
  hooks_run("list_post", r)
48
49
  per_page = 9999999 if @post_type.manage_hierarchy?
@@ -91,13 +92,24 @@ class CamaleonCms::Admin::PostsController < CamaleonCms::AdminController
91
92
  end
92
93
 
93
94
  def update
94
- @post = @post.parent if @post.draft? && @post.parent.present?
95
- authorize! :update, @post
96
- @post.drafts.destroy_all
97
95
  post_data = get_post_data
96
+ delete_drafts = false
97
+ if @post.draft_child? && @post.parent.present?
98
+ # This is a draft (as a child of the original post)
99
+ original_parent = @post.parent.parent
100
+ post_data[:post_parent] = original_parent.present? ? original_parent.id : nil
101
+ @post = @post.parent
102
+ delete_drafts = true
103
+ elsif @post.draft?
104
+ # This is a normal draft (post whose status was set to 'draft')
105
+ @post.status = 'published' if post_data[:status].blank?
106
+ end
107
+ authorize! :update, @post
98
108
  r = {post: @post, post_type: @post_type}; hooks_run("update_post", r)
99
109
  @post = r[:post]
100
110
  if @post.update(post_data)
111
+ # delete drafts only on successful update operation
112
+ @post.drafts.destroy_all if delete_drafts
101
113
  @post.set_metas(params[:meta])
102
114
  @post.set_field_values(params[:field_options])
103
115
  @post.set_options(params[:options])
@@ -116,6 +128,7 @@ class CamaleonCms::Admin::PostsController < CamaleonCms::AdminController
116
128
  # @post.children.destroy_all unless @post.draft? TODO: why delete children?
117
129
  @post.update_column('status', 'trash')
118
130
  @post.update_extra_data
131
+ hooks_run("trashed_post", {post: @post, post_type: @post_type})
119
132
  flash[:notice] = t('camaleon_cms.admin.post.message.trash', post_type: @post_type.decorate.the_title)
120
133
  redirect_to action: :index, s: params[:s]
121
134
  end
@@ -125,6 +138,7 @@ class CamaleonCms::Admin::PostsController < CamaleonCms::AdminController
125
138
  authorize! :update, @post
126
139
  @post.update_column('status', @post.options[:status_default] || 'pending')
127
140
  @post.update_extra_data
141
+ hooks_run("restored_post", {post: @post, post_type: @post_type})
128
142
  flash[:notice] = t('camaleon_cms.admin.post.message.restore', post_type: @post_type.decorate.the_title)
129
143
  redirect_to action: :index, s: params[:s]
130
144
  end
@@ -18,8 +18,6 @@ class CamaleonCms::Admin::SessionsController < CamaleonCms::CamaleonController
18
18
 
19
19
  def login_post
20
20
  data_user = user_permit_data
21
- cipher = Gibberish::AES::CBC.new(cama_get_session_id)
22
- data_user[:password] = cipher.decrypt(data_user[:password]) rescue nil
23
21
  @user = current_site.users.by_username(data_user[:username]).first
24
22
  captcha_validate = captcha_verify_if_under_attack("login")
25
23
  r = {user: @user, params: params, password: data_user[:password], captcha_validate: captcha_validate, stop_process: false}; hooks_run("user_before_login", r)
@@ -68,7 +68,7 @@ class CamaleonCms::Admin::SettingsController < CamaleonCms::AdminController
68
68
  def test_email
69
69
  begin
70
70
  CamaleonCms::HtmlMailer.sender(params[:email], 'Test', {content: 'Test content'}).deliver_now
71
- render nothing: true
71
+ head :ok
72
72
  rescue => e
73
73
  render inline: e.message, status: 502
74
74
  end
@@ -27,7 +27,7 @@ class CamaleonCms::Admin::UsersController < CamaleonCms::AdminController
27
27
 
28
28
  def update
29
29
  r={user: @user}; hooks_run('user_update', r)
30
- if @user.update(params.require(:user).permit!)
30
+ if @user.update(user_params)
31
31
  @user.set_metas(params[:meta]) if params[:meta].present?
32
32
  @user.set_field_values(params[:field_options])
33
33
  r = {user: @user, message: t('camaleon_cms.admin.users.message.updated'), params: params}; hooks_run('user_after_edited', r)
@@ -80,7 +80,9 @@ class CamaleonCms::Admin::UsersController < CamaleonCms::AdminController
80
80
  end
81
81
 
82
82
  def destroy
83
- if @user.destroy
83
+ if current_user.id == @user.id
84
+ flash[:error] = t('camaleon_cms.admin.users.message.user_can_not_delete_own_account', default: 'User can not delete own account')
85
+ elsif @user.destroy
84
86
  flash[:notice] = t('camaleon_cms.admin.users.message.deleted')
85
87
  r={user: @user}; hooks_run('user_destroyed', r)
86
88
  end
@@ -99,7 +101,16 @@ class CamaleonCms::Admin::UsersController < CamaleonCms::AdminController
99
101
  end
100
102
 
101
103
  def user_id_param
102
- user_params = params[:id] || params[:user_id]
104
+ params[:id] || params[:user_id]
105
+ end
106
+
107
+ def user_params
108
+ parameters = params.require(:user)
109
+ if current_user.role_grantor?(@user)
110
+ parameters.permit(:username, :email, :role, :first_name, :last_name)
111
+ else
112
+ parameters.permit(:username, :email, :first_name, :last_name)
113
+ end
103
114
  end
104
115
 
105
116
  def set_user
@@ -156,7 +156,7 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
156
156
  if params[:format] == 'html' || !params[:format].present?
157
157
  page_not_found()
158
158
  else
159
- render nothing: true, status: 404
159
+ head 404
160
160
  end
161
161
  else
162
162
  @post = @post.decorate
@@ -31,14 +31,14 @@ module CamaleonCms::FrontendConcern extend ActiveSupport::Concern
31
31
  @post = current_site.posts.find_by_id(params[:post_id]).decorate
32
32
  user = cama_current_user
33
33
  comment_data = {}
34
- if !user.present? && current_site.get_option('permit_anonimos_comment', false)
34
+ if user.present?
35
+ comment_data[:author] = user.fullname
36
+ comment_data[:author_email] = user.email
37
+ elsif current_site.get_option('permit_anonimos_comment', false)
35
38
  user = current_site.get_anonymous_user
36
39
  comment_data[:is_anonymous] = true
37
40
  comment_data[:author] = params[:post_comment][:name]
38
41
  comment_data[:author_email] = params[:post_comment][:email]
39
- else
40
- comment_data[:author] = user.fullname
41
- comment_data[:author_email] = user.email
42
42
  end
43
43
 
44
44
  if @post.can_commented? && user.present?
@@ -26,7 +26,7 @@ class CamaleonCms::ApplicationDecorator < Draper::Decorator
26
26
 
27
27
  # return updated at date formatted
28
28
  def the_updated_at(format = :long)
29
- h.l(object.created_at, format: format.to_sym)
29
+ h.l(object.updated_at, format: format.to_sym)
30
30
  end
31
31
 
32
32
  # draw breadcrumb for this model
@@ -150,7 +150,7 @@ class CamaleonCms::PostDecorator < CamaleonCms::ApplicationDecorator
150
150
  when "published"
151
151
  color = "info"
152
152
  status = I18n.t('camaleon_cms.admin.post_type.published', default: 'Published')
153
- when "draft"
153
+ when "draft", "draft_child"
154
154
  color = "warning"
155
155
  status = I18n.t('camaleon_cms.admin.table.draft', default: 'Draft')
156
156
  when "trash"
@@ -227,7 +227,7 @@ class CamaleonCms::PostDecorator < CamaleonCms::ApplicationDecorator
227
227
  # return all related posts of current post
228
228
  def the_related_posts
229
229
  ptype = self.the_post_type
230
- ptype.the_posts.joins(:categories).where("#{CamaleonCms::TermRelationship.table_name}" => {term_taxonomy_id: the_categories.pluck(:id)})
230
+ ptype.the_posts.joins(:categories).where("#{CamaleonCms::TermRelationship.table_name}" => {term_taxonomy_id: the_categories.pluck(:id)}).distinct
231
231
  end
232
232
 
233
233
  # fix for "Using Draper::Decorator without inferred source class"
@@ -10,7 +10,9 @@ class CamaleonCms::PostTypeDecorator < CamaleonCms::TermTaxonomyDecorator
10
10
  args[:locale] = get_locale unless args.include?(:locale)
11
11
  args[:format] = args[:format] || "html"
12
12
  as_path = args.delete(:as_path)
13
- h.cama_url_to_fixed("cama_post_type_#{self.id}_#{as_path.present? ? "path" : "url"}", args)
13
+ route = "cama_post_type_#{self.id}_#{as_path.present? ? "path" : "url"}"
14
+ PluginRoutes.reload unless Rails.application.routes.url_helpers.method_defined?(route.to_sym)
15
+ h.cama_url_to_fixed(route, args)
14
16
  end
15
17
 
16
18
  # return the public url with group structure
@@ -51,6 +51,10 @@ class CamaleonCms::UserDecorator < CamaleonCms::ApplicationDecorator
51
51
  h.current_site.posts.where(user_id: object.id)
52
52
  end
53
53
 
54
+ def role_grantor?(other_user)
55
+ h.can?(:manage, :users) && id != other_user.id
56
+ end
57
+
54
58
  def self.object_class_name
55
59
  'CamaleonCms::User'
56
60
  end
@@ -30,7 +30,7 @@ module CamaleonCms::Admin::ApplicationHelper
30
30
  #{will_paginate(items, will_paginate_options) rescue '' }
31
31
  </div>
32
32
  <div class='col-md-6 text-right total-items'>
33
- <strong>Total: #{items.total_entries rescue items.count} </strong>
33
+ <strong>#{I18n.t('camaleon_cms.admin.table.total', default: 'Total')}: #{items.total_entries rescue items.count} </strong>
34
34
  </div>
35
35
  </div>"
36
36
  end
@@ -42,7 +42,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
42
42
  }
43
43
  items[:radio] = {
44
44
  key: 'radio',
45
- label: 'Radio',
45
+ label: t('camaleon_cms.admin.custom_field.fields.radio', default: 'Radio'),
46
46
  options: {
47
47
  required: true,
48
48
  multiple: false,
@@ -57,7 +57,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
57
57
 
58
58
  items[:checkbox] = {
59
59
  key: 'checkbox',
60
- label: 'Checkbox',
60
+ label: t('camaleon_cms.admin.custom_field.fields.checkbox', default: 'Checkbox'),
61
61
  options: {
62
62
  required: true,
63
63
  multiple: false,
@@ -67,7 +67,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
67
67
  }
68
68
  items[:checkboxes] = {
69
69
  key: 'checkboxes',
70
- label: 'Checkboxes',
70
+ label: t('camaleon_cms.admin.custom_field.fields.checkboxes', default: 'Checkboxes'),
71
71
  options: {
72
72
  required: false,
73
73
  multiple: false,
@@ -80,7 +80,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
80
80
  }
81
81
  items[:audio] = {
82
82
  key: 'audio',
83
- label: 'Audio',
83
+ label: t('camaleon_cms.admin.custom_field.fields.audio', default: 'Audio'),
84
84
  options: {
85
85
  required: true,
86
86
  multiple: true,
@@ -147,7 +147,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
147
147
  }
148
148
  items[:editor] = {
149
149
  key: 'editor',
150
- label: 'Editor',
150
+ label: t('camaleon_cms.admin.custom_field.fields.editor', default: 'Editor'),
151
151
  options: {
152
152
  required: false,
153
153
  multiple: true,
@@ -229,7 +229,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
229
229
  }
230
230
  items[:url] = {
231
231
  key: 'url',
232
- label: 'URL',
232
+ label: t('camaleon_cms.admin.custom_field.fields.url', default: 'URL'),
233
233
  options: {
234
234
  required: true,
235
235
  multiple: true,
@@ -240,7 +240,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
240
240
  }
241
241
  items[:video] = {
242
242
  key: 'video',
243
- label: 'Video',
243
+ label: t('camaleon_cms.admin.custom_field.fields.video', default: 'Video'),
244
244
  options: {
245
245
  required: true,
246
246
  multiple: true,
@@ -292,7 +292,7 @@ module CamaleonCms::Admin::CustomFieldsHelper
292
292
  multiple: true
293
293
  }
294
294
  }
295
-
295
+
296
296
  # evaluate the content of command value on listing
297
297
  # sample command: options_from_collection_for_select(current_site.the_posts("commerce").decorate, :id, :the_title)
298
298
  items[:select_eval] = {