camaleon_cms 2.1.2.1 → 2.2.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.

Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -4
  3. data/app/apps/plugins/attack/attack_helper.rb +3 -0
  4. data/app/apps/plugins/attack/config/custom_models.rb +4 -2
  5. data/app/apps/plugins/attack/config/locales/translation.yml +19 -0
  6. data/app/apps/plugins/attack/models/attack.rb +1 -1
  7. data/app/apps/plugins/front_cache/config/initializer.rb +4 -2
  8. data/app/apps/plugins/front_cache/config/locales/translation.yml +19 -0
  9. data/app/apps/themes/camaleon_first/main_helper.rb +1 -3
  10. data/app/apps/themes/default/views/admin/settings.html.erb +0 -1
  11. data/app/apps/themes/default/views/layouts/index.html.erb +5 -5
  12. data/app/apps/themes/new/assets/css/main.css +1 -1
  13. data/app/apps/themes/new/assets/js/main.js +1 -1
  14. data/app/apps/themes/new/views/admin/settings.html.erb +1 -1
  15. data/app/assets/images/camaleon_cms/language/{pt_br.png → pt-BR.png} +0 -0
  16. data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +105 -51
  17. data/app/assets/javascripts/camaleon_cms/admin/_libraries.js +4 -2
  18. data/app/assets/javascripts/camaleon_cms/admin/_translator.js +2 -2
  19. data/app/assets/javascripts/camaleon_cms/admin/custom_fields_form.js +9 -7
  20. data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/{pt_br.js → pt-BR.js} +0 -0
  21. data/app/assets/javascripts/camaleon_cms/admin/momentjs/{pt_br.js → pt-BR.js} +1 -1
  22. data/app/assets/javascripts/camaleon_cms/admin/nav_menu.js.coffee +15 -1
  23. data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/{pt_br.js → pt-BR.js} +1 -1
  24. data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +24 -12
  25. data/app/assets/stylesheets/camaleon_cms/admin/_custom_admin.css.scss +9 -0
  26. data/app/assets/stylesheets/camaleon_cms/admin/lte/_admin.css.scss +1 -1
  27. data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +13 -6
  28. data/app/controllers/camaleon_cms/admin/appearances/themes_controller.rb +1 -1
  29. data/app/controllers/camaleon_cms/admin/appearances/widgets/assign_controller.rb +1 -1
  30. data/app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb +1 -1
  31. data/app/controllers/camaleon_cms/admin/appearances/widgets/sidebar_controller.rb +1 -1
  32. data/app/controllers/camaleon_cms/admin/comments_controller.rb +1 -1
  33. data/app/controllers/camaleon_cms/admin/media_controller.rb +15 -5
  34. data/app/controllers/camaleon_cms/admin/plugins_controller.rb +1 -1
  35. data/app/controllers/camaleon_cms/admin/settings/custom_fields_controller.rb +14 -8
  36. data/app/controllers/camaleon_cms/admin/settings_controller.rb +22 -7
  37. data/app/controllers/camaleon_cms/admin/user_roles_controller.rb +1 -1
  38. data/app/controllers/camaleon_cms/admin/users_controller.rb +1 -1
  39. data/app/controllers/camaleon_cms/apps/plugins_admin_controller.rb +4 -1
  40. data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +5 -10
  41. data/app/controllers/camaleon_cms/apps/themes_front_controller.rb +1 -4
  42. data/app/controllers/camaleon_cms/camaleon_controller.rb +4 -13
  43. data/app/controllers/camaleon_cms/frontend_controller.rb +15 -9
  44. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +17 -8
  45. data/app/decorators/camaleon_cms/application_decorator.rb +3 -3
  46. data/app/decorators/camaleon_cms/custom_fields_concern.rb +21 -6
  47. data/app/decorators/camaleon_cms/post_comment_decorator.rb +21 -0
  48. data/app/decorators/camaleon_cms/site_decorator.rb +5 -5
  49. data/app/decorators/camaleon_cms/theme_decorator.rb +10 -0
  50. data/app/decorators/camaleon_cms/user_decorator.rb +2 -2
  51. data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +24 -2
  52. data/app/helpers/camaleon_cms/admin/menus_helper.rb +13 -12
  53. data/app/helpers/camaleon_cms/frontend/application_helper.rb +1 -1
  54. data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +7 -6
  55. data/app/helpers/camaleon_cms/plugins_helper.rb +20 -18
  56. data/app/helpers/camaleon_cms/site_helper.rb +1 -20
  57. data/app/helpers/camaleon_cms/theme_helper.rb +1 -1
  58. data/app/helpers/camaleon_cms/uploader_helper.rb +25 -20
  59. data/app/helpers/camaleon_cms/user_roles_helper.rb +6 -1
  60. data/app/mailers/camaleon_cms/html_mailer.rb +2 -1
  61. data/app/models/camaleon_cms/ability.rb +3 -26
  62. data/app/models/camaleon_cms/custom_field.rb +2 -1
  63. data/app/models/camaleon_cms/custom_field_group.rb +23 -22
  64. data/app/models/camaleon_cms/custom_fields_relationship.rb +1 -1
  65. data/app/models/camaleon_cms/nav_menu.rb +1 -1
  66. data/app/models/camaleon_cms/nav_menu_item.rb +12 -19
  67. data/app/models/camaleon_cms/post.rb +1 -1
  68. data/app/models/camaleon_cms/post_comment.rb +3 -1
  69. data/app/models/camaleon_cms/post_default.rb +1 -1
  70. data/app/models/camaleon_cms/post_type.rb +5 -4
  71. data/app/models/camaleon_cms/site.rb +12 -0
  72. data/app/models/camaleon_cms/term_taxonomy.rb +1 -1
  73. data/app/models/camaleon_cms/user_role.rb +5 -1
  74. data/app/models/concerns/camaleon_cms/custom_fields_read.rb +99 -49
  75. data/app/uploaders/camaleon_cms_aws_uploader.rb +1 -1
  76. data/app/uploaders/camaleon_cms_local_uploader.rb +19 -3
  77. data/app/uploaders/camaleon_cms_uploader.rb +13 -6
  78. data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_menus.html.erb +9 -2
  79. data/app/views/camaleon_cms/admin/appearances/nav_menus/_form.html.erb +1 -1
  80. data/app/views/camaleon_cms/admin/appearances/nav_menus/_menu_items.html.erb +2 -2
  81. data/app/views/camaleon_cms/admin/appearances/themes/index.html.erb +1 -3
  82. data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +1 -0
  83. data/app/views/camaleon_cms/admin/media/index.html.erb +3 -3
  84. data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +1 -1
  85. data/app/views/camaleon_cms/admin/posts/form.html.erb +1 -1
  86. data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +4 -0
  87. data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +6 -6
  88. data/app/views/camaleon_cms/admin/settings/custom_fields/_meta_data.html.erb +0 -9
  89. data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +39 -55
  90. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_audio.html.erb +1 -1
  91. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkbox.html.erb +2 -2
  92. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkboxes.html.erb +3 -3
  93. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_colorpicker.html.erb +3 -3
  94. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_date.html.erb +3 -3
  95. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_editor.html.erb +2 -2
  96. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_email.html.erb +1 -1
  97. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_field_attrs.html.erb +3 -3
  98. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_file.html.erb +1 -1
  99. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_image.html.erb +2 -2
  100. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_numeric.html.erb +1 -1
  101. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_phone.html.erb +1 -1
  102. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +3 -3
  103. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_private_file.html.erb +4 -0
  104. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_radio.html.erb +3 -3
  105. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select.html.erb +3 -3
  106. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select_eval.html.erb +1 -1
  107. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_area.html.erb +2 -2
  108. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_box.html.erb +2 -2
  109. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_url.html.erb +1 -1
  110. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_users.html.erb +1 -1
  111. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_video.html.erb +1 -1
  112. data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +8 -0
  113. data/app/views/camaleon_cms/admin/settings/site.html.erb +1 -20
  114. data/app/views/camaleon_cms/admin/settings/theme.html.erb +20 -0
  115. data/app/views/camaleon_cms/admin/user_roles/form.html.erb +2 -2
  116. data/app/views/camaleon_cms/default_theme/admin/settings.html.erb +0 -1
  117. data/app/views/camaleon_cms/default_theme/partials/_comments.html.erb +0 -2
  118. data/app/views/camaleon_cms/default_theme/partials/_search_form.html.erb +1 -1
  119. data/app/views/camaleon_cms/default_theme/partials/_sidebar.html.erb +3 -3
  120. data/app/views/layouts/camaleon_cms/admin/_footer.html.erb +1 -1
  121. data/config/initializers/action_view.rb +12 -7
  122. data/config/initializers/custom_initializers.rb +6 -12
  123. data/config/locales/camaleon_cms/admin/en.yml +1 -0
  124. data/config/locales/camaleon_cms/admin/es.yml +4 -0
  125. data/config/locales/camaleon_cms/admin/it.yml +1 -24
  126. data/config/locales/camaleon_cms/admin/js.yml +41 -0
  127. data/config/locales/camaleon_cms/admin/{pt_br.yml → pt-BR.yml} +48 -18
  128. data/config/locales/camaleon_cms/common.yml +66 -0
  129. data/config/locales/camaleon_cms/languages.yml +13 -0
  130. data/config/locales/camaleon_cms/routes.yml +2 -2
  131. data/config/routes/admin.rb +3 -0
  132. data/config/system.json +3 -3
  133. data/db/migrate/20160606135421_improve_menus_structure.rb +7 -0
  134. data/db/migrate/20160609121449_add_group_to_custom_field_values.rb +5 -0
  135. data/lib/camaleon_cms/engine.rb +4 -3
  136. data/lib/camaleon_cms/version.rb +1 -1
  137. data/lib/ext/string.rb +20 -0
  138. data/lib/ext/translator.rb +2 -2
  139. data/lib/generators/camaleon_cms/gem_plugin_generator.rb +1 -1
  140. data/lib/generators/camaleon_cms/gem_plugin_template/config/camaleon_plugin.json +1 -1
  141. data/lib/generators/camaleon_cms/install_generator.rb +1 -0
  142. data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb +1 -4
  143. data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/index.html.erb +1 -25
  144. data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +17 -18
  145. data/lib/plugin_routes.rb +4 -4
  146. metadata +25 -48
  147. data/app/apps/plugins/contact_form/admin_forms_controller.rb +0 -85
  148. data/app/apps/plugins/contact_form/assets/css/admin/form-builder/formbuilder.css +0 -70
  149. data/app/apps/plugins/contact_form/assets/css/contact-form.css +0 -8
  150. data/app/apps/plugins/contact_form/assets/css/front/railsform.scss +0 -94
  151. data/app/apps/plugins/contact_form/assets/css/readme.txt +0 -1
  152. data/app/apps/plugins/contact_form/assets/js/contact_form.js +0 -2
  153. data/app/apps/plugins/contact_form/assets/js/form-builder/formbuilder.js +0 -1271
  154. data/app/apps/plugins/contact_form/assets/js/form-builder/vendor.js +0 -3072
  155. data/app/apps/plugins/contact_form/assets/js/readme.txt +0 -1
  156. data/app/apps/plugins/contact_form/config/config.json +0 -35
  157. data/app/apps/plugins/contact_form/config/custom_models.rb +0 -3
  158. data/app/apps/plugins/contact_form/config/locales/readme.txt +0 -1
  159. data/app/apps/plugins/contact_form/config/locales/translation.yml +0 -315
  160. data/app/apps/plugins/contact_form/config/routes_admin.txt +0 -4
  161. data/app/apps/plugins/contact_form/config/routes_front.txt +0 -2
  162. data/app/apps/plugins/contact_form/contact_form_helper.rb +0 -154
  163. data/app/apps/plugins/contact_form/contact_form_html_helper.rb +0 -140
  164. data/app/apps/plugins/contact_form/front_controller.rb +0 -50
  165. data/app/apps/plugins/contact_form/models/contact_form.rb +0 -26
  166. data/app/apps/plugins/contact_form/views/admin_forms/_form.html.erb +0 -33
  167. data/app/apps/plugins/contact_form/views/admin_forms/edit.html.erb +0 -338
  168. data/app/apps/plugins/contact_form/views/admin_forms/index.html.erb +0 -65
  169. data/app/apps/plugins/contact_form/views/admin_forms/responses.html.erb +0 -60
  170. data/app/apps/plugins/contact_form/views/contact_form/_email_content.html.erb +0 -26
  171. data/app/apps/plugins/contact_form/views/forms_shorcode.html.erb +0 -28
  172. data/app/apps/plugins/contact_form/views/front/index.html.erb +0 -3
  173. data/app/apps/themes/camaleon_first/views/admin/settings.html.erb +0 -4
  174. data/app/apps/themes/new/assets/css/bootstrap/bootstrap.min.css +0 -6735
  175. data/app/apps/themes/new/assets/js/plugins/bootstrap/bootstrap.min.js +0 -6
  176. data/app/apps/themes/new/assets/js/plugins/jquery/jquery.min.js +0 -4
  177. data/lib/generators/camaleon_cms/gem_theme_generator.rb +0 -97
  178. data/lib/generators/camaleon_cms/gem_theme_template/app/assets/images/themes/my_plugin/image.png +0 -0
  179. data/lib/generators/camaleon_cms/gem_theme_template/app/assets/javascripts/themes/my_plugin/main.js +0 -14
  180. data/lib/generators/camaleon_cms/gem_theme_template/app/assets/stylesheets/themes/my_plugin/main.css +0 -13
  181. data/lib/generators/camaleon_cms/gem_theme_template/app/helpers/themes/my_plugin/main_helper.rb +0 -26
  182. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/admin/settings.html.erb +0 -4
  183. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/index.html.erb +0 -25
  184. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/layouts/index.html.erb +0 -70
  185. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/partials/readme.txt +0 -1
  186. data/lib/generators/camaleon_cms/gem_theme_template/config/camaleon_theme.json +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4b91e4d676cfa8c8e63bbbdc8babcac88ebcba4
4
- data.tar.gz: 5f4faf55c0c1328f0b30142dae585924641e91d7
3
+ metadata.gz: 7a8d04f6b677b60b055717333082cc33f4a5eb23
4
+ data.tar.gz: cb1b1292033c55314017d3feefd1f35d4f73a779
5
5
  SHA512:
6
- metadata.gz: 2d1337afdf804b923538aa6edad015c4b427d4d5581513476ecf0144ba12a61f1b47781cbbcd956941d0c340a94bfed281569620a7b523c121e7d680299fa4fe
7
- data.tar.gz: fcbdf1271ad46b913a7d2c773004a09f2962aadaf15ad34871a10197783e29651a2684ec3dcfbf20904ece1864d21e9a1b2f46b7a2decb1e7cd60cc9bcea2219
6
+ metadata.gz: cadc1f31405e3cc1fe1aa0ccd6263a0dc0a812a476cb47f7889c86baa081f6f740e27eead856a059e305b988ca47b38dff9c3d3286c8766acacac64229896978
7
+ data.tar.gz: 5a7a78728a449ce23abf975786a1d2797747bbd2c5998f741c40afa248c51552905e7ccaadd0781ab22c873dff947a5af97e8d00728e6fb6d3ce4fa16e306e64
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.1.2.0' # Stable versions 2.1.2.0,2.1.1.4, 2.1.1, 2.1.0
31
+ gem "camaleon_cms", '>=2.2.0' # 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
@@ -176,15 +176,18 @@ See more here: http://camaleon.tuzitio.com/version-history.html
176
176
  - Add this gem into your Gemfile
177
177
 
178
178
  ```
179
- gem 'rspec-rails'
180
- gem 'capybara'
179
+ group :development, :test do
180
+ gem 'rspec-rails', '~> 3.4'
181
+ gem 'capybara'
182
+ gem 'selenium-webdriver'
183
+ end
181
184
  ```
182
185
  - In your console
183
186
 
184
187
  ```
185
188
  rails generate rspec:install
186
189
  ```
187
- - Add this to spec/rails_helper.rb (Insert before line of "RSpec.configure do |config|")
190
+ - Add this to spec/rails_helper.rb (Insert before line of "RSpec.configure do |config|") and change use_transactional_fixtures into false
188
191
 
189
192
  ```
190
193
  Dir[File.join($camaleon_engine_dir, 'spec/support/**/*.rb')].each { |f| require f }
@@ -34,6 +34,9 @@ module Plugins::Attack::AttackHelper
34
34
  t.datetime "created_at"
35
35
  end
36
36
  end
37
+ CamaleonCms::Site.class_eval do
38
+ has_many :attack, class_name: "Plugins::Attack::Models::Attack"
39
+ end
37
40
  end
38
41
 
39
42
  # here all actions on going to inactive
@@ -1,4 +1,6 @@
1
1
  # custom class for site
2
- CamaleonCms::Site.class_eval do
3
- has_many :attack, class_name: "Plugins::Attack::Models::Attack"
2
+ Rails.application.config.to_prepare do
3
+ CamaleonCms::Site.class_eval do
4
+ has_many :attack, class_name: "Plugins::Attack::Models::Attack"
5
+ end
4
6
  end
@@ -16,6 +16,25 @@
16
16
  settings_saved: 'Settings saved!'
17
17
  settings: 'Settings'
18
18
 
19
+ pt-BR:
20
+ plugin:
21
+ attack:
22
+ title: 'Ataque'
23
+ attack_security: 'Segurança contra ataques'
24
+ form:
25
+ in: 'em'
26
+ seconds: 'Segundos'
27
+ minutes: 'Minutos'
28
+ type_max_requests_time: 'Requisições %{type} máximas'
29
+ type_time_requests_seconds: 'Requisições %{type} por tipo [segundos]'
30
+ ban_time_minutes: 'Tempo de expulsão'
31
+ ban_messages: 'Mensagem de expulsão'
32
+ request_limit_exceeded: 'Número de requisições excedeu o limite!'
33
+ messages:
34
+ settings_saved: 'Configurações salvas com sucesso!'
35
+ settings: 'Configurações'
36
+
37
+
19
38
 
20
39
  es:
21
40
  plugin:
@@ -9,4 +9,4 @@
9
9
  class Plugins::Attack::Models::Attack < ActiveRecord::Base
10
10
  attr_accessible :path, :browser_key
11
11
  belongs_to :site
12
- end
12
+ end
@@ -1,3 +1,5 @@
1
- CamaleonCms::Site.all.each do |site|
2
- site.set_option("refresh_cache", true)
1
+ if(CamaleonCms::Site.any? rescue false)
2
+ CamaleonCms::Site.all.each do |site|
3
+ site.set_option("refresh_cache", true)
4
+ end
3
5
  end
@@ -55,3 +55,22 @@ nl:
55
55
  settings_saved: 'instellingen opgeslagen!'
56
56
  cache_destroyed: 'Cache opgeschoond!'
57
57
  settings: 'instellingen'
58
+
59
+ pt-BR:
60
+ plugin:
61
+ front_cache:
62
+ button:
63
+ add_new_path: 'Adicionar novo caminho'
64
+ custom_url_paths: 'Caminhos de URL customizados'
65
+ clean_cache: 'Limpar Cache'
66
+ title: 'Cache de Páginas de Front End'
67
+ home_page: 'Página Inicial'
68
+ pages: 'Páginas'
69
+ pages_of: 'Páginas de'
70
+ skip_cache_pages: 'Pular Cache de Páginas'
71
+ message:
72
+ please_checkpost_need_cache: 'Por favor cheque todos os posts ou o tipo do post que você precisa cachear.'
73
+ enabled_cache_inner_content_logged_users: 'Permitir cache para conteúdo interno de usuários logados'
74
+ settings_saved: 'Configurações Salvas!'
75
+ cache_destroyed: 'Cache destruído!'
76
+ settings: 'Configurações'
@@ -12,9 +12,7 @@ module Themes::CamaleonFirst::MainHelper
12
12
  end
13
13
 
14
14
  def camaleon_first_settings(theme)
15
- # here your code on save settings for current site, by default params[:theme_fields] is auto saved into theme
16
- # Also, you can save your extra values added in admin/settings.html.erb
17
- # sample: theme.set_meta("my_key", params[:my_value])
15
+
18
16
  end
19
17
 
20
18
  # return a list of options for "Recent items from " on site settings -> theme settings
@@ -1 +0,0 @@
1
- <%= render partial: "camaleon_cms/admin/settings/custom_fields/render", locals: {record: current_theme, field_groups: current_theme.get_field_groups, fields_name: "theme_fields"} %>
@@ -33,9 +33,9 @@
33
33
  <li class="dropdown">
34
34
  <a class="dropdown-toggle" href="#"><img src="<%= cama_current_user.decorate.the_avatar %>" style="max-width: 24px; border-radius: 50%" alt=""/> <%= cama_current_user.username %></a>
35
35
  <ul class="dropdown-menu">
36
- <li><a href="<%= cama_admin_dashboard_path %>">Dashboard</a></li>
37
- <li><a href="<%= cama_admin_profile_path %>">Profile</a></li>
38
- <li><a href="<%= cama_admin_logout_path %>">Logout</a></li>
36
+ <li><a href="<%= cama_admin_dashboard_path %>"><%= I18n.t('camaleon_cms.common.dashboard') %></a></li>
37
+ <li><a href="<%= cama_admin_profile_path %>"><%= I18n.t('camaleon_cms.common.profile') %></a></li>
38
+ <li><a href="<%= cama_admin_logout_path %>"><%= I18n.t('camaleon_cms.common.logout') %></a></li>
39
39
  </ul>
40
40
  </li>
41
41
  <% else %>
@@ -43,8 +43,8 @@
43
43
  <li class="dropdown">
44
44
  <a id="login-user" class="dropdown-toggle" href="#">Login / Register</a>
45
45
  <ul class="dropdown-menu">
46
- <li><a href="<%= cama_admin_login_path %>">Login</a></li>
47
- <li><a href="<%= cama_admin_register_path %>">Register</a></li>
46
+ <li><a href="<%= cama_admin_login_path %>"><%= I18n.t('camaleon_cms.common.login') %></a></li>
47
+ <li><a href="<%= cama_admin_register_path %>"><%= I18n.t('camaleon_cms.common.register') %></a></li>
48
48
  </ul>
49
49
  </li>
50
50
  <% end %>
@@ -8,7 +8,7 @@
8
8
  * You're free to add application-wide styles to this file and they'll appear at the top of the
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
- *= require ./bootstrap/bootstrap.min.css
11
+ *= require camaleon_cms/bootstrap.min
12
12
  *= require font-awesome
13
13
  *= require ./styles
14
14
  */
@@ -11,4 +11,4 @@
11
11
  // about supported directives.
12
12
  //
13
13
  //= require jquery
14
- //= require ./plugins/bootstrap/bootstrap.min.js
14
+ //= require camaleon_cms/bootstrap.min
@@ -1 +1 @@
1
- <%= render partial: "camaleon_cms/admin/settings/custom_fields/render", locals: {record: current_theme, field_groups: current_theme.get_field_groups, fields_name: "theme_fields"} %>
1
+ <!--Here my custom settings for current theme-->
@@ -1,56 +1,101 @@
1
- function build_custom_field(values, multiple, field_key, rand, default_value) {
2
- var $content = $("#content-field-" + rand);
3
- var $sortable = $("#sortable-" + rand);
4
- var callback = $content.find('.clone-field .group-input-fields-content').attr('data-callback-function');
5
- var callback_set_value = $content.find('.clone-field .group-input-fields-content').attr('data-callback-set-value');
6
- var $field = $('<li>' + $content.find('.clone-field').html() + '</li>');
7
- var field_counter = 0;
8
-
9
- function add_field(value) {
10
- var field = $field.clone(true);
1
+ // build custom field groups with values recovered from DB received in field_values
2
+ function build_custom_field_group(field_values, group_id, fields_data, is_repeat){
3
+ if(field_values.length == 0) field_values = [{}];
4
+ var group_panel = $('#custom_field_group_'+group_id);
5
+ var group_panel_body = group_panel.find(' > .panel-body');
6
+ var group_clone = group_panel_body.children('.custom_sortable_grouped').clone().removeClass('hidden');
7
+ var field_group_counter = 0;
8
+ group_panel_body.children('.custom_sortable_grouped').remove();
11
9
 
12
- var input = field.find('.input-value');
13
- if(input.length > 0) input.attr('name', input.attr('name').replace('[]', '['+field_counter+']'))
14
- input = field.find('.input-attr');
15
- if(input.length > 0) input.attr('name', input.attr('name').replace('[]', '['+field_counter+']'))
10
+ function add_group(values){
11
+ var clone = group_clone.clone();
12
+ clone.find('input, textarea, select').not('.code_style').each(function(){ $(this).attr('name', $(this).attr('name').replace('field_options', 'field_options['+field_group_counter+']')) });
13
+ group_panel_body.append(clone);
14
+ group_panel.trigger('update_custom_group_number');
15
+ for(var k in fields_data){
16
+ cama_build_custom_field(clone.find('.content-field-'+fields_data[k].id), fields_data[k], values[k]);
17
+ }
18
+ if(field_group_counter == 0) clone.children('.header-field-grouped').find('.del').remove();
19
+ field_group_counter ++;
20
+ return false;
21
+ }
16
22
 
17
- if (value) field.find('.input-value').val(value);
18
- $sortable.append(field);
19
- if(callback) eval(callback + "(field, value);")
20
- if(callback_set_value) eval(callback_set_value + "(field, value);")
21
- field_counter ++;
23
+ if(is_repeat){
24
+ group_panel_body.sortable({ handle: ".move.fa-arrows", items: ' > .custom_sortable_grouped',
25
+ update: function(){ group_panel.trigger('update_custom_group_number'); },
26
+ start: function (e, ui) { // fix tinymce
27
+ $(ui.item).find('.mce-panel').each(function () {
28
+ tinymce.execCommand('mceRemoveEditor', false, $(this).next().addClass('cama_restore_editor').attr('id'));
29
+ });
30
+ },
31
+ stop: function (e, ui) { // fix tinymce
32
+ $(ui.item).find('.cama_restore_editor').each(function () {
33
+ tinymce.execCommand('mceAddEditor', true, $(this).attr('id'));
34
+ });
35
+ }});
36
+ group_panel.find('.btn.duplicate_cutom_group').click(add_group);
37
+ group_panel_body.on('click', '.header-field-grouped .del', function(){ if(confirm(I18n("msg.delete_item"))) $(this).closest('.custom_sortable_grouped').fadeOut('slow', function(){ $(this).remove(); group_panel.trigger('update_custom_group_number'); }); return false; });
38
+ group_panel_body.on('click', '.header-field-grouped .toggleable', function(){
39
+ if($(this).hasClass('fa-angle-down')) $(this).removeClass('fa-angle-down').addClass('fa-angle-up').closest('.header-field-grouped').next().slideUp();
40
+ else $(this).removeClass('fa-angle-up').addClass('fa-angle-down').closest('.header-field-grouped').next().slideDown();
41
+ return false;
42
+ });
43
+ group_panel.bind('update_custom_group_number', function(){ $(this).find('.custom_sortable_grouped').each(function(index){ $(this).find('input.cama_custom_group_number').val(index); }); });
44
+ $.each(field_values, function(field_val, key){ add_group(this); });
45
+ }else{
46
+ add_group(field_values[0]);
22
47
  }
48
+ }
23
49
 
24
- if (values.length > 0) {
25
- if (field_key == 'checkboxes') {
26
- add_field(values);
27
- } else {
28
- if (!multiple && values.length > 1) values = [values[0]];
29
- $.each(values, function (i, value) {
30
- add_field(value);
31
- });
50
+ function cama_build_custom_field(panel, field_data, values){
51
+ values = values || [];
52
+ var field_counter = 0;
53
+ var $field = panel.clone().wrap('li');
54
+ panel.html("<div class='cama_w_custom_fields'></div>"+(field_data.multiple ? "<div class='field_multiple_btn'> <a href='#' class='btn btn-warning btn-xs'> <i class='fa fa-plus'></i> "+panel.attr('data-add_field_title')+"</a></div>" : ''));
55
+ var field_actions = '<div class="actions"><i style="cursor: move" class="fa fa-arrows"></i> <i style="cursor: pointer" class="fa fa-times text-danger"></i></div>';
56
+ var callback = $field.find('.group-input-fields-content').attr('data-callback-render');
57
+ var $sortable = panel.children('.cama_w_custom_fields');
58
+ function add_field(value){
59
+ var field = $field.clone(true);
60
+ if(field_data.multiple) {
61
+ field.prepend(field_actions);
62
+ if(field_counter == 0) field.children('.actions').find('.fa-times').remove();
63
+ }
64
+ field.find('input, textarea, select').each(function(){ $(this).attr('name', $(this).attr('name').replace('[]', '['+field_counter+']')) });
65
+ if(field_data.disabled){
66
+ field.find('input, textarea, select').prop('readonly', true).filter('select').click(function(){ return false; }).focus(function(){ $(this).blur(); });
67
+ field.find('.btn').addClass('disabled').unbind().click(function(){ return false; });
32
68
  }
33
- } else add_field(default_value);
34
69
 
35
- if (multiple) {
36
- $content.find('.btn-add-field').click(function () {
37
- add_field(default_value);
38
- return false;
70
+ if(value) field.find('.input-value').val(value);
71
+ $sortable.append(field);
72
+ if(callback) eval(callback + "(field, value);");
73
+ field_counter ++;
74
+ }
75
+ if(values.length <= 0) values = [field_data.default_value];
76
+ if(field_data.kind != 'checkboxes') {
77
+ if (!field_data.multiple && values.length > 1) values = [values[0]];
78
+ $.each(values, function (i, value) {
79
+ add_field(value);
39
80
  });
40
- $sortable.delegate('.actions .fa-times', "click", function () {
41
- var parent = $(this).parents('li');
42
- if (confirm(I18n("msg.delete_item"))) {
43
- parent.remove();
81
+ } else add_field(values);
82
+
83
+ if(field_data.multiple){ // sortable actions
84
+ panel.find('.field_multiple_btn .btn').click(function () { add_field(field_data.default_value); return false; });
85
+ panel.delegate('.actions .fa-times', "click", function () { if(confirm(I18n("msg.delete_item"))) $(this).closest('.editor-custom-fields').remove(); return false; });
86
+ $sortable.sortable({ handle: ".fa-arrows", items: ' > .editor-custom-fields',
87
+ start: function (e, ui) { // fix tinymce
88
+ $(ui.item).find('.mce-panel').each(function () {
89
+ tinymce.execCommand('mceRemoveEditor', false, $(this).next().addClass('cama_restore_editor').attr('id'));
90
+ });
91
+ },
92
+ stop: function (e, ui) { // fix tinymce
93
+ $(ui.item).find('.cama_restore_editor').each(function () {
94
+ tinymce.execCommand('mceAddEditor', true, $(this).attr('id'));
95
+ });
44
96
  }
45
- return false;
46
- });
47
- $sortable.find('li:first .fa-times').hide();
48
- $sortable.sortable({
49
- handle: ".fa-arrows"
50
97
  });
51
98
  }
52
-
53
- $content.find('.clone-field').remove();
54
99
  }
55
100
 
56
101
  function custom_field_colorpicker($field) {
@@ -140,8 +185,8 @@ function custom_field_text_box($field) {
140
185
  }
141
186
  }
142
187
 
143
- function load_upload_audio_field(dom) {
144
- var $input = $(dom).parents('li:first').find('input');
188
+ function load_upload_audio_field(thiss) {
189
+ var $input = $(thiss).prev();
145
190
  $.fn.upload_filemanager({
146
191
  formats: "audio",
147
192
  selected: function (file, response) {
@@ -149,8 +194,8 @@ function load_upload_audio_field(dom) {
149
194
  }
150
195
  });
151
196
  }
152
- function load_upload_file_field(dom) {
153
- var $input = $(dom).parents('li:first').find('input');
197
+ function load_upload_file_field(thiss) {
198
+ var $input = $(thiss).prev();
154
199
  $.fn.upload_filemanager({
155
200
  formats: $input.data("formats") ? $input.data("formats") : "",
156
201
  selected: function (file, response) {
@@ -158,8 +203,17 @@ function load_upload_file_field(dom) {
158
203
  }
159
204
  });
160
205
  }
161
- function load_upload_image_field(dom) {
162
- var $input = $(dom).parents('li:first').find('input');
206
+ function load_upload_private_file_field(thiss) {
207
+ var $input = $(thiss).prev();
208
+ $.fn.upload_filemanager({
209
+ formats: $input.data("formats") ? $input.data("formats") : "",
210
+ selected: function (file, response) {
211
+ $input.val(file.url.split('?file=')[1].replace(/%2/g, '/'));
212
+ },
213
+ private: true
214
+ });
215
+ }
216
+ function load_upload_image_field($input) {
163
217
  $.fn.upload_filemanager({
164
218
  formats: "image",
165
219
  dimension: $input.attr("data-dimension"),
@@ -170,8 +224,8 @@ function load_upload_image_field(dom) {
170
224
  }
171
225
  });
172
226
  }
173
- function load_upload_video_field(dom) {
174
- var $input = $(dom).parents('li:first').find('input');
227
+ function load_upload_video_field(thiss) {
228
+ var $input = $(thiss).prev();
175
229
  $.fn.upload_filemanager({
176
230
  formats: "video",
177
231
  selected: function (file, response) {
@@ -19,7 +19,9 @@ jQuery(function(){
19
19
  /****************** form validations ************/
20
20
  // panel can be a object: $("#my_form")
21
21
  // if panel is null, then this will be replaced by body
22
- var init_form_validations = function (form) {
22
+ // args: {validate_settings}
23
+ var init_form_validations = function (form, args) {
24
+ args = args || {};
23
25
  // slug management
24
26
  // you need to add class no_translate to avoid translations in slugs
25
27
  (form ? form : $('#admin_content')).find('input.slug').each(function () {
@@ -54,7 +56,7 @@ var init_form_validations = function (form) {
54
56
  $form.find('.translatable').Translatable();
55
57
  }
56
58
  }).filter(".validate").each(function () {
57
- $(this).validate()
59
+ $(this).validate(args['validate_settings'])
58
60
  });
59
61
  };
60
62
 
@@ -38,7 +38,7 @@ jQuery(function($){
38
38
  var splitted = text.split('<!--:-->');
39
39
  for(var i in splitted){
40
40
  var str = splitted[i];
41
- var m_atch = str.trim().match(/^<!--:([\w]{2,5})/);
41
+ var m_atch = str.trim().match(/^<!--:([\w||-]{2,5})/);
42
42
  if(m_atch && m_atch.length == 2){
43
43
  m_atch[1] = m_atch[1].replace("--", "")
44
44
  translations_per_locale[m_atch[1]] = str.replace("<!--:"+m_atch[1]+"-->", "")
@@ -110,4 +110,4 @@ jQuery(function($){
110
110
  });
111
111
  return this;
112
112
  }
113
- });
113
+ });
@@ -6,7 +6,7 @@ jQuery(function($){
6
6
  $content_fields.sortable({
7
7
  handle: ".panel-sortable"
8
8
  });
9
- //$content_fields.disableSelection();
9
+ var slugger_count = $content_fields.children().length;
10
10
  cama_custom_field_set_slug();
11
11
 
12
12
  $("#content-items-default > a", panel).click(function(){
@@ -14,10 +14,12 @@ jQuery(function($){
14
14
  showLoading();
15
15
  $.post(href, function(html){
16
16
  hideLoading();
17
- var li = '<li class="item">' + html + '</li>';
18
- $content_fields.append(li)
19
- cama_custom_field_set_slug();
20
- $content_fields.find("input.text-title").trigger("keyup");
17
+ var li = $('<li class="item">' + html + '</li>');
18
+ $content_fields.append(li);
19
+ cama_custom_field_set_slug(li);
20
+ var title_field = li.find("input.text-title");
21
+ title_field.val(title_field.val() + '-' + (slugger_count ++));
22
+ title_field.trigger("keyup");
21
23
  $('[data-toggle="tooltip"], a[title!=""]', $content_fields).tooltip();
22
24
  });
23
25
  return false;
@@ -52,8 +54,8 @@ jQuery(function($){
52
54
  $('#select_assign_group_caption', panel).val(option.parent('optgroup').attr("label") + ': ' + option.text());
53
55
  }).val(group_class_name).trigger('change');
54
56
 
55
- function cama_custom_field_set_slug(){
56
- $('.text-slug:not(.runned)', panel).each(function(){
57
+ function cama_custom_field_set_slug(_panel){
58
+ $('.text-slug:not(.runned)', _panel || panel).each(function(){
57
59
  var $parent = $(this).parents('.panel-item');
58
60
  var $label = $parent.find('.span-title');
59
61
  $(this).slugify($parent.find('.text-title'), {