camaleon_cms 2.2.0 → 2.2.1

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/apps/plugins/attack/config/locales/translation.yml +38 -1
  4. data/app/apps/plugins/front_cache/admin_controller.rb +2 -3
  5. data/app/apps/plugins/front_cache/config/locales/translation.yml +39 -0
  6. data/app/apps/plugins/front_cache/front_cache_helper.rb +7 -2
  7. data/app/apps/plugins/front_cache/views/admin/settings.html.erb +1 -0
  8. data/app/apps/themes/camaleon_first/views/layouts/mailer.html.erb +2 -2
  9. data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +2 -1
  10. data/app/controllers/camaleon_cms/admin/settings_controller.rb +10 -0
  11. data/app/controllers/camaleon_cms/admin/users_controller.rb +6 -2
  12. data/app/controllers/camaleon_cms/frontend_controller.rb +5 -6
  13. data/app/helpers/camaleon_cms/html_helper.rb +2 -3
  14. data/app/helpers/camaleon_cms/plugins_helper.rb +4 -3
  15. data/app/mailers/camaleon_cms/html_mailer.rb +7 -1
  16. data/app/models/camaleon_cms/ability.rb +1 -1
  17. data/app/models/camaleon_cms/custom_field.rb +1 -1
  18. data/app/models/camaleon_cms/custom_field_group.rb +1 -1
  19. data/app/views/camaleon_cms/admin/plugins/_plugins_list.html.erb +4 -0
  20. data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +1 -1
  21. data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +8 -4
  22. data/app/views/camaleon_cms/admin/settings/_email_settings.html.erb +26 -4
  23. data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +2 -2
  24. data/app/views/camaleon_cms/default_theme/partials/_search_form.html.erb +1 -1
  25. data/app/views/layouts/camaleon_cms/admin/_form_error.html.erb +1 -1
  26. data/app/views/layouts/camaleon_cms/mailer.html.erb +2 -2
  27. data/config/locales/camaleon_cms/admin/en.yml +2 -1
  28. data/config/locales/camaleon_cms/admin/es.yml +1 -0
  29. data/config/locales/camaleon_cms/admin/it.yml +125 -77
  30. data/config/locales/camaleon_cms/admin/pt-BR.yml +2 -0
  31. data/config/locales/camaleon_cms/admin/pt.yml +641 -0
  32. data/config/locales/camaleon_cms/common.yml +66 -1
  33. data/config/locales/camaleon_cms/languages.yml +25 -6
  34. data/config/locales/pt-BR.yml +10 -8
  35. data/config/locales/pt.yml +201 -0
  36. data/config/routes/admin.rb +1 -0
  37. data/lib/camaleon_cms/version.rb +1 -1
  38. data/lib/generators/camaleon_cms/gem_plugin_template/config/initializers/custom_models.rb +4 -2
  39. data/lib/plugin_routes.rb +2 -0
  40. metadata +5 -3
  41. data/lib/generators/camaleon_cms/install_template/apps/plugins/readme.txt +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a8d04f6b677b60b055717333082cc33f4a5eb23
4
- data.tar.gz: cb1b1292033c55314017d3feefd1f35d4f73a779
3
+ metadata.gz: 0f2311c64b5733734063aa36f0a49753b2ebb008
4
+ data.tar.gz: a9a8eb3e3530e87c5fd03a653a860cd3771a4b15
5
5
  SHA512:
6
- metadata.gz: cadc1f31405e3cc1fe1aa0ccd6263a0dc0a812a476cb47f7889c86baa081f6f740e27eead856a059e305b988ca47b38dff9c3d3286c8766acacac64229896978
7
- data.tar.gz: 5a7a78728a449ce23abf975786a1d2797747bbd2c5998f741c40afa248c51552905e7ccaadd0781ab22c873dff947a5af97e8d00728e6fb6d3ce4fa16e306e64
6
+ metadata.gz: 9672abfcdc463517922a76860e6fcf66c3b4680c14cbf2a31d05933176e84492a4f8d9ec0eec490c8a404743d3f2d39304b94f3c9f21402022990eda8ec2d40f
7
+ data.tar.gz: 0e4eb6d9a7895116cbdae3f2678ae4b19ef8689fbf1208f24398a70e369b88069860d5485b7d0eccb5ff8b555003d6e463dc55be8033ca60a2b957757c03535b
data/README.md CHANGED
@@ -28,7 +28,7 @@
28
28
  * Add the gem in your Gemfile
29
29
 
30
30
  ```
31
- gem "camaleon_cms", '>=2.2.0' # Stable versions 2.1.2.0, 2.1.1.4, 2.1.1, 2.1.0
31
+ gem "camaleon_cms", '>=2.2.1' # Stable versions 2.1.2.0, 2.1.1.4, 2.1.1, 2.1.0
32
32
  # gem "camaleon_cms", github: 'owen2345/camaleon-cms' # current development version
33
33
  ```
34
34
  * Install required Gem and dependencies
@@ -1,4 +1,5 @@
1
- en:
1
+ # encoding: utf-8
2
+ en:
2
3
  plugin:
3
4
  attack:
4
5
  title: 'Attack'
@@ -16,6 +17,24 @@
16
17
  settings_saved: 'Settings saved!'
17
18
  settings: 'Settings'
18
19
 
20
+ pt:
21
+ plugin:
22
+ attack:
23
+ title: 'Ataque'
24
+ attack_security: 'Segurança contra ataques'
25
+ form:
26
+ in: 'em'
27
+ seconds: 'Segundos'
28
+ minutes: 'Minutos'
29
+ type_max_requests_time: 'Requisições %{type} máximas'
30
+ type_time_requests_seconds: 'Requisições %{type} por tipo [segundos]'
31
+ ban_time_minutes: 'Tempo de expulsão'
32
+ ban_messages: 'Mensagem de expulsão'
33
+ request_limit_exceeded: 'Número de requisições excedeu o limite!'
34
+ messages:
35
+ settings_saved: 'Configurações gravadas com sucesso!'
36
+ settings: 'Configurações'
37
+
19
38
  pt-BR:
20
39
  plugin:
21
40
  attack:
@@ -72,3 +91,21 @@ nl:
72
91
  messages:
73
92
  settings_saved: 'instellingen opgeslagen!'
74
93
  settings: 'instellingen'
94
+
95
+ it:
96
+ plugin:
97
+ attack:
98
+ title: 'Attack'
99
+ attack_security: 'Attack security'
100
+ form:
101
+ in: 'in'
102
+ seconds: 'Secondi'
103
+ minutes: 'Minuti'
104
+ type_max_requests_time: 'Numero massimo di richieste %{type}'
105
+ type_time_requests_seconds: '%{type} tempo richiesto [secondi]'
106
+ ban_time_minutes: 'Tempo di espulsione'
107
+ ban_messages: 'Messaggio di espulsione'
108
+ request_limit_exceeded: 'Il numero di richieste ha superato il limite!'
109
+ messages:
110
+ settings_saved: 'Impostazioni salvate!'
111
+ settings: 'Impostazioni'
@@ -9,8 +9,7 @@
9
9
  class Plugins::FrontCache::AdminController < CamaleonCms::Apps::PluginsAdminController
10
10
  include Plugins::FrontCache::FrontCacheHelper
11
11
  def settings
12
- add_asset_library("multiselect")
13
- @caches = current_site.get_meta("front_cache_elements", {})
12
+ @caches = current_site.get_meta("front_cache_elements", {paths: []})
14
13
  @caches[:paths] << "" unless @caches[:paths].present?
15
14
  end
16
15
 
@@ -32,4 +31,4 @@ class Plugins::FrontCache::AdminController < CamaleonCms::Apps::PluginsAdminCont
32
31
  redirect_to :back
33
32
  end
34
33
 
35
- end
34
+ end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  en:
2
3
  plugin:
3
4
  front_cache:
@@ -56,6 +57,25 @@ nl:
56
57
  cache_destroyed: 'Cache opgeschoond!'
57
58
  settings: 'instellingen'
58
59
 
60
+ pt-BR:
61
+ plugin:
62
+ front_cache:
63
+ button:
64
+ add_new_path: 'Adicionar novo caminho'
65
+ custom_url_paths: 'Caminhos de URL personalizados'
66
+ clean_cache: 'Limpar Cache'
67
+ title: 'Cache de Páginas de Front End'
68
+ home_page: 'Página Inicial'
69
+ pages: 'Páginas'
70
+ pages_of: 'Páginas de'
71
+ skip_cache_pages: 'Saltar Cache de Páginas'
72
+ message:
73
+ please_checkpost_need_cache: 'Por favor verifique todas as publicações ou o tipo do publicação que precisa colocar em cache.'
74
+ enabled_cache_inner_content_logged_users: 'Permitir cache para conteúdo interno de utilizadores ligados'
75
+ settings_saved: 'Configurações Gravadas!'
76
+ cache_destroyed: 'Cache destruída!'
77
+ settings: 'Configurações'
78
+
59
79
  pt-BR:
60
80
  plugin:
61
81
  front_cache:
@@ -74,3 +94,22 @@ pt-BR:
74
94
  settings_saved: 'Configurações Salvas!'
75
95
  cache_destroyed: 'Cache destruído!'
76
96
  settings: 'Configurações'
97
+
98
+ it:
99
+ plugin:
100
+ front_cache:
101
+ button:
102
+ add_new_path: 'Aggiungi un nuovo percorso'
103
+ custom_url_paths: 'URL personalizzate'
104
+ clean_cache: 'Pulisci la cache'
105
+ title: 'Frontend cache'
106
+ home_page: 'Home Page'
107
+ pages: 'Pagine'
108
+ pages_of: 'Pagine di'
109
+ skip_cache_pages: 'Pagine da non cachare'
110
+ message:
111
+ please_checkpost_need_cache: 'Per favore, verifica tutti i tipi di messaggi o e-mail che è necessario memorizzare nella cache.'
112
+ enabled_cache_inner_content_logged_users: 'Attiva il contenuto della cache interna per gli utenti registrati'
113
+ settings_saved: 'Impostazioni salvate!'
114
+ cache_destroyed: 'Cache distrutta!'
115
+ settings: 'Impostazioni'
@@ -27,7 +27,7 @@ module Plugins::FrontCache::FrontCacheHelper
27
27
 
28
28
  @caches = current_site.get_meta("front_cache_elements")
29
29
  @_plugin_do_cache = false
30
- if @caches[:paths].include?(front_request_key) || (params[:action] == "index" && @caches[:home].present?) # cache paths and home page
30
+ if match_path_patterns? || (params[:action] == "index" && @caches[:home].present?) # cache paths and home page
31
31
  @_plugin_do_cache = true
32
32
  elsif params[:action] == "post" && !params[:draft_id].present?
33
33
  begin
@@ -157,4 +157,9 @@ module Plugins::FrontCache::FrontCacheHelper
157
157
  request.path_info.split("?").first
158
158
  end
159
159
 
160
- end
160
+ def match_path_patterns?
161
+ @caches[:paths].any? do |path_pattern|
162
+ front_request_key =~ Regexp.new(path_pattern)
163
+ end
164
+ end
165
+ end
@@ -10,6 +10,7 @@
10
10
  form.on("click", ".del_path", function(){
11
11
  $(this).closest(".input-group").remove();
12
12
  });
13
+ $('#cache_front_form select').selectpicker();
13
14
  });
14
15
  </script>
15
16
  <%= form_for(admin_plugins_front_cache_settings_path, html:{ id: "cache_front_form" }) do %>
@@ -7,7 +7,7 @@
7
7
  <body>
8
8
  <table style="width: 100%">
9
9
  <tr>
10
- <td style="text-align: center; background-color: #1ABC9C; padding: 10px;"><img src="http://camaleon.tuzitio.com/media/132/logo2.png"></td>
10
+ <td style="text-align: center; background-color: #1ABC9C; padding: 10px;"><%= image_tag @current_site.the_logo %></td>
11
11
  </tr>
12
12
  <tr>
13
13
  <td>
@@ -19,4 +19,4 @@
19
19
  </tr>
20
20
  </table>
21
21
  </body>
22
- </html>
22
+ </html>
@@ -158,7 +158,8 @@ function custom_field_editor($field) {
158
158
  }
159
159
  function custom_field_field_attrs_val($field, value) {
160
160
  if ($field) {
161
- var data = $.parseJSON(value || '{}');
161
+ value = value || '{}'
162
+ var data = typeof(value) == 'object' ? value : $.parseJSON(value);
162
163
  $field.find('.input-attr').val(data.attr);
163
164
  $field.find('.input-value').val(data.value)
164
165
  $field.find('.input-attr, .input-value').filter('.is_translate').addClass('translatable').Translatable(ADMIN_TRANSLATIONS);
@@ -69,6 +69,16 @@ class CamaleonCms::Admin::SettingsController < CamaleonCms::AdminController
69
69
  redirect_to action: :theme
70
70
  end
71
71
 
72
+ # send email test
73
+ def test_email
74
+ begin
75
+ CamaleonCms::HtmlMailer.sender(params[:email], 'Test', {content: 'Test content'}).deliver_now
76
+ render nothing: true
77
+ rescue => e
78
+ render inline: e.message, status: 502
79
+ end
80
+ end
81
+
72
82
  private
73
83
 
74
84
  def validate_role
@@ -95,12 +95,16 @@ class CamaleonCms::Admin::UsersController < CamaleonCms::AdminController
95
95
  private
96
96
 
97
97
  def validate_role
98
- (params[:id].present? && cama_current_user.id == params[:id]) || authorize!(:manage, :users)
98
+ (user_id_param.present? && cama_current_user.id.to_s == user_id_param) || authorize!(:manage, :users)
99
+ end
100
+
101
+ def user_id_param
102
+ user_params = params[:id] || params[:user_id]
99
103
  end
100
104
 
101
105
  def set_user
102
106
  begin
103
- @user = current_site.users.find(params[:id])
107
+ @user = current_site.users.find(user_id_param)
104
108
  rescue
105
109
  flash[:error] = t('camaleon_cms.admin.users.message.error')
106
110
  redirect_to cama_admin_path
@@ -39,7 +39,7 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
39
39
  @cama_visited_category = @category
40
40
  @children = @category.children.no_empty.decorate
41
41
  @posts = @category.the_posts.paginate(:page => params[:page], :per_page => current_site.front_per_page).eager_load(:metas)
42
- r_file = lookup_context.template_exists?("post_types/#{@post_type.the_slug}/category_#{@category.the_slug}") ? "post_types/#{@post_type.the_slug}/category_#{@post_type.the_slug}" : nil # specific template category with specific slug within a posttype
42
+ r_file = lookup_context.template_exists?("category_#{@category.the_slug}") ? "category_#{@category.the_slug}" : nil # specific template category with specific slug within a posttype
43
43
  r_file = lookup_context.template_exists?("post_types/#{@post_type.the_slug}/category") ? "post_types/#{@post_type.the_slug}/category" : nil unless r_file.present? # default template category for all categories within a posttype
44
44
  r_file = lookup_context.template_exists?("categories/#{@category.the_slug}") ? "categories/#{@category.the_slug}" : 'category' unless r_file.present? # default template category for all categories for all posttypes
45
45
 
@@ -80,10 +80,8 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
80
80
  end
81
81
  @cama_visited_tag = @post_tag
82
82
  @posts = @post_tag.the_posts.paginate(:page => params[:page], :per_page => current_site.front_per_page).eager_load(:metas)
83
- r_file = lookup_context.template_exists?("post_types/#{@post_type.the_slug}/post_tag_#{@post_tag.the_slug}") ? "post_types/#{@post_type.the_slug}/post_tag_#{@post_tag.the_slug}" : nil
84
- r_file = lookup_context.template_exists?("post_types/#{@post_type.the_slug}/post_tag") ? "post_types/#{@post_type.the_slug}/post_tag" : nil unless r_file.present?
85
- r_file = lookup_context.template_exists?("post_tags/#{@post_tag.the_slug}") ? "post_tags/#{@post_tag.the_slug}" : "post_tag" unless r_file.present?
86
- layout_ = lookup_context.template_exists?("layouts/post_tags/#{@post_tag.the_slug}") ? "post_tags/#{@post_tag.the_slug}" : (self.send :_layout)
83
+ r_file = lookup_context.template_exists?("post_types/#{@post_type.the_slug}/post_tag") ? "post_types/#{@post_type.the_slug}/post_tag" : 'post_tag'
84
+ layout_ = lookup_context.template_exists?("layouts/post_tag") ? "post_tag" : (self.send :_layout)
87
85
  r = {post_tag: @post_tag, layout: layout_, render: r_file}; hooks_run("on_render_post_tag", r)
88
86
  render r[:render], layout: r[:layout]
89
87
  end
@@ -91,12 +89,13 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
91
89
  # search contents
92
90
  def search
93
91
  breadcrumb_add(ct("search"))
92
+ items = params[:post_type_slugs].present? ? current_site.the_posts(params[:post_type_slugs].split(',')) : current_site.the_posts
94
93
  @cama_visited_search = true
95
94
  @param_search = params[:q]
96
95
  layout_ = lookup_context.template_exists?("layouts/search") ? "search" : (self.send :_layout)
97
96
  r = {layout: layout_, render: "search", posts: nil}; hooks_run("on_render_search", r)
98
97
  params[:q] = (params[:q] || '').downcase
99
- @posts = r[:posts] != nil ? r[:posts] : current_site.the_posts.where("LOWER(title) LIKE ? OR LOWER(content_filtered) LIKE ?", "%#{params[:q]}%", "%#{params[:q]}%")
98
+ @posts = r[:posts] != nil ? r[:posts] : items.where("LOWER(title) LIKE ? OR LOWER(content_filtered) LIKE ?", "%#{params[:q]}%", "%#{params[:q]}%")
100
99
  @posts_size = @posts.size
101
100
  @posts = @posts.paginate(:page => params[:page], :per_page => current_site.front_per_page)
102
101
  render r[:render], layout: r[:layout]
@@ -43,7 +43,7 @@ module CamaleonCms::HtmlHelper
43
43
  # sample: (update existent library)
44
44
  # append_asset_libraries({"colorpicker"=>{js: [plugin_asset("js/my_custom_js")] } })
45
45
  # return nil
46
- def cama_load_custom_assets(libraries)
46
+ def append_asset_libraries(libraries)
47
47
  libraries.each do |key, library|
48
48
  if @_assets_libraries.include?(key)
49
49
  @_assets_libraries[key.to_sym] = @_assets_libraries[key.to_sym].merge(library)
@@ -52,8 +52,7 @@ module CamaleonCms::HtmlHelper
52
52
  end
53
53
  end
54
54
  end
55
-
56
- alias_method :append_asset_libraries, :cama_load_custom_assets
55
+ alias_method :cama_load_custom_assets, :append_asset_libraries
57
56
 
58
57
  # add asset content into custom assets
59
58
  # content may be: <script>alert()</script>
@@ -145,10 +145,11 @@ module CamaleonCms::PluginsHelper
145
145
  # return plugin key for current plugin file (helper|controller|view)
146
146
  # index: internal control (ignored)
147
147
  def self_plugin_key(index = 0)
148
- k = "/plugins/"
149
148
  f = caller[index]
150
- if f.include?(k)
151
- key = f.split(k).last.split("/").first
149
+ if f.include?('/apps/plugins/')
150
+ key = f.split('/apps/plugins/').last.split("/").first
151
+ elsif f.include?('/plugins/')
152
+ key = f.split('/plugins/').last.split("/").first
152
153
  else
153
154
  key = f.split('/gems/').last.split("/").first
154
155
  end
@@ -50,7 +50,13 @@ class CamaleonCms::HtmlMailer < ActionMailer::Base
50
50
  lookup_context.prefixes.prepend("themes/#{theme.slug}") if theme.settings["gem_mode"]
51
51
  lookup_context.prefixes.prepend("themes/#{theme.slug}/views") unless theme.settings["gem_mode"]
52
52
  lookup_context.use_camaleon_partial_prefixes = true
53
- (data[:files] || data[:attachments] || []).each{ |attach| attachments["#{File.basename(attach)}"] = File.open(attach, 'rb') { |f| f.read } if File.exist?(attach) }
53
+ (data[:files] || data[:attachments] || []).each{ |attach|
54
+ if File.exist?(attach) && !File.directory?(attach)
55
+ attachments["#{File.basename(attach)}"] = File.open(attach, 'rb') { |f| f.read }
56
+ else
57
+ Rails.logger.error "File not attached in the mail: #{attach}"
58
+ end
59
+ }
54
60
 
55
61
  layout = data[:layout_name].present? ? data[:layout_name] : false
56
62
  if data[:template_name].present? # render email with template
@@ -77,7 +77,7 @@ class CamaleonCms::Ability
77
77
  can :manage, :plugins if @roles_manager[:plugins] rescue false
78
78
  can :manage, :users if @roles_manager[:users] rescue false
79
79
  can :manage, :settings if @roles_manager[:settings] rescue false
80
- @roles_manager.each do |rol_manage_key, val_role|
80
+ @roles_manager.try(:each) do |rol_manage_key, val_role|
81
81
  can :manage, rol_manage_key.to_sym if val_role.to_s.cama_true? rescue false
82
82
  end
83
83
  end
@@ -19,7 +19,7 @@ class CamaleonCms::CustomField < ActiveRecord::Base
19
19
  belongs_to :custom_field_group, class_name: "CamaleonCms::CustomFieldGroup"
20
20
  belongs_to :parent, class_name: "CamaleonCms::CustomField", :foreign_key => :parent_id
21
21
  alias_attribute :label, :name
22
- validates_uniqueness_of :slug, scope: [:parent_id, :object_class]
22
+ validates_uniqueness_of :slug, scope: [:parent_id, :object_class], unless: lambda{|o| o.is_a?(CamaleonCms::CustomFieldGroup) }
23
23
 
24
24
  scope :configuration, -> {where(parent_id: -1)}
25
25
  scope :visible_group, -> {where(status: nil)}
@@ -15,7 +15,7 @@ class CamaleonCms::CustomFieldGroup < CamaleonCms::CustomField
15
15
  has_many :metas, ->{ where(object_class: 'CustomFieldGroup')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
16
16
  has_many :fields, -> {where(object_class: '_fields')}, :class_name => "CamaleonCms::CustomField", foreign_key: :parent_id, dependent: :destroy
17
17
  belongs_to :site, :class_name => "CamaleonCms::Site", foreign_key: :parent_id
18
- validates_uniqueness_of :slug, scope: [:object_class, :objectid]
18
+ validates_uniqueness_of :slug, scope: [:object_class, :objectid, :parent_id]
19
19
  before_validation :before_validating
20
20
 
21
21
  # add fields to group
@@ -18,6 +18,10 @@
18
18
  <td>
19
19
  <b><%= plugin["title"] %></b>
20
20
  <br>
21
+ <% # sample:
22
+ # def cama_stripe_donation_plugin_options(args)
23
+ # args[:links] << link_to('Settings', admin_plugins_cama_stripe_donation_settings_path)
24
+ # end %>
21
25
  <% hook_run(plugin, "plugin_options", r) if status %>
22
26
  <%= raw r[:links].join(" | ") %>
23
27
  </td>
@@ -4,7 +4,7 @@
4
4
  <div class="panel-body ">
5
5
  <div class="row">
6
6
  <% if @post.draft? && !@post.parent.present? %>
7
- <div class="col-md-12 input-submit"><%= f.submit "#{ (@post.new_record?) ? t('camaleon_cms.admin.page_title.create') : t('camaleon_cms.admin.button.publish')}", class: "btn btn-success btn-lg btn-block", onclick: "$('#post_status').val('#{@post.get_option('draft_status')}')" %></div>
7
+ <div class="col-md-12 input-submit"><%= f.submit "#{ (@post.new_record?) ? t('camaleon_cms.admin.page_title.create') : t('camaleon_cms.admin.button.update')}", class: "btn btn-success btn-lg btn-block", onclick: "$('#post_status').val('#{@post.get_option('draft_status')}')" %></div>
8
8
  <% elsif @post.draft? && @post.parent.present? %>
9
9
  <div class="col-md-12 input-submit"><%= f.submit "#{ t('camaleon_cms.admin.button.recover') }", class: "btn btn-success btn-lg btn-block", onclick: "$('#post_status').val('#{@post.get_option('draft_status')}')" %></div>
10
10
  <% else %>
@@ -52,10 +52,14 @@
52
52
  <label for=""><%= t('camaleon_cms.admin.settings.security.captcha_user_register') %></label><br>
53
53
  <%= check_box :options, :security_captcha_user_register, {checked: @site.security_user_register_captcha_enabled?, class: "icheckbox0"}, "true", "" %>
54
54
  </div>
55
- <div class="form-group">
56
- <label for=""><%= t('camaleon_cms.admin.settings.security.need_validate_email') %></label><br>
57
- <%= check_box :options, :need_validate_email, {checked: @site.need_validate_email?, class: "icheckbox0"}, "true", "" %>
58
- </div>
55
+ <div class="form-group">
56
+ <label for=""><%= t('camaleon_cms.admin.settings.security.need_validate_email') %></label><br>
57
+ <%= check_box :options, :need_validate_email, {checked: @site.need_validate_email?, class: "icheckbox0"}, "true", "" %>
58
+ </div>
59
+ <div class="form-group">
60
+ <label for=""><%= t('camaleon_cms.admin.settings.custom_fields_show_shortcodes', default: 'Show shortcodes of custom fields?') %></label><br>
61
+ <%= check_box :options, :custom_fields_show_shortcodes, {checked: @site.get_option('custom_fields_show_shortcodes', false), class: "icheckbox0"}, "true", "" %>
62
+ </div>
59
63
  </div>
60
64
  <script>
61
65
  jQuery(function(){
@@ -1,7 +1,7 @@
1
1
  <div id="tab-email_settings" class="<%= "active" if "email" == params[:tab] %> tab-pane ">
2
2
  <div class="form-group">
3
3
  <%= label_tag t('camaleon_cms.admin.settings.email_from') %><br>
4
- <%= text_field :options, :email, :class => "form-control", value: @site.get_option("email"), placeholder: 'My Name <my_email@gmyserver.com>' %>
4
+ <%= text_field :options, :email_from, :class => "form-control", value: @site.get_option("email_from"), placeholder: 'My Name <my_email@gmyserver.com>' %>
5
5
  </div>
6
6
  <div class="form-group">
7
7
  <%= label_tag t('camaleon_cms.admin.settings.email_cc') %><br>
@@ -9,8 +9,14 @@
9
9
  </div>
10
10
  <hr>
11
11
  <div class="alert alert-info">Gmail Need Permissions:
12
- <a href="http://know.mailsbestfriend.com/smtp_error_password_command_failed_5345714-1194946499.shtml" target="_blank">Check
13
- here.</a></div>
12
+ <div class="pull-left">
13
+ <a href="http://know.mailsbestfriend.com/smtp_error_password_command_failed_5345714-1194946499.shtml" target="_blank">Check
14
+ here.</a>
15
+ </div>
16
+ <div class="pull-right">
17
+ <a id="cama_email_send_test_email" class="btn btn-xs btn-primary" href="<%= url_for(action: :test_email) %>"><%= t('camaleon_cms.admin.settings.send_test_email', default: 'Send Test Email') %></a>
18
+ </div>
19
+ </div>
14
20
  <div class="form-group">
15
21
  <%= label_tag t('camaleon_cms.admin.settings.email_enabled') %><br>
16
22
  <%= check_box :options, :mailer_enabled, {checked: @site.get_option("mailer_enabled") == 1}, 1, 0 %>
@@ -33,4 +39,20 @@
33
39
  <%= text_field :options, :email_pass, :class => "form-control required", value: @site.get_option("email_pass"), placeholder: 'mypassword' %>
34
40
  </div>
35
41
  </div>
36
- </div>
42
+ </div>
43
+ <script>
44
+ jQuery(function(){ // test email configuration
45
+ $('#cama_email_send_test_email').click(function(){
46
+ var link = $(this);
47
+ var content = '<form><div><label for=""><%= t('camaleon_cms.admin.table.email', default: 'Email') %>: </label> <div class="input-group"><input class="form-control required email data-error-place-parent" name="email"><span class="input-group-btn"><button type="submit" class="btn btn-primary"><%= t('camaleon_cms.admin.settings.send_test_email') %></button></span></div></div></form>';
48
+ open_modal({title: link.text(), content: content, callback: function(modal){
49
+ var form = modal.find('form');
50
+ form.validate({submitHandler: function(){
51
+ showLoading();
52
+ $.get(link.attr('href'), form.serialize(), function(){ hideLoading(); }).complete(function(){ modal.modal('hide'); }).error(function(r){ $.fn.alert({title: r.responseText, type: 'error'}) });
53
+ }});
54
+ }});
55
+ return false;
56
+ });
57
+ });
58
+ </script>