camaleon_cms 2.3.3 → 2.3.4

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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -12
  3. data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +1 -2
  4. data/app/assets/javascripts/camaleon_cms/admin/_data.js +1 -0
  5. data/app/assets/javascripts/camaleon_cms/admin/_post.js +1 -1
  6. data/app/assets/javascripts/camaleon_cms/admin/_posttype.js.coffee +21 -0
  7. data/app/assets/javascripts/camaleon_cms/admin/admin-manifest.js +2 -0
  8. data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/fr.js +49 -0
  9. data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +11 -6
  10. data/app/controllers/camaleon_cms/admin/appearances/themes_controller.rb +6 -0
  11. data/app/controllers/camaleon_cms/admin/media_controller.rb +3 -0
  12. data/app/controllers/camaleon_cms/admin/users_controller.rb +3 -0
  13. data/app/controllers/camaleon_cms/camaleon_controller.rb +5 -0
  14. data/app/controllers/camaleon_cms/frontend_controller.rb +1 -1
  15. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +1 -1
  16. data/app/decorators/camaleon_cms/site_decorator.rb +1 -1
  17. data/app/decorators/camaleon_cms/user_decorator.rb +4 -0
  18. data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +4 -4
  19. data/app/helpers/camaleon_cms/camaleon_helper.rb +5 -0
  20. data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +16 -16
  21. data/app/helpers/camaleon_cms/hooks_helper.rb +10 -4
  22. data/app/helpers/camaleon_cms/plugins_helper.rb +1 -1
  23. data/app/helpers/camaleon_cms/session_helper.rb +9 -4
  24. data/app/helpers/camaleon_cms/short_code_helper.rb +1 -1
  25. data/app/helpers/camaleon_cms/theme_helper.rb +1 -1
  26. data/app/helpers/camaleon_cms/uploader_helper.rb +10 -7
  27. data/app/mailers/camaleon_cms/html_mailer.rb +33 -17
  28. data/app/models/camaleon_cms/ability.rb +2 -2
  29. data/app/models/camaleon_cms/nav_menu.rb +2 -2
  30. data/app/models/camaleon_cms/nav_menu_item.rb +5 -3
  31. data/app/models/camaleon_cms/site.rb +5 -101
  32. data/app/models/camaleon_cms/user.rb +8 -144
  33. data/app/models/camaleon_cms/user_relationship.rb +1 -1
  34. data/app/models/camaleon_cms/user_role.rb +0 -2
  35. data/app/models/concerns/camaleon_cms/custom_fields_read.rb +14 -7
  36. data/app/models/concerns/camaleon_cms/metas.rb +5 -4
  37. data/app/models/concerns/camaleon_cms/site_default_settings.rb +87 -0
  38. data/app/models/concerns/camaleon_cms/user_methods.rb +142 -0
  39. data/app/uploaders/camaleon_cms_aws_uploader.rb +13 -4
  40. data/app/uploaders/camaleon_cms_uploader.rb +3 -1
  41. data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_menus.html.erb +11 -5
  42. data/app/views/camaleon_cms/admin/appearances/nav_menus/_external_menu.html.erb +8 -0
  43. data/app/views/camaleon_cms/admin/settings/_media_settings.html.erb +4 -0
  44. data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +155 -154
  45. data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +1 -1
  46. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkbox.html.erb +1 -1
  47. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkboxes.html.erb +1 -1
  48. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +2 -5
  49. data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +1 -1
  50. data/app/views/camaleon_cms/admin/settings/post_types/_form.html.erb +24 -16
  51. data/app/views/camaleon_cms/admin/users/form.html.erb +2 -2
  52. data/app/views/camaleon_cms/default_theme/single.html.erb +1 -1
  53. data/app/views/layouts/camaleon_cms/admin.html.erb +2 -2
  54. data/config/initializers/model_alias.rb +10 -3
  55. data/config/locales/camaleon_cms/admin/en.yml +10 -0
  56. data/config/locales/camaleon_cms/admin/fr.yml +663 -0
  57. data/config/locales/camaleon_cms/common.yml +66 -0
  58. data/config/routes/frontend.rb +1 -1
  59. data/config/system.json +2 -2
  60. data/db/migrate/20150611161134_post_table_into_utf8.rb +6 -5
  61. data/lib/camaleon_cms/engine.rb +3 -0
  62. data/lib/camaleon_cms/version.rb +1 -1
  63. data/lib/ext/string.rb +1 -54
  64. data/lib/plugin_routes.rb +5 -0
  65. data/spec/decorators/post_type_spec.rb +13 -0
  66. data/spec/dummy/README.rdoc +28 -0
  67. data/spec/dummy/Rakefile +6 -0
  68. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  69. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  70. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  71. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  72. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  73. data/spec/dummy/bin/bundle +3 -0
  74. data/spec/dummy/bin/rails +4 -0
  75. data/spec/dummy/bin/rake +4 -0
  76. data/spec/dummy/bin/setup +29 -0
  77. data/spec/dummy/config.ru +4 -0
  78. data/spec/dummy/config/application.rb +26 -0
  79. data/spec/dummy/config/boot.rb +5 -0
  80. data/spec/dummy/config/database.yml +25 -0
  81. data/spec/dummy/config/environment.rb +5 -0
  82. data/spec/dummy/config/environments/development.rb +41 -0
  83. data/spec/dummy/config/environments/production.rb +79 -0
  84. data/spec/dummy/config/environments/test.rb +42 -0
  85. data/spec/dummy/config/initializers/assets.rb +11 -0
  86. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  87. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  88. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  89. data/spec/dummy/config/initializers/inflections.rb +16 -0
  90. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  91. data/spec/dummy/config/initializers/session_store.rb +3 -0
  92. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  93. data/spec/dummy/config/locales/en.yml +23 -0
  94. data/spec/dummy/config/routes.rb +4 -0
  95. data/spec/dummy/config/secrets.yml +22 -0
  96. data/spec/dummy/db/development.sqlite3 +0 -0
  97. data/spec/dummy/db/schema.rb +186 -0
  98. data/spec/dummy/public/404.html +67 -0
  99. data/spec/dummy/public/422.html +67 -0
  100. data/spec/dummy/public/500.html +66 -0
  101. data/spec/dummy/public/favicon.ico +0 -0
  102. data/spec/features/categories_spec.rb +25 -0
  103. data/spec/features/comments_spec.rb +45 -0
  104. data/spec/features/contact_form_spec.rb +53 -0
  105. data/spec/features/content_groups_spec.rb +45 -0
  106. data/spec/features/custom_fields_spec.rb +47 -0
  107. data/spec/features/frontend/pages_spec.rb +5 -0
  108. data/spec/features/languages_spec.rb +27 -0
  109. data/spec/features/media_spec.rb +50 -0
  110. data/spec/features/menus_spec.rb +46 -0
  111. data/spec/features/pages_spec.rb +30 -0
  112. data/spec/features/plugins_spec.rb +29 -0
  113. data/spec/features/posts_spec.rb +36 -0
  114. data/spec/features/session_spec.rb +52 -0
  115. data/spec/features/settings_spec.rb +17 -0
  116. data/spec/features/shortcodes_spec.rb +11 -0
  117. data/spec/features/sites_spec.rb +45 -0
  118. data/spec/features/tags_spec.rb +25 -0
  119. data/spec/features/themes_spec.rb +18 -0
  120. data/spec/features/user_roles_spec.rb +60 -0
  121. data/spec/features/users_spec.rb +79 -0
  122. data/spec/features/widgets_spec.rb +50 -0
  123. data/spec/helpers/email_helper_spec.rb +16 -0
  124. data/spec/mailers/send_mail_spec.rb +37 -0
  125. data/spec/rails_helper.rb +1 -0
  126. data/spec/routing/post_type_routes_spec.rb +12 -0
  127. data/spec/spec_helper.rb +191 -0
  128. data/spec/support/common.rb +113 -0
  129. data/spec/support/wait_for_ajax.rb +36 -0
  130. metadata +326 -3
@@ -5,174 +5,175 @@
5
5
  @index = "#{@item_id}_#{Time.now.to_i}_#{rand(999...99999)}"
6
6
  @field_config = cama_custom_field_elements[@key.to_sym]
7
7
  colors = ['primary','success','warning','colorful','info','danger']
8
+ unless @field_config.nil?
8
9
  %>
9
-
10
- <div id="panel-field<%= @index %>" class="panel panel-default panel-<%= colors.sample %> panel-item <%= 'panel-toggled' if @item_options_value[:panel_hidden].to_s.to_bool %>">
11
- <div class="panel-heading">
12
- <h3 class="panel-title"><span class="span-title"><%= @item_value[:name]? @item_value[:name] : "#{t('camaleon_cms.admin.settings.untitled')}
13
- #{@field_config[:label]}" %>
14
- </span> - <%= @field_config[:label] %>
15
- <%= t('camaleon_cms.admin.settings.field') %></h3>
16
- <ul class="panel-controls">
17
- <li><a class="panel-sortable" href="#" title="<%= t('camaleon_cms.admin.button.sortable')%>" data-toggle="tooltip" data-placement="left"><span class="fa fa-arrows"></span></a></li>
18
- <li><a class="panel-delete" href="#" title="<%= t('camaleon_cms.admin.button.delete')%>" data-toggle="tooltip" data-placement="left"><span class="fa fa-times text-danger"></span></a></li>
19
- <li><a class="panel-collapse" href="#"><span class="fa fa-angle-down"></span></a></li>
20
- </ul>
21
- </div>
22
- <div class="panel-body">
23
- <%= hidden_field(:fields, :id, index: @index, value: @item_id) %>
24
- <%= hidden_field(:field_options, :field_key, index: @index, value: @key) %>
25
- <%= hidden_field(:field_options, :label_eval, index: @index, value: @item_options_value[:label_eval].to_s.cama_true? ? 'true' : '') %>
26
- <%= hidden_field(:field_options, :panel_hidden, index: @index, value: @item_options_value[:panel_hidden], class: 'input-panel-hidden') %>
27
- <div class="form-group input-group-sm">
28
- <label for=""><%= t('camaleon_cms.admin.table.name') %></label><br>
29
- <%= text_field(:fields, :name, class: "form-control text-title", index: @index, value: @item_value[:name]? @item_value[:name] : "#{t('camaleon_cms.admin.settings.untitled')} #{@field_config[:label]}") %>
30
- </div>
31
- <div class="form-group input-group-sm">
32
- <label for=""><%= t('camaleon_cms.admin.table.slug') %></label><br>
33
- <%= text_field(:fields, :slug, class: "form-control text-slug", index: @index, value: @item_value[:slug]) %>
34
- </div>
35
- <div class="form-group">
36
- <label for=""><%= t('camaleon_cms.admin.table.description') %></label><br>
37
- <%= text_area(:fields, :description, class: "form-control", index: @index, value: @item_value[:description]) %>
38
- </div>
39
- <%
40
- html = ''
41
- if @field_config[:extra_fields].present?
42
- @field_config[:extra_fields].each do |input|
43
- type = input[:type]
44
- html += '<div class="form-group">'
45
- html += "<label>#{input[:label]}</label>" if input[:label].present?
46
- case type
47
- when 'select'
48
- html += "<div class='form-group'> <select id=\"field_options_#{@index}_#{input[:key]}\" name=\"field_options[#{@index}][#{input[:key]}]\" class='form-control'>"
49
- input[:values].each do |val|
50
- html += "<option value='#{val[:value]}' #{"selected" if @item_options_value.present? ? (val[:value] == @item_options_value[input[:key].to_sym]) : false}>#{val[:label]}</option>"
51
- end
52
- html += "</select> </div>"
53
- when 'radio'
54
- input[:values].each do |val|
55
- html += "<div class='radio'><label>#{radio_button(:field_options, input[:key],val[:value], index: @index, checked: @item_options_value.present? ? (val[:value] == @item_options_value[input[:key].to_sym]) : (val[:value] == '0')) } #{val[:label]}</label></div>"
56
- end
57
- when 'checkbox'
58
- input[:values].each do |val|
59
- html += "<div class='checkbox'><label><input type=\"checkbox\" id=\"field_options_#{@index}_#{input[:key]}\" name=\"field_options[#{@index}][#{input[:key]}][]\" #{"checked" if @item_options_value[input[:key].to_sym].to_s.include?(val[:value].to_s) rescue false} value=\"#{val[:value]}\"> #{val[:label]} </label></div>"
10
+ <div id="panel-field<%= @index %>" class="panel panel-default panel-<%= colors.sample %> panel-item <%= 'panel-toggled' if @item_options_value[:panel_hidden].to_s.to_bool %>">
11
+ <div class="panel-heading">
12
+ <h3 class="panel-title"><span class="span-title"><%= @item_value[:name]? @item_value[:name] : "#{t('camaleon_cms.admin.settings.untitled')}
13
+ #{@field_config[:label]}" %>
14
+ </span> - <%= @field_config[:label] %>
15
+ <%= t('camaleon_cms.admin.settings.field') %></h3>
16
+ <ul class="panel-controls">
17
+ <li><a class="panel-sortable" href="#" title="<%= t('camaleon_cms.admin.button.sortable')%>" data-toggle="tooltip" data-placement="left"><span class="fa fa-arrows"></span></a></li>
18
+ <li><a class="panel-delete" href="#" title="<%= t('camaleon_cms.admin.button.delete')%>" data-toggle="tooltip" data-placement="left"><span class="fa fa-times text-danger"></span></a></li>
19
+ <li><a class="panel-collapse" href="#"><span class="fa fa-angle-down"></span></a></li>
20
+ </ul>
21
+ </div>
22
+ <div class="panel-body">
23
+ <%= hidden_field(:fields, :id, index: @index, value: @item_id) %>
24
+ <%= hidden_field(:field_options, :field_key, index: @index, value: @key) %>
25
+ <%= hidden_field(:field_options, :label_eval, index: @index, value: @item_options_value[:label_eval].to_s.cama_true? ? 'true' : '') %>
26
+ <%= hidden_field(:field_options, :panel_hidden, index: @index, value: @item_options_value[:panel_hidden], class: 'input-panel-hidden') %>
27
+ <div class="form-group input-group-sm">
28
+ <label for=""><%= t('camaleon_cms.admin.table.name') %></label><br>
29
+ <%= text_field(:fields, :name, class: "form-control text-title", index: @index, value: @item_value[:name]? @item_value[:name] : "#{t('camaleon_cms.admin.settings.untitled')} #{@field_config[:label]}") %>
30
+ </div>
31
+ <div class="form-group input-group-sm">
32
+ <label for=""><%= t('camaleon_cms.admin.table.slug') %></label><br>
33
+ <%= text_field(:fields, :slug, class: "form-control text-slug", index: @index, value: @item_value[:slug]) %>
34
+ </div>
35
+ <div class="form-group">
36
+ <label for=""><%= t('camaleon_cms.admin.table.description') %></label><br>
37
+ <%= text_area(:fields, :description, class: "form-control", index: @index, value: @item_value[:description]) %>
38
+ </div>
39
+ <%
40
+ html = ''
41
+ if @field_config[:extra_fields].present?
42
+ @field_config[:extra_fields].each do |input|
43
+ type = input[:type]
44
+ html += '<div class="form-group">'
45
+ html += "<label>#{input[:label]}</label>" if input[:label].present?
46
+ case type
47
+ when 'select'
48
+ html += "<div class='form-group'> <select id=\"field_options_#{@index}_#{input[:key]}\" name=\"field_options[#{@index}][#{input[:key]}]\" class='form-control'>"
49
+ input[:values].each do |val|
50
+ html += "<option value='#{val[:value]}' #{"selected" if @item_options_value.present? ? (val[:value] == @item_options_value[input[:key].to_sym]) : false}>#{val[:label]}</option>"
51
+ end
52
+ html += "</select> </div>"
53
+ when 'radio'
54
+ input[:values].each do |val|
55
+ html += "<div class='radio'><label>#{radio_button(:field_options, input[:key],val[:value], index: @index, checked: @item_options_value.present? ? (val[:value] == @item_options_value[input[:key].to_sym]) : (val[:value] == '0')) } #{val[:label]}</label></div>"
56
+ end
57
+ when 'checkbox'
58
+ input[:values].each do |val|
59
+ html += "<div class='checkbox'><label><input type=\"checkbox\" id=\"field_options_#{@index}_#{input[:key]}\" name=\"field_options[#{@index}][#{input[:key]}][]\" #{"checked" if @item_options_value[input[:key].to_sym].to_s.include?(val[:value].to_s) rescue false} value=\"#{val[:value]}\"> #{val[:label]} </label></div>"
60
+ end
61
+ when 'text_area'
62
+ html += "#{text_area(:field_options, input[:key], index: @index , value: @item_options_value[input[:key].to_sym] || '', class: 'form-control') }"
63
+ else
64
+ html += "#{text_field(:field_options, input[:key], index: @index , value: @item_options_value[input[:key].to_sym] || '', class: 'form-control') }"
60
65
  end
61
- when 'text_area'
62
- html += "#{text_area(:field_options, input[:key], index: @index , value: @item_options_value[input[:key].to_sym] || '', class: 'form-control') }"
63
- else
64
- html += "#{text_field(:field_options, input[:key], index: @index , value: @item_options_value[input[:key].to_sym] || '', class: 'form-control') }"
66
+ html += "<small>#{input[:description]}</small>" if input[:description].present?
67
+ html += '</div>'
65
68
  end
66
- html += "<small>#{input[:description]}</small>" if input[:description].present?
67
- html += '</div>'
68
69
  end
69
- end
70
- %>
71
- <div>
72
- <%= raw html %>
73
- </div>
74
- <% if @field_config[:options][:multiple_options].present? %>
75
- <div class="form-group">
76
- <strong><%= @field_config[:options][:multiple_options][:label] %></strong>
77
- <div class="sortable-fields-options">
78
- <div id="clone<%= @index %>" class="hidden">
79
- <div class="actions">
80
- <i class="fa fa-arrows"></i> <i class="fa fa-times text-danger"></i>
81
- </div>
82
- <div class="inputs input-group input-group-sm">
83
- <input type="text" name="field_options[<%= @index %>][multiple_options][][title]" placeholder="Option title" class="form-control option-name" style="width: 160px;">
84
- <input type="text" name="field_options[<%= @index %>][multiple_options][][value]" placeholder="Value" class="form-control option-value" style="width: 120px;">
85
- <% if @field_config[:options][:multiple_options][:default].present? %>
86
- <div class="<%= @field_config[:options][:multiple_options][:default] %>" style="float: right; width: auto;">
87
- <label><input type="<%= @field_config[:options][:multiple_options][:default] %>" class="option-default" value="1" name="field_options[<%= @index %>][multiple_options][][default]"> <%= t('camaleon_cms.admin.table.default') %> </label>
88
- </div>
89
- <% end %>
90
- </div>
91
- </div>
70
+ %>
71
+ <div>
72
+ <%= raw html %>
73
+ </div>
74
+ <% if @field_config[:options][:multiple_options].present? %>
75
+ <div class="form-group">
76
+ <strong><%= @field_config[:options][:multiple_options][:label] %></strong>
77
+ <div class="sortable-fields-options">
78
+ <div id="clone<%= @index %>" class="hidden">
79
+ <div class="actions">
80
+ <i class="fa fa-arrows"></i> <i class="fa fa-times text-danger"></i>
81
+ </div>
82
+ <div class="inputs input-group input-group-sm">
83
+ <input type="text" name="field_options[<%= @index %>][multiple_options][][title]" placeholder="Option title" class="form-control option-name" style="width: 160px;">
84
+ <input type="text" name="field_options[<%= @index %>][multiple_options][][value]" placeholder="Value" class="form-control option-value" style="width: 120px;">
85
+ <% if @field_config[:options][:multiple_options][:default].present? %>
86
+ <div class="<%= @field_config[:options][:multiple_options][:default] %>" style="float: right; width: auto;">
87
+ <label><input type="<%= @field_config[:options][:multiple_options][:default] %>" class="option-default" value="1" name="field_options[<%= @index %>][multiple_options][][default]"> <%= t('camaleon_cms.admin.table.default') %> </label>
88
+ </div>
89
+ <% end %>
90
+ </div>
91
+ </div>
92
+
92
93
 
94
+ <ul id="sortable<%= @index %>" >
93
95
 
94
- <ul id="sortable<%= @index %>" >
96
+ </ul>
97
+ <% if @field_config[:options][:multiple_options][:use_not_default].present? %>
98
+ <div class="radio_none_option">
99
+ <label><input type="radio" class="option-default" value="none" name="field_options[<%= @index %>][multiple_options][][default]"> <%= t('camaleon_cms.admin.table.no_default') %> </label>
100
+ </div>
101
+ <% end %>
95
102
 
96
- </ul>
97
- <% if @field_config[:options][:multiple_options][:use_not_default].present? %>
98
- <div class="radio_none_option">
99
- <label><input type="radio" class="option-default" value="none" name="field_options[<%= @index %>][multiple_options][][default]"> <%= t('camaleon_cms.admin.table.no_default') %> </label>
103
+ <div style="margin-top: 4px">
104
+ <a id="add_btn<%= @index %>" href="#" class="btn btn-default btn-sm"> <i class="fa fa-plus"></i> <%= t('camaleon_cms.admin.button.add_option')%></a>
100
105
  </div>
101
- <% end %>
106
+ <script>
102
107
 
103
- <div style="margin-top: 4px">
104
- <a id="add_btn<%= @index %>" href="#" class="btn btn-default btn-sm"> <i class="fa fa-plus"></i> <%= t('camaleon_cms.admin.button.add_option')%></a>
105
- </div>
106
- <script>
108
+ var function_init_options<%= @index %> = function(){
109
+ var that = this;
110
+ var $panel = $( "#panel-field<%= @index %>" );
111
+ var $sortable = $( "#sortable<%= @index %>" );
112
+ var option_default_html = $('#clone<%= @index %>').html();
113
+ var option_default_values = <%= raw(@item_options_value[:multiple_options].present? ? @item_options_value[:multiple_options].to_json : '[]') %>
114
+ function add_option_default(values){
115
+ if(!values) values = {}
116
+ values = $.extend({title: I18n("msg.option_title"), value: '1',default: false},values)
117
+ var $option = $('<li>'+option_default_html+'</li>');
118
+ $option.find('.option-name').val(values.title);
119
+ $option.find('.option-value').val(values.value);
120
+ if(values.default && values.default != 'none') $option.find('.option-default').attr('checked','checked').prop('checked',true)
121
+ if(values.default && values.default == 'none') $panel.find('.radio_none_option input').attr('checked','checked').prop('checked',true)
107
122
 
108
- var function_init_options<%= @index %> = function(){
109
- var that = this;
110
- var $panel = $( "#panel-field<%= @index %>" );
111
- var $sortable = $( "#sortable<%= @index %>" );
112
- var option_default_html = $('#clone<%= @index %>').html();
113
- var option_default_values = <%= raw(@item_options_value[:multiple_options].present? ? @item_options_value[:multiple_options].to_json : '[]') %>
114
- function add_option_default(values){
115
- if(!values) values = {}
116
- values = $.extend({title: I18n("msg.option_title"), value: '1',default: false},values)
117
- var $option = $('<li>'+option_default_html+'</li>');
118
- $option.find('.option-name').val(values.title);
119
- $option.find('.option-value').val(values.value);
120
- if(values.default && values.default != 'none') $option.find('.option-default').attr('checked','checked').prop('checked',true)
121
- if(values.default && values.default == 'none') $panel.find('.radio_none_option input').attr('checked','checked').prop('checked',true)
123
+ $sortable.append($option)
124
+ };
122
125
 
123
- $sortable.append($option)
124
- };
126
+ if(option_default_values.length > 0){
127
+ $.each(option_default_values, function(i, value){
128
+ add_option_default(value);
129
+ })
130
+ }else{
131
+ add_option_default({default: true});
132
+ }
125
133
 
126
- if(option_default_values.length > 0){
127
- $.each(option_default_values, function(i, value){
128
- add_option_default(value);
134
+ $('#add_btn<%= @index %>').click(function(){
135
+ add_option_default({
136
+ value: $sortable.children('li').size() + 1
137
+ });
138
+ return false;
139
+ });
140
+ $sortable.sortable({
141
+ handle: ".fa-arrows"
142
+ });
143
+ $sortable.on('click','.fa-times', function(){
144
+ $(this).closest('li').remove()
145
+ return false;
129
146
  })
130
- }else{
131
- add_option_default({default: true});
147
+ $('#clone<%= @index %>').remove();
132
148
  }
133
-
134
- $('#add_btn<%= @index %>').click(function(){
135
- add_option_default({
136
- value: $sortable.children('li').size() + 1
137
- });
138
- return false;
139
- });
140
- $sortable.sortable({
141
- handle: ".fa-arrows"
142
- });
143
- $sortable.on('click','.fa-times', function(){
144
- $(this).closest('li').remove()
145
- return false;
146
- })
147
- $('#clone<%= @index %>').remove();
148
- }
149
- jQuery(function_init_options<%= @index %>);
150
- </script>
149
+ jQuery(function_init_options<%= @index %>);
150
+ </script>
151
+ </div>
151
152
  </div>
152
- </div>
153
- <% end %>
153
+ <% end %>
154
154
 
155
- <% if @field_config[:options].key?(:default_value) %>
156
- <div class="form-group input-group-sm">
157
- <label><%= t('camaleon_cms.admin.table.default_value')%></label>
158
- <%= text_field(:field_options, 'default_value', index: @index, value: @item_options_value[:default_value] || @field_config[:options][:default_value], class: 'form-control') %>
159
- </div>
160
- <% end %>
155
+ <% if @field_config[:options].key?(:default_value) %>
156
+ <div class="form-group input-group-sm">
157
+ <label><%= t('camaleon_cms.admin.table.default_value')%></label>
158
+ <%= text_field(:field_options, 'default_value', index: @index, value: @item_options_value[:default_value] || @field_config[:options][:default_value], class: 'form-control') %>
159
+ </div>
160
+ <% end %>
161
161
 
162
- <% if @field_config[:options][:multiple] || @field_config[:options][:required] || @field_config[:options][:translate] %>
163
- <strong><%= t('camaleon_cms.admin.table.options_field')%></strong>
164
- <% end %>
165
- <% if @field_config[:options][:multiple] %>
166
- <div class="checkbox"><label><%= check_box(:field_options, 'multiple', index: @index, checked: @item_options_value[:multiple].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.multiple_field_int') %> </label> <%= raw cama_html_tooltip(t('camaleon_cms.admin.table.multiple_field_int'),'right')%></div>
167
- <% end %>
168
- <% if @field_config[:options][:required] %>
169
- <div class="checkbox"><label><%= check_box(:field_options, 'required', index: @index, checked: @item_options_value[:required].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.required_field_int') %> </label> <%= raw cama_html_tooltip(t('camaleon_cms.admin.table.required_field_int'),'right')%></div>
170
- <% end %>
171
- <% if @field_config[:options][:translate] %>
172
- <div class="checkbox"><label><%= check_box(:field_options, 'translate', index: @index, checked: @item_options_value[:translate].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.translate_field_int') %> </label> <%= raw cama_html_tooltip(t('camaleon_cms.admin.table.translate_field_int'),'right')%></div>
173
- <% end %>
174
- <% if false && @field_config[:options][:show_frontend] %>
175
- <div class="checkbox"><label><%= check_box(:field_options, 'show_frontend', index: @index, checked: @item_options_value[:show_frontend].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.show_in_frontend') %> </label> <%= raw cama_html_tooltip( t('camaleon_cms.admin.table.show_in_frontend'),'right')%></div>
176
- <% end %>
177
- </div>
178
- </div>
162
+ <% if @field_config[:options][:multiple] || @field_config[:options][:required] || @field_config[:options][:translate] %>
163
+ <strong><%= t('camaleon_cms.admin.table.options_field')%></strong>
164
+ <% end %>
165
+ <% if @field_config[:options][:multiple] %>
166
+ <div class="checkbox"><label><%= check_box(:field_options, 'multiple', index: @index, checked: @item_options_value[:multiple].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.multiple_field_int') %> </label> <%= raw cama_html_tooltip(t('camaleon_cms.admin.table.multiple_field_int'),'right')%></div>
167
+ <% end %>
168
+ <% if @field_config[:options][:required] %>
169
+ <div class="checkbox"><label><%= check_box(:field_options, 'required', index: @index, checked: @item_options_value[:required].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.required_field_int') %> </label> <%= raw cama_html_tooltip(t('camaleon_cms.admin.table.required_field_int'),'right')%></div>
170
+ <% end %>
171
+ <% if @field_config[:options][:translate] %>
172
+ <div class="checkbox"><label><%= check_box(:field_options, 'translate', index: @index, checked: @item_options_value[:translate].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.translate_field_int') %> </label> <%= raw cama_html_tooltip(t('camaleon_cms.admin.table.translate_field_int'),'right')%></div>
173
+ <% end %>
174
+ <% if false && @field_config[:options][:show_frontend] %>
175
+ <div class="checkbox"><label><%= check_box(:field_options, 'show_frontend', index: @index, checked: @item_options_value[:show_frontend].to_s.to_bool) %> <%= t('camaleon_cms.admin.table.show_in_frontend') %> </label> <%= raw cama_html_tooltip( t('camaleon_cms.admin.table.show_in_frontend'),'right')%></div>
176
+ <% end %>
177
+ </div>
178
+ </div>
179
+ <% end %>
@@ -30,7 +30,7 @@
30
30
  <p><small><%= field.options[:label_eval].present? ? eval(field.description) : field.description %></small></p>
31
31
  <% end %>
32
32
  <div class="editor-custom-fields content-field-<%= field.id %>" data-add_field_title="<%= t('camaleon_cms.admin.button.add_new_field', default: 'Add new field')%>">
33
- <%= render(field.get_option('render') || cama_custom_field_elements[field.get_option('field_key').to_sym][:render] || "camaleon_cms/admin/settings/custom_fields/fields/#{field.options[:field_key]}", field: field, values: nil, is_disabled: is_disabled, default_use: default_use, field_name: field_name) %>
33
+ <%= render(field.get_option('render') || (cama_custom_field_elements[field.get_option('field_key').to_sym][:render] rescue nil) || "camaleon_cms/admin/settings/custom_fields/fields/#{field.options[:field_key]}", field: field, values: nil, is_disabled: is_disabled, default_use: default_use, field_name: field_name) %>
34
34
  </div>
35
35
  </div>
36
36
  <% end %>
@@ -1,3 +1,3 @@
1
1
  <div class="group-input-fields-content" data-callback-render="custom_field_checkbox_val">
2
- <div class="checkbox"><label><input type="checkbox" value="<%= field.options[:default_value] || 1 %>" name="<%= field_name %>[<%= field.slug %>][values][]" <%= 'checked' if false %> > <%= field.the_name %> </label></div>
2
+ <div class="checkbox"><label><input type="checkbox" value="1" name="<%= field_name %>[<%= field.slug %>][values][]"> <%= field.the_name %> </label></div>
3
3
  </div>
@@ -1,4 +1,4 @@
1
- <div class="group-input-fields-content" data-callback-render="custom_field_checkboxs_val">
1
+ <div class="group-input-fields-content cama_skip_cf_rename_multiple" data-callback-render="custom_field_checkboxs_val">
2
2
  <% field.options[:multiple_options].each do |option| %>
3
3
  <div class="checkbox"><label><input type="checkbox" value="<%= option[:value] %>" name="<%= field_name %>[<%= field.slug %>][values][]" <%= 'checked' if default_use && option[:default].present? %> > <%= option[:title] %></label></div>
4
4
  <% end %>
@@ -4,12 +4,9 @@
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
6
  <optgroup label="<%= pt.name %>">
7
- <%
8
- pt.posts.public_posts.each do |post|
9
- post = post.decorate
10
- %>
7
+ <% pt.posts.public_posts.each do |post| post = post.decorate %>
11
8
  <option value="<%= post.id %>"><%= post.the_title %></option>
12
- <% end %>
9
+ <% end %>
13
10
  </optgroup>
14
11
  <% end %>
15
12
  <% end %>
@@ -61,7 +61,7 @@
61
61
  <option value="<%= value %>" data-help="<%= t('camaleon_cms.admin.settings.tooltip.add_custom_field_users') %>"><%= t('camaleon_cms.admin.sidebar.users') %></option>
62
62
  <% value = "Site,#{current_site.id}" %>
63
63
  <option value="<%= value %>" data-help="<%= t('camaleon_cms.admin.settings.tooltip.add_custom_field_sites') %>"><%= t('camaleon_cms.admin.sidebar.site_settings') %></option>
64
- <% @_extra_models_for_fields.each do |model| %>
64
+ <% f_args={models: @_extra_models_for_fields || []}; hooks_run('custom_field_custom_models', f_args); f_args[:models].each do |model| %>
65
65
  <% value = "#{model.name},#{current_site.id}" %>
66
66
  <option value="<%= value %>" data-help=""><%= model.name %></option><%= model.name %>
67
67
  <% end %>
@@ -95,12 +95,6 @@
95
95
  <input name="meta[has_featured]" type="hidden" value="false"/>
96
96
  <label class="check0"><input name="meta[has_featured]" type="checkbox" class="icheckbox0" value="true" <%= 'checked' if @post_type.get_option('has_featured', false) %>/>&nbsp; <%= t('camaleon_cms.admin.table.permit_is_featured', default: 'Permit Featured Articles') %></label>
97
97
  </div>
98
- <div class="form-group">
99
- <input name="meta[has_picture]" type="hidden" value="false"/>
100
- <label class="check0"><input name="meta[has_picture]" type="checkbox" class="icheckbox0" value="true" <%= 'checked' if @post_type.get_option('has_picture', true) %>/>&nbsp; <%= t('camaleon_cms.admin.table.manage_picture') %>
101
- </label>
102
- <%= raw cama_html_tooltip("#{t('camaleon_cms.admin.post_type.tooltip.permission_add_image_presentation')}", 'right') %>
103
- </div>
104
98
  <div class="form-group">
105
99
  <input name="meta[has_keywords]" type="hidden" value="false"/>
106
100
  <label class="check0"><input name="meta[has_keywords]" type="checkbox" class="icheckbox0" value="true" <%= 'checked' if @post_type.get_option('has_keywords', true) %>/>&nbsp; <%= t('camaleon_cms.admin.table.manage_keywords') %></label>
@@ -111,6 +105,29 @@
111
105
  <label class="check0"><input name="meta[has_parent_structure]" type="checkbox" class="icheckbox0" value="true" <%= 'checked' if @post_type.manage_hierarchy? %>/>&nbsp; <%= t('camaleon_cms.admin.table.manage_parent_structure', default: 'Manage page hierarchy') %></label>
112
106
  <%= raw cama_html_tooltip("#{t('camaleon_cms.admin.post_type.tooltip.permission_to_support_parent_structure', default: "Permit to posts indicate the parent page")}", 'right') %>
113
107
  </div>
108
+ <div class="form-group">
109
+ <input name="meta[has_picture]" type="hidden" value="false"/>
110
+ <label class="check0"><input name="meta[has_picture]" type="checkbox" class="icheckbox0" value="true" <%= 'checked' if @post_type.get_option('has_picture', true) %>/>&nbsp; <%= t('camaleon_cms.admin.table.manage_picture') %>
111
+ </label>
112
+ <%= raw cama_html_tooltip("#{t('camaleon_cms.admin.post_type.tooltip.permission_add_image_presentation')}", 'right') %>
113
+ </div>
114
+ <div class="picture_settings" style="margin-left: 30px">
115
+ <div class="form-group">
116
+ <label><%= cama_t('camaleon_cms.admin.custom_field.fields.image_dimension') %></label>
117
+ <%= raw cama_html_tooltip("#{cama_t('camaleon_cms.admin.custom_field.fields.image_dimension_descr')}", 'right') %>
118
+ <%= text_field_tag 'meta[posts_image_dimension]', @post_type.get_option('posts_image_dimension'), class: 'form-control' %>
119
+ </div>
120
+ <div class="form-group">
121
+ <label><%= cama_t('camaleon_cms.admin.custom_field.fields.image_versions') %></label>
122
+ <%= raw cama_html_tooltip("#{cama_t('camaleon_cms.admin.custom_field.fields.image_versions_descr')}", 'right') %>
123
+ <%= text_field_tag 'meta[posts_thumb_versions]', @post_type.get_option('posts_thumb_versions'), class: 'form-control' %>
124
+ </div>
125
+ <div class="form-group">
126
+ <label><%= cama_t('camaleon_cms.admin.custom_field.fields.image_thumb') %></label>
127
+ <%= raw cama_html_tooltip("#{cama_t('camaleon_cms.admin.custom_field.fields.image_thumb_descr', d: current_site.get_option('filesystem_thumb_size', '100x100'))}", 'right') %>
128
+ <%= text_field_tag 'meta[posts_thumb_size]', @post_type.get_option('posts_thumb_size'), class: 'form-control' %>
129
+ </div>
130
+ </div>
114
131
  </div>
115
132
  <div role="tabpanel" class="tab-pane" id="post_type_setting_front">
116
133
  <div class="form-group">
@@ -141,15 +158,6 @@
141
158
  </div>
142
159
  <% end %>
143
160
  <script>
144
- jQuery(function($){
145
- var form = $("#post_type_form");
146
- form.find('.unput_upload').input_upload();
147
- form.find("[name='meta[has_parent_structure]']").change(function(){ // permit hierarchy route only for post types enabled "Manage page hierarchy"
148
- var item = form.find("#meta_contents_route_format_hierarchy_post");
149
- item.parent().siblings().find("input").prop("disabled", $(this).is(":checked"));
150
- if($(this).is(":checked")) item.prop("checked", true).prop("disabled", false);
151
- else item.prop("disabled", true)
152
- }).trigger("change");
153
- });
161
+ jQuery(function($){ cama_init_posttype_form(); });
154
162
  </script>
155
163
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  <div class="row">
15
15
  <%= form_for @user, as: "user", url:{action: @user.new_record? ? :create : :update, id: @user.id}, html:{class: 'validate-user form-horizontal cama_ajax_request', id: "user_form"} do |f| %>
16
- <div class="col-md-3 col-sm-4">
16
+ <div class="col-md-3">
17
17
  <div class="panel panel-default">
18
18
  <div class="panel-body">
19
19
  <%= render partial: 'layouts/camaleon_cms/admin/form_error', locals: {data: @user} %>
@@ -69,7 +69,7 @@
69
69
  </div>
70
70
  </div>
71
71
 
72
- <div class="col-md-6 col-sm-8">
72
+ <div class="col-md-6">
73
73
  <div class="panel panel-default">
74
74
  <div class="panel-body form-group-separated">
75
75
  <div class="form-group">