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.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/app/apps/plugins/attack/attack_helper.rb +3 -0
- data/app/apps/plugins/attack/config/custom_models.rb +4 -2
- data/app/apps/plugins/attack/config/locales/translation.yml +19 -0
- data/app/apps/plugins/attack/models/attack.rb +1 -1
- data/app/apps/plugins/front_cache/config/initializer.rb +4 -2
- data/app/apps/plugins/front_cache/config/locales/translation.yml +19 -0
- data/app/apps/themes/camaleon_first/main_helper.rb +1 -3
- data/app/apps/themes/default/views/admin/settings.html.erb +0 -1
- data/app/apps/themes/default/views/layouts/index.html.erb +5 -5
- data/app/apps/themes/new/assets/css/main.css +1 -1
- data/app/apps/themes/new/assets/js/main.js +1 -1
- data/app/apps/themes/new/views/admin/settings.html.erb +1 -1
- data/app/assets/images/camaleon_cms/language/{pt_br.png → pt-BR.png} +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +105 -51
- data/app/assets/javascripts/camaleon_cms/admin/_libraries.js +4 -2
- data/app/assets/javascripts/camaleon_cms/admin/_translator.js +2 -2
- data/app/assets/javascripts/camaleon_cms/admin/custom_fields_form.js +9 -7
- data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/{pt_br.js → pt-BR.js} +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/{pt_br.js → pt-BR.js} +1 -1
- data/app/assets/javascripts/camaleon_cms/admin/nav_menu.js.coffee +15 -1
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/{pt_br.js → pt-BR.js} +1 -1
- data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +24 -12
- data/app/assets/stylesheets/camaleon_cms/admin/_custom_admin.css.scss +9 -0
- data/app/assets/stylesheets/camaleon_cms/admin/lte/_admin.css.scss +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +13 -6
- data/app/controllers/camaleon_cms/admin/appearances/themes_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/widgets/assign_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/appearances/widgets/sidebar_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/comments_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/media_controller.rb +15 -5
- data/app/controllers/camaleon_cms/admin/plugins_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/settings/custom_fields_controller.rb +14 -8
- data/app/controllers/camaleon_cms/admin/settings_controller.rb +22 -7
- data/app/controllers/camaleon_cms/admin/user_roles_controller.rb +1 -1
- data/app/controllers/camaleon_cms/admin/users_controller.rb +1 -1
- data/app/controllers/camaleon_cms/apps/plugins_admin_controller.rb +4 -1
- data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +5 -10
- data/app/controllers/camaleon_cms/apps/themes_front_controller.rb +1 -4
- data/app/controllers/camaleon_cms/camaleon_controller.rb +4 -13
- data/app/controllers/camaleon_cms/frontend_controller.rb +15 -9
- data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +17 -8
- data/app/decorators/camaleon_cms/application_decorator.rb +3 -3
- data/app/decorators/camaleon_cms/custom_fields_concern.rb +21 -6
- data/app/decorators/camaleon_cms/post_comment_decorator.rb +21 -0
- data/app/decorators/camaleon_cms/site_decorator.rb +5 -5
- data/app/decorators/camaleon_cms/theme_decorator.rb +10 -0
- data/app/decorators/camaleon_cms/user_decorator.rb +2 -2
- data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +24 -2
- data/app/helpers/camaleon_cms/admin/menus_helper.rb +13 -12
- data/app/helpers/camaleon_cms/frontend/application_helper.rb +1 -1
- data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +7 -6
- data/app/helpers/camaleon_cms/plugins_helper.rb +20 -18
- data/app/helpers/camaleon_cms/site_helper.rb +1 -20
- data/app/helpers/camaleon_cms/theme_helper.rb +1 -1
- data/app/helpers/camaleon_cms/uploader_helper.rb +25 -20
- data/app/helpers/camaleon_cms/user_roles_helper.rb +6 -1
- data/app/mailers/camaleon_cms/html_mailer.rb +2 -1
- data/app/models/camaleon_cms/ability.rb +3 -26
- data/app/models/camaleon_cms/custom_field.rb +2 -1
- data/app/models/camaleon_cms/custom_field_group.rb +23 -22
- data/app/models/camaleon_cms/custom_fields_relationship.rb +1 -1
- data/app/models/camaleon_cms/nav_menu.rb +1 -1
- data/app/models/camaleon_cms/nav_menu_item.rb +12 -19
- data/app/models/camaleon_cms/post.rb +1 -1
- data/app/models/camaleon_cms/post_comment.rb +3 -1
- data/app/models/camaleon_cms/post_default.rb +1 -1
- data/app/models/camaleon_cms/post_type.rb +5 -4
- data/app/models/camaleon_cms/site.rb +12 -0
- data/app/models/camaleon_cms/term_taxonomy.rb +1 -1
- data/app/models/camaleon_cms/user_role.rb +5 -1
- data/app/models/concerns/camaleon_cms/custom_fields_read.rb +99 -49
- data/app/uploaders/camaleon_cms_aws_uploader.rb +1 -1
- data/app/uploaders/camaleon_cms_local_uploader.rb +19 -3
- data/app/uploaders/camaleon_cms_uploader.rb +13 -6
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_menus.html.erb +9 -2
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_form.html.erb +1 -1
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_menu_items.html.erb +2 -2
- data/app/views/camaleon_cms/admin/appearances/themes/index.html.erb +1 -3
- data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +1 -0
- data/app/views/camaleon_cms/admin/media/index.html.erb +3 -3
- data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +1 -1
- data/app/views/camaleon_cms/admin/posts/form.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +4 -0
- data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +6 -6
- data/app/views/camaleon_cms/admin/settings/custom_fields/_meta_data.html.erb +0 -9
- data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +39 -55
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_audio.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkbox.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkboxes.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_colorpicker.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_date.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_editor.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_email.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_field_attrs.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_file.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_image.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_numeric.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_phone.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_private_file.html.erb +4 -0
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_radio.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select.html.erb +3 -3
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select_eval.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_area.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_box.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_url.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_users.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_video.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +8 -0
- data/app/views/camaleon_cms/admin/settings/site.html.erb +1 -20
- data/app/views/camaleon_cms/admin/settings/theme.html.erb +20 -0
- data/app/views/camaleon_cms/admin/user_roles/form.html.erb +2 -2
- data/app/views/camaleon_cms/default_theme/admin/settings.html.erb +0 -1
- data/app/views/camaleon_cms/default_theme/partials/_comments.html.erb +0 -2
- data/app/views/camaleon_cms/default_theme/partials/_search_form.html.erb +1 -1
- data/app/views/camaleon_cms/default_theme/partials/_sidebar.html.erb +3 -3
- data/app/views/layouts/camaleon_cms/admin/_footer.html.erb +1 -1
- data/config/initializers/action_view.rb +12 -7
- data/config/initializers/custom_initializers.rb +6 -12
- data/config/locales/camaleon_cms/admin/en.yml +1 -0
- data/config/locales/camaleon_cms/admin/es.yml +4 -0
- data/config/locales/camaleon_cms/admin/it.yml +1 -24
- data/config/locales/camaleon_cms/admin/js.yml +41 -0
- data/config/locales/camaleon_cms/admin/{pt_br.yml → pt-BR.yml} +48 -18
- data/config/locales/camaleon_cms/common.yml +66 -0
- data/config/locales/camaleon_cms/languages.yml +13 -0
- data/config/locales/camaleon_cms/routes.yml +2 -2
- data/config/routes/admin.rb +3 -0
- data/config/system.json +3 -3
- data/db/migrate/20160606135421_improve_menus_structure.rb +7 -0
- data/db/migrate/20160609121449_add_group_to_custom_field_values.rb +5 -0
- data/lib/camaleon_cms/engine.rb +4 -3
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/ext/string.rb +20 -0
- data/lib/ext/translator.rb +2 -2
- data/lib/generators/camaleon_cms/gem_plugin_generator.rb +1 -1
- data/lib/generators/camaleon_cms/gem_plugin_template/config/camaleon_plugin.json +1 -1
- data/lib/generators/camaleon_cms/install_generator.rb +1 -0
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb +1 -4
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/index.html.erb +1 -25
- data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +17 -18
- data/lib/plugin_routes.rb +4 -4
- metadata +25 -48
- data/app/apps/plugins/contact_form/admin_forms_controller.rb +0 -85
- data/app/apps/plugins/contact_form/assets/css/admin/form-builder/formbuilder.css +0 -70
- data/app/apps/plugins/contact_form/assets/css/contact-form.css +0 -8
- data/app/apps/plugins/contact_form/assets/css/front/railsform.scss +0 -94
- data/app/apps/plugins/contact_form/assets/css/readme.txt +0 -1
- data/app/apps/plugins/contact_form/assets/js/contact_form.js +0 -2
- data/app/apps/plugins/contact_form/assets/js/form-builder/formbuilder.js +0 -1271
- data/app/apps/plugins/contact_form/assets/js/form-builder/vendor.js +0 -3072
- data/app/apps/plugins/contact_form/assets/js/readme.txt +0 -1
- data/app/apps/plugins/contact_form/config/config.json +0 -35
- data/app/apps/plugins/contact_form/config/custom_models.rb +0 -3
- data/app/apps/plugins/contact_form/config/locales/readme.txt +0 -1
- data/app/apps/plugins/contact_form/config/locales/translation.yml +0 -315
- data/app/apps/plugins/contact_form/config/routes_admin.txt +0 -4
- data/app/apps/plugins/contact_form/config/routes_front.txt +0 -2
- data/app/apps/plugins/contact_form/contact_form_helper.rb +0 -154
- data/app/apps/plugins/contact_form/contact_form_html_helper.rb +0 -140
- data/app/apps/plugins/contact_form/front_controller.rb +0 -50
- data/app/apps/plugins/contact_form/models/contact_form.rb +0 -26
- data/app/apps/plugins/contact_form/views/admin_forms/_form.html.erb +0 -33
- data/app/apps/plugins/contact_form/views/admin_forms/edit.html.erb +0 -338
- data/app/apps/plugins/contact_form/views/admin_forms/index.html.erb +0 -65
- data/app/apps/plugins/contact_form/views/admin_forms/responses.html.erb +0 -60
- data/app/apps/plugins/contact_form/views/contact_form/_email_content.html.erb +0 -26
- data/app/apps/plugins/contact_form/views/forms_shorcode.html.erb +0 -28
- data/app/apps/plugins/contact_form/views/front/index.html.erb +0 -3
- data/app/apps/themes/camaleon_first/views/admin/settings.html.erb +0 -4
- data/app/apps/themes/new/assets/css/bootstrap/bootstrap.min.css +0 -6735
- data/app/apps/themes/new/assets/js/plugins/bootstrap/bootstrap.min.js +0 -6
- data/app/apps/themes/new/assets/js/plugins/jquery/jquery.min.js +0 -4
- data/lib/generators/camaleon_cms/gem_theme_generator.rb +0 -97
- data/lib/generators/camaleon_cms/gem_theme_template/app/assets/images/themes/my_plugin/image.png +0 -0
- data/lib/generators/camaleon_cms/gem_theme_template/app/assets/javascripts/themes/my_plugin/main.js +0 -14
- data/lib/generators/camaleon_cms/gem_theme_template/app/assets/stylesheets/themes/my_plugin/main.css +0 -13
- data/lib/generators/camaleon_cms/gem_theme_template/app/helpers/themes/my_plugin/main_helper.rb +0 -26
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/admin/settings.html.erb +0 -4
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/index.html.erb +0 -25
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/layouts/index.html.erb +0 -70
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/partials/readme.txt +0 -1
- data/lib/generators/camaleon_cms/gem_theme_template/config/camaleon_theme.json +0 -14
File without changes
|
@@ -10,7 +10,7 @@
|
|
10
10
|
}(this, function (moment) { 'use strict';
|
11
11
|
|
12
12
|
|
13
|
-
var pt_br = moment.defineLocale('pt-
|
13
|
+
var pt_br = moment.defineLocale('pt-BR', {
|
14
14
|
months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'),
|
15
15
|
monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
|
16
16
|
weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'),
|
@@ -42,6 +42,20 @@ $ ->
|
|
42
42
|
save_menu(data)
|
43
43
|
return false
|
44
44
|
|
45
|
+
# add custom menu items (non-external)
|
46
|
+
menu_items_available.find(".add_links_custom_to_menu").click ->
|
47
|
+
data = {custom_items: [], authenticity_token: menu_form.find('[name="authenticity_token"]').val()}
|
48
|
+
flag =false
|
49
|
+
$(this).closest('.panel').find('input:checkbox:checked').each(->
|
50
|
+
flag = true
|
51
|
+
data['custom_items'].push({url: $(this).val(), label: $(this).attr('data-label')})
|
52
|
+
).prop('checked', false)
|
53
|
+
|
54
|
+
unless flag
|
55
|
+
return false
|
56
|
+
save_menu(data)
|
57
|
+
return false
|
58
|
+
|
45
59
|
# add external link
|
46
60
|
menu_items_available.find('.form-custom-link').submit ->
|
47
61
|
form = $(this)
|
@@ -65,7 +79,7 @@ $ ->
|
|
65
79
|
return false
|
66
80
|
showLoading()
|
67
81
|
$.post(form.attr('action'), form.serialize(), (res)->
|
68
|
-
link.closest('li').replaceWith(res)
|
82
|
+
link.closest('li').replaceWith($(res).html())
|
69
83
|
modal.modal("hide")
|
70
84
|
hideLoading()
|
71
85
|
)
|
@@ -12,7 +12,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
12
12
|
"<div class='p_thumb'></div>" +
|
13
13
|
"<div class='p_label'><b>"+I18n("button.name")+": </b><br> <span>"+data["name"]+"</span></div>" +
|
14
14
|
"<div class='p_body'>" +
|
15
|
-
"<div><b>"+I18n("button.url")+":</b><br> <a target='_blank' href='"+data["url"]+"'>"+data["url"]+"</a></div>" +
|
15
|
+
"<div style='overflow: auto;'><b>"+I18n("button.url")+":</b><br> <a target='_blank' href='"+data["url"]+"'>"+data["url"]+"</a></div>" +
|
16
16
|
"<div><b>"+I18n("button.size")+":</b> <span>"+cama_humanFileSize(data["size"])+"</span></div>" +
|
17
17
|
"</div>"
|
18
18
|
|
@@ -59,7 +59,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
59
59
|
########## file uploader
|
60
60
|
p_upload = media_panel.find(".cama_media_fileuploader")
|
61
61
|
customFileData = ->
|
62
|
-
return
|
62
|
+
return cama_media_get_custom_params()
|
63
63
|
|
64
64
|
p_upload.uploadFile({
|
65
65
|
url: p_upload.attr("data-url"),
|
@@ -123,7 +123,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
123
123
|
media_link_tab_upload.click()
|
124
124
|
|
125
125
|
showLoading()
|
126
|
-
$.get(media_panel.attr("data-url"),
|
126
|
+
$.get(media_panel.attr("data-url"), cama_media_get_custom_params({partial: true, folder: folder}), (res)->
|
127
127
|
media_panel.find(".media_browser_list").html(res)
|
128
128
|
hideLoading()
|
129
129
|
)
|
@@ -137,7 +137,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
137
137
|
# search file
|
138
138
|
media_panel.find('#cama_search_form').submit ->
|
139
139
|
showLoading()
|
140
|
-
$.get(media_panel.attr("data-url"), {search: $(this).find('input:text').val(), partial: true
|
140
|
+
$.get(media_panel.attr("data-url"), cama_media_get_custom_params({search: $(this).find('input:text').val(), partial: true}), (res)->
|
141
141
|
media_panel.find(".media_browser_list").html(res)
|
142
142
|
hideLoading()
|
143
143
|
)
|
@@ -146,7 +146,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
146
146
|
# reload current directory
|
147
147
|
media_panel.find('.cam_media_reload').click (e)->
|
148
148
|
showLoading()
|
149
|
-
$.get(media_panel.attr("data-url"), {partial: true,
|
149
|
+
$.get(media_panel.attr("data-url"), cama_media_get_custom_params({partial: true, cama_media_reload: $(this).attr('data-action')}), (res)->
|
150
150
|
media_panel.find(".media_browser_list").html(res)
|
151
151
|
hideLoading()
|
152
152
|
)
|
@@ -154,7 +154,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
154
154
|
|
155
155
|
# element actions
|
156
156
|
media_panel.on("click", "a.add_folder", ->
|
157
|
-
content = $("<form><div><label for=''>"+I18n('button.folder')+": </label> <div class='input-group'><input name='folder' class='form-control required' placeholder='Folder name..'><span class='input-group-btn'><button class='btn btn-primary' type='submit'>"+I18n('button.create')+"</button></span></div></div> </form>")
|
157
|
+
content = $("<form id='add_folder_form'><div><label for=''>"+I18n('button.folder')+": </label> <div class='input-group'><input name='folder' class='form-control required' placeholder='Folder name..'><span class='input-group-btn'><button class='btn btn-primary' type='submit'>"+I18n('button.create')+"</button></span></div></div> </form>")
|
158
158
|
callback = (modal)->
|
159
159
|
btn = modal.find(".btn-primary")
|
160
160
|
input = modal.find("input").keyup(->
|
@@ -165,7 +165,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
165
165
|
).trigger("keyup")
|
166
166
|
modal.find("form").submit ->
|
167
167
|
showLoading()
|
168
|
-
$.post(media_panel.attr("data-url_actions"), {folder: media_panel.attr("data-folder")+"/"+input.val()
|
168
|
+
$.post(media_panel.attr("data-url_actions"), cama_media_get_custom_params({folder: media_panel.attr("data-folder")+"/"+input.val(), media_action: "new_folder"}), (res)->
|
169
169
|
hideLoading()
|
170
170
|
modal.modal("hide")
|
171
171
|
if res.search("folder_item") >= 0 # success upload
|
@@ -174,7 +174,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
174
174
|
$.fn.alert({type: 'error', content: res, title: "Error"})
|
175
175
|
)
|
176
176
|
return false
|
177
|
-
open_modal({title: "New Folder", content: content, callback: callback})
|
177
|
+
open_modal({title: "New Folder", content: content, callback: callback, zindex: 9999999})
|
178
178
|
return false
|
179
179
|
)
|
180
180
|
|
@@ -185,7 +185,7 @@ window["cama_init_media"] = (media_panel) ->
|
|
185
185
|
link = $(this)
|
186
186
|
item = link.closest(".media_item")
|
187
187
|
showLoading()
|
188
|
-
$.post(media_panel.attr("data-url_actions"), {folder: media_panel.attr("data-folder")+"/"+item.attr("data-key")
|
188
|
+
$.post(media_panel.attr("data-url_actions"), cama_media_get_custom_params({folder: media_panel.attr("data-folder")+"/"+item.attr("data-key"), media_action: if link.hasClass("del_folder") then "del_folder" else "del_file"}), (res)->
|
189
189
|
hideLoading()
|
190
190
|
if res
|
191
191
|
$.fn.alert({type: 'error', content: res, title: I18n("button.error")})
|
@@ -208,15 +208,26 @@ window["cama_init_media"] = (media_panel) ->
|
|
208
208
|
return false
|
209
209
|
).validate()
|
210
210
|
|
211
|
+
# return extra attributes for media panel
|
212
|
+
window['cama_media_get_custom_params'] = (custom_settings)->
|
213
|
+
media_panel = $("#cama_media_gallery")
|
214
|
+
r = eval("("+media_panel.attr('data-extra-params')+")")
|
215
|
+
r['folder'] = media_panel.attr("data-folder")
|
216
|
+
if custom_settings
|
217
|
+
$.extend(r, custom_settings)
|
218
|
+
r['folder'] = r['folder'].replace(/\/{2,}/g, '/')
|
219
|
+
return r
|
220
|
+
|
211
221
|
$ ->
|
212
222
|
# sample: $.fn.upload_url({url: 'http://camaleon.tuzitio.com/media/132/logo2.png', dimension: '120x120', versions: '200x200', folder: 'my_folder', thumb_size: '100x100'})
|
213
223
|
# dimension: default current dimension
|
214
224
|
# folder: default current folder
|
225
|
+
# private: (Boolean) if true => list private files
|
215
226
|
$.fn.upload_url = (args)->
|
216
227
|
media_panel = $("#cama_media_gallery")
|
217
|
-
data =
|
228
|
+
data = cama_media_get_custom_params({media_action: "crop_url", onerror: (message) ->
|
218
229
|
$.fn.alert({type: 'error', content: message, title: I18n("msg.error_uploading")})
|
219
|
-
}
|
230
|
+
})
|
220
231
|
$.extend(data, args); on_error = data["onerror"]; delete data["onerror"];
|
221
232
|
showLoading()
|
222
233
|
$.post(media_panel.attr("data-url_actions"), data, (res_upload)->
|
@@ -237,9 +248,10 @@ $ ->
|
|
237
248
|
# sample: $.fn.upload_filemanager({title: "My title", formats: "image,video", dimension: "30x30", versions: '100x100,200x200', thumb_size: '100x100', selected: function(file){ alert(file["name"]) }})
|
238
249
|
# file structure: {"name":"422.html","size":1547, "url":"http://localhost:3000/media/1/422.html", "format":"doc","type":"text/html"}
|
239
250
|
# dimension: dimension: "30x30" | "x30" | dimension: "30x"
|
251
|
+
# private: (boolean) if true => browser private files that are not possible access by public url
|
240
252
|
$.fn.upload_filemanager = (args)->
|
241
253
|
args = args || {}
|
242
|
-
open_modal({title: args["title"] || I18n("msg.media_title"), id: 'cama_modal_file_uploader', modal_size: "modal-lg", mode: "ajax", url: root_admin_url+"/media/ajax", ajax_params: {media_formats: args["formats"], dimension: args["dimension"], versions: args["versions"], thumb_size: args["thumb_size"] }, callback: (modal)->
|
254
|
+
open_modal({title: args["title"] || I18n("msg.media_title"), id: 'cama_modal_file_uploader', modal_size: "modal-lg", mode: "ajax", url: root_admin_url+"/media/ajax", ajax_params: {media_formats: args["formats"], dimension: args["dimension"], versions: args["versions"], thumb_size: args["thumb_size"], private: args['private'] }, callback: (modal)->
|
243
255
|
if args["selected"]
|
244
256
|
window["callback_media_uploader"] = args["selected"]
|
245
257
|
modal.css("z-index", args["zindex"] || 99999).children(".modal-dialog").css("width", "90%")
|
@@ -191,6 +191,15 @@
|
|
191
191
|
}
|
192
192
|
}
|
193
193
|
}
|
194
|
+
.custom_sortable_grouped .header-field-grouped{
|
195
|
+
padding: 5px;
|
196
|
+
margin-bottom: 3px;
|
197
|
+
.fa{
|
198
|
+
@include link_round;
|
199
|
+
display: inline-block;
|
200
|
+
float: none;
|
201
|
+
}
|
202
|
+
}
|
194
203
|
}
|
195
204
|
|
196
205
|
//************** Main Header && intro js custom
|
@@ -107,6 +107,13 @@ class CamaleonCms::Admin::Appearances::NavMenusController < CamaleonCms::AdminCo
|
|
107
107
|
items << item
|
108
108
|
end
|
109
109
|
|
110
|
+
if params[:custom_items].present? # custom menu items
|
111
|
+
params[:custom_items].each do |index, item|
|
112
|
+
item = @nav_menu.append_menu_item({label: item['label'], link: item['url'], type: 'external'})
|
113
|
+
items << item
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
110
117
|
if params[:items].present?
|
111
118
|
params[:items].each do |index, item|
|
112
119
|
item = @nav_menu.append_menu_item({label: 'auto', link: item['id'], type: item['kind']})
|
@@ -119,19 +126,19 @@ class CamaleonCms::Admin::Appearances::NavMenusController < CamaleonCms::AdminCo
|
|
119
126
|
private
|
120
127
|
def parse_menu_item(nav_menu_item)
|
121
128
|
begin
|
122
|
-
case nav_menu_item.
|
129
|
+
case nav_menu_item.kind
|
123
130
|
when 'post'
|
124
|
-
post = CamaleonCms::Post.find(nav_menu_item.
|
131
|
+
post = CamaleonCms::Post.find(nav_menu_item.url).decorate
|
125
132
|
return false unless post.status == 'published'
|
126
133
|
{name: post.the_title(locale: @frontend_locale), url_edit: post.the_edit_url }
|
127
134
|
when 'category'
|
128
|
-
category = CamaleonCms::Category.find(nav_menu_item.
|
135
|
+
category = CamaleonCms::Category.find(nav_menu_item.url).decorate
|
129
136
|
{name: category.the_title, url_edit: category.the_edit_url}
|
130
137
|
when 'post_tag'
|
131
|
-
post_tag = CamaleonCms::PostTag.find(nav_menu_item.
|
138
|
+
post_tag = CamaleonCms::PostTag.find(nav_menu_item.url).decorate
|
132
139
|
{name: post_tag.the_title, url_edit: post_tag.the_edit_url}
|
133
140
|
when 'post_type'
|
134
|
-
post_type = CamaleonCms::PostType.find(nav_menu_item.
|
141
|
+
post_type = CamaleonCms::PostType.find(nav_menu_item.url).decorate
|
135
142
|
{name: post_type.the_title, url_edit: post_type.the_edit_url}
|
136
143
|
when 'external'
|
137
144
|
{name: nav_menu_item.name.to_s}
|
@@ -146,6 +153,6 @@ class CamaleonCms::Admin::Appearances::NavMenusController < CamaleonCms::AdminCo
|
|
146
153
|
helper_method :parse_menu_item
|
147
154
|
|
148
155
|
def check_menu_permission
|
149
|
-
authorize! :
|
156
|
+
authorize! :manage, :menu
|
150
157
|
end
|
151
158
|
end
|
@@ -12,7 +12,7 @@ class CamaleonCms::Admin::Appearances::ThemesController < CamaleonCms::AdminCont
|
|
12
12
|
def index
|
13
13
|
add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.themes")
|
14
14
|
PluginRoutes.reload
|
15
|
-
authorize! :
|
15
|
+
authorize! :manage, :themes
|
16
16
|
if params[:set].present?
|
17
17
|
site_install_theme(params[:set])
|
18
18
|
flash.now[:notice] = t('camaleon_cms.admin.themes.message.updated')
|
@@ -7,14 +7,13 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
class CamaleonCms::Admin::MediaController < CamaleonCms::AdminController
|
10
|
-
skip_before_filter :
|
11
|
-
skip_before_filter :admin_logged_actions, except: [:index, :search]
|
10
|
+
skip_before_filter :admin_logged_actions, except: [:index, :download_private_file]
|
12
11
|
skip_before_filter :verify_authenticity_token, only: :upload
|
13
|
-
before_action :init_media_vars
|
12
|
+
before_action :init_media_vars, except: :download_private_file
|
14
13
|
|
15
14
|
# render media section
|
16
15
|
def index
|
17
|
-
authorize! :
|
16
|
+
authorize! :manage, :media
|
18
17
|
@show_file_actions = true
|
19
18
|
add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.media")
|
20
19
|
end
|
@@ -28,6 +27,16 @@ class CamaleonCms::Admin::MediaController < CamaleonCms::AdminController
|
|
28
27
|
render text: res["url"]
|
29
28
|
end
|
30
29
|
|
30
|
+
# download private files
|
31
|
+
def download_private_file
|
32
|
+
f_path = CamaleonCmsLocalUploader::private_file_path(params[:file], current_site)
|
33
|
+
if File.exist?(f_path)
|
34
|
+
send_file f_path, disposition: 'inline'
|
35
|
+
else
|
36
|
+
raise ActionController::RoutingError, 'File not found'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
31
40
|
# render media for modal content
|
32
41
|
def ajax
|
33
42
|
@tree = cama_uploader.search(params[:search]) if params[:search].present?
|
@@ -40,7 +49,7 @@ class CamaleonCms::Admin::MediaController < CamaleonCms::AdminController
|
|
40
49
|
# do background actions in fog
|
41
50
|
def actions
|
42
51
|
if params[:media_action] != 'crop_url'
|
43
|
-
authorize! :
|
52
|
+
authorize! :manage, :media
|
44
53
|
end
|
45
54
|
params[:folder] = params[:folder].gsub("//", "/") if params[:folder].present?
|
46
55
|
case params[:media_action]
|
@@ -77,6 +86,7 @@ class CamaleonCms::Admin::MediaController < CamaleonCms::AdminController
|
|
77
86
|
private
|
78
87
|
# init basic media variables
|
79
88
|
def init_media_vars
|
89
|
+
@cama_uploader = CamaleonCmsLocalUploader.new({current_site: current_site, private: true}) if params[:private].present?
|
80
90
|
cama_uploader.clear_cache if params[:cama_media_reload].present? && params[:cama_media_reload] == 'clear_cache'
|
81
91
|
@media_formats = (params[:media_formats] || "").sub("media", ",video,audio").sub("all", "").split(",")
|
82
92
|
@tree = cama_uploader.objects(@folder = params[:folder] || "/")
|
@@ -32,10 +32,7 @@ class CamaleonCms::Admin::Settings::CustomFieldsController < CamaleonCms::Admin:
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def update
|
35
|
-
if @field_group.update(@post_data)
|
36
|
-
@field_group.add_fields(params[:fields], params[:field_options])
|
37
|
-
@field_group.set_option('caption', @post_data[:caption])
|
38
|
-
flash[:notice] = t('camaleon_cms.admin.custom_field.message.custom_updated')
|
35
|
+
if @field_group.update(@post_data) && _save_fields(@field_group)
|
39
36
|
redirect_to action: :edit, id: @field_group.id
|
40
37
|
else
|
41
38
|
render 'form'
|
@@ -51,10 +48,7 @@ class CamaleonCms::Admin::Settings::CustomFieldsController < CamaleonCms::Admin:
|
|
51
48
|
# create a new custom field group
|
52
49
|
def create
|
53
50
|
@field_group = current_site.custom_field_groups.new(@post_data)
|
54
|
-
if @field_group.save
|
55
|
-
@field_group.add_fields(params[:fields], params[:field_options])
|
56
|
-
@field_group.set_option('caption', @post_data[:caption])
|
57
|
-
flash[:notice] = t('camaleon_cms.admin.custom_field.message.custom_created')
|
51
|
+
if @field_group.save && _save_fields(@field_group)
|
58
52
|
redirect_to action: :edit, id: @field_group.id
|
59
53
|
else
|
60
54
|
new
|
@@ -92,4 +86,16 @@ class CamaleonCms::Admin::Settings::CustomFieldsController < CamaleonCms::Admin:
|
|
92
86
|
redirect_to cama_admin_path
|
93
87
|
end
|
94
88
|
end
|
89
|
+
|
90
|
+
# return boolean: true if all fields were saved successfully
|
91
|
+
def _save_fields(group)
|
92
|
+
errors_saved, all_fields = group.add_fields(params[:fields], params[:field_options])
|
93
|
+
group.set_option('caption', @post_data[:caption])
|
94
|
+
if errors_saved.present?
|
95
|
+
flash[:error] = "<b>#{t('camaleon_cms.errors_found_msg', default: 'Several errors were found, please check.')}</b><br>#{errors_saved.map{|field| "#{field.name}: " + "#{field.errors.messages.map{|k,v| "#{k.to_s.titleize}: #{v.join('|')}"}.join(', ')}" }.join('<br>')}"
|
96
|
+
else
|
97
|
+
flash[:notice] = t('camaleon_cms.admin.custom_field.message.custom_updated')
|
98
|
+
end
|
99
|
+
true
|
100
|
+
end
|
95
101
|
end
|
@@ -7,7 +7,8 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
class CamaleonCms::Admin::SettingsController < CamaleonCms::AdminController
|
10
|
-
before_action :validate_role
|
10
|
+
before_action :validate_role, except: [:theme, :save_theme]
|
11
|
+
before_action :validate_role_theme, only: [:theme, :save_theme]
|
11
12
|
add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.settings")
|
12
13
|
|
13
14
|
def index
|
@@ -15,6 +16,7 @@ class CamaleonCms::Admin::SettingsController < CamaleonCms::AdminController
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def site
|
19
|
+
return redirect_to cama_admin_settings_theme_path if params[:tab].present? && params[:tab] == 'theme'
|
18
20
|
add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.general_site")
|
19
21
|
@site = current_site
|
20
22
|
end
|
@@ -25,12 +27,7 @@ class CamaleonCms::Admin::SettingsController < CamaleonCms::AdminController
|
|
25
27
|
@site.set_options(params[:meta]) if params[:meta].present?
|
26
28
|
@site.set_multiple_options(params[:options])
|
27
29
|
@site.set_field_values(params[:field_options])
|
28
|
-
theme = @site.get_theme.decorate
|
29
|
-
theme.set_field_values(params[:theme_fields]) if params[:theme_fields].present?
|
30
|
-
theme.set_options(params[:theme_option]) if params[:theme_option].present?
|
31
|
-
theme.set_metas(params[:theme_meta]) if params[:theme_meta].present?
|
32
30
|
flash[:notice] = t('camaleon_cms.admin.settings.message.site_updated')
|
33
|
-
hook_run(theme.settings, "on_theme_settings", theme)
|
34
31
|
redirect_to action: :site
|
35
32
|
else
|
36
33
|
render 'site'
|
@@ -58,9 +55,27 @@ class CamaleonCms::Admin::SettingsController < CamaleonCms::AdminController
|
|
58
55
|
redirect_to action: :languages
|
59
56
|
end
|
60
57
|
|
58
|
+
def theme
|
59
|
+
add_breadcrumb I18n.t("camaleon_cms.admin.settings.theme_setting", default: 'Theme Settings')
|
60
|
+
end
|
61
|
+
|
62
|
+
def save_theme
|
63
|
+
current_theme.set_field_values(params[:theme_fields]) if params[:theme_fields].present?
|
64
|
+
current_theme.set_options(params[:theme_option]) if params[:theme_option].present?
|
65
|
+
current_theme.set_metas(params[:theme_meta]) if params[:theme_meta].present?
|
66
|
+
current_theme.set_field_values(params[:field_options])
|
67
|
+
hook_run(current_theme.settings, "on_theme_settings", current_theme)# permit to save extra/custom values by this hook
|
68
|
+
flash[:notice] = t('camaleon_cms.admin.message.updated_success', default: 'Theme updated successfully')
|
69
|
+
redirect_to action: :theme
|
70
|
+
end
|
71
|
+
|
61
72
|
private
|
62
73
|
|
63
74
|
def validate_role
|
64
|
-
authorize! :
|
75
|
+
authorize! :manage, :settings
|
76
|
+
end
|
77
|
+
|
78
|
+
def validate_role_theme
|
79
|
+
authorize! :manage, :theme_settings
|
65
80
|
end
|
66
81
|
end
|