camaleon_cms 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b1ddcb6f9816172e07881cf890833d6d0134972
4
- data.tar.gz: edaf65e2946b00baacca1b96aea9c3eefd865581
3
+ metadata.gz: 3698af8315ca5b054ca6200eda9bf56f1db13860
4
+ data.tar.gz: 51f8fa5c8350f0c5fd6f1be10c2bea2e6f6d448f
5
5
  SHA512:
6
- metadata.gz: cda789a69b71654bd41c356c44dc89f63f3fa62d26ca7ce52536d009955b6e981e346ad4c4663e7f72a73cbe3232efa80c605f2a84e8770eca3a5397e49f5e54
7
- data.tar.gz: 4e92c4fe5faf038dce9293d79b6306065ed325f530caae99644cd23e7c684d2b7fc2b71ea3b15c77dcb929d48e5f1d6995c2882495ac5bae358ca64867bb3a7d
6
+ metadata.gz: 2f5133339ddc655a70acdc28f6aadb002c73f78f2001bd56a8f8f163b1cb3e59cd51ea56f2b43dcc05aa16360e24cd9ae5a532d83477e77e95727a1e3829a667
7
+ data.tar.gz: 64e28c83cbc3b82486483944787db419a385b0f110b2db4e9c65f81213702804a9647e81c6f51261df1051ac5cec5a657349d2e6fe33b1c96800c226dd2784b3
@@ -91,7 +91,7 @@ module Plugins::ContactForm::ContactFormHelper
91
91
  values[:fields].each do |f|
92
92
  cid = f[:cid].to_sym
93
93
  if f[:field_type] == 'file'
94
- res = upload_file(fields[cid], {maximum: 5.megabytes, folder: current_site.upload_directory("uploads")})
94
+ res = upload_file(fields[cid], {maximum: 5.megabytes, folder: 'contact_form'})
95
95
  if res[:error].present?
96
96
  errors << res[:error]
97
97
  else
@@ -145,7 +145,7 @@ module Plugins::FrontCache::FrontCacheHelper
145
145
  end
146
146
 
147
147
  def front_cache_get_key(prefix = "")
148
- request.path_info.parameterize
148
+ request.fullpath.parameterize
149
149
  end
150
150
 
151
151
  # check if current post can be cached (skip private pages)
@@ -27,7 +27,9 @@ module Themes::New::CustomHelper
27
27
  group.add_manual_field({"name"=>"Footer text", "slug"=>"theme_custom_footer_text"},{field_key: "editor", translate: true})
28
28
  end
29
29
 
30
- theme.site.nav_menus.create(name: "Main Menu", slug: "main_menu")
30
+ unless theme.site.nav_menus.where(slug: "main_menu").any?
31
+ theme.site.nav_menus.create(name: "Main Menu", slug: "main_menu")
32
+ end
31
33
  end
32
34
 
33
35
  def theme_custom_on_uninstall_theme(theme)
@@ -170,7 +170,7 @@ function load_upload_image_field(dom) {
170
170
  function load_upload_video_field(dom) {
171
171
  var $input = $(dom).parents('li:first').find('input');
172
172
  $.fn.upload_filemanager({
173
- formats: "videos",
173
+ formats: "video",
174
174
  selected: function (file, response) {
175
175
  $input.val(file.url);
176
176
  }
@@ -5,4 +5,4 @@
5
5
  * Copyright (c) 2013 Ravishanker Kusuma
6
6
  * http://hayageek.com/
7
7
  */
8
- !function(e){void 0==e.fn.ajaxForm&&e.getScript(("https:"==document.location.protocol?"https://":"http://")+"malsup.github.io/jquery.form.js");var a={};a.fileapi=void 0!==e("<input type='file'/>").get(0).files,a.formdata=void 0!==window.FormData,e.fn.uploadFile=function(t){function r(){S||(S=!0,function e(){if(w.sequential||(w.sequentialCount=99999),0==x.length&&0==D.length)w.afterUploadAll&&w.afterUploadAll(C),S=!1;else{if(D.length<w.sequentialCount){var a=x.shift();void 0!=a&&(D.push(a),a.submit())}window.setTimeout(e,100)}}())}function o(a,t,r){r.on("dragenter",function(a){a.stopPropagation(),a.preventDefault(),e(this).addClass(t.dragDropHoverClass)}),r.on("dragover",function(a){a.stopPropagation(),a.preventDefault();var r=e(this);r.hasClass(t.dragDropContainerClass)&&!r.hasClass(t.dragDropHoverClass)&&r.addClass(t.dragDropHoverClass)}),r.on("drop",function(r){r.preventDefault(),e(this).removeClass(t.dragDropHoverClass),a.errorLog.html("");var o=r.originalEvent.dataTransfer.files;return!t.multiple&&o.length>1?void(t.showError&&e("<div class='"+t.errorClass+"'>"+t.multiDragErrorStr+"</div>").appendTo(a.errorLog)):void(0!=t.onSelect(o)&&l(t,a,o))}),r.on("dragleave",function(){e(this).removeClass(t.dragDropHoverClass)}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(a){a.stopPropagation(),a.preventDefault();var r=e(this);r.hasClass(t.dragDropContainerClass)||r.removeClass(t.dragDropHoverClass)}),e(document).on("drop",function(a){a.stopPropagation(),a.preventDefault(),e(this).removeClass(t.dragDropHoverClass)})}function s(e){var a="",t=e/1024;if(parseInt(t)>1024){var r=t/1024;a=r.toFixed(2)+" MB"}else a=t.toFixed(2)+" KB";return a}function i(a){var t=[];t="string"==jQuery.type(a)?a.split("&"):e.param(a).split("&");var r,o,s=t.length,i=[];for(r=0;s>r;r++)t[r]=t[r].replace(/\+/g," "),o=t[r].split("="),i.push([decodeURIComponent(o[0]),decodeURIComponent(o[1])]);return i}function l(a,t,r){for(var o=0;o<r.length;o++)if(n(t,a,r[o].name))if(a.allowDuplicates||!d(t,r[o].name))if(-1!=a.maxFileSize&&r[o].size>a.maxFileSize)a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.sizeErrorStr+s(a.maxFileSize)+"</div>").appendTo(t.errorLog);else if(-1!=a.maxFileCount&&t.selectedFiles>=a.maxFileCount)a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.maxFileCountErrorStr+a.maxFileCount+"</div>").appendTo(t.errorLog);else{t.selectedFiles++,t.existingFileNames.push(r[o].name);var l=a,p=new FormData,u=a.fileName.replace("[]","");p.append(u,r[o]);var c=a.formData;if(c)for(var h=i(c),f=0;f<h.length;f++)h[f]&&p.append(h[f][0],h[f][1]);l.fileData=p;var w=new m(t,a),g="";g=a.showFileCounter?t.fileCounter+a.fileCounterStyle+r[o].name:r[o].name,a.showFileSize&&(g+=" ("+s(r[o].size)+")"),w.filename.html(g);var C=e("<form style='display:block; position:absolute;left: 150px;' class='"+t.formGroup+"' method='"+a.method+"' action='"+a.url+"' enctype='"+a.enctype+"'></form>");C.appendTo("body");var b=[];b.push(r[o].name),v(C,l,w,b,t,r[o]),t.fileCounter++}else a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.duplicateErrorStr+"</div>").appendTo(t.errorLog);else a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.extErrorStr+a.allowedTypes+"</div>").appendTo(t.errorLog)}function n(e,a,t){var r=a.allowedTypes.toLowerCase().split(/[\s,]+/g),o=t.split(".").pop().toLowerCase();return"*"!=a.allowedTypes&&jQuery.inArray(o,r)<0?!1:!0}function d(e,a){var t=!1;if(e.existingFileNames.length)for(var r=0;r<e.existingFileNames.length;r++)(e.existingFileNames[r]==a||w.duplicateStrict&&e.existingFileNames[r].toLowerCase()==a.toLowerCase())&&(t=!0);return t}function p(e,a){if(e.existingFileNames.length)for(var t=0;t<a.length;t++){var r=e.existingFileNames.indexOf(a[t]);-1!=r&&e.existingFileNames.splice(r,1)}}function u(e,a){if(e){a.show();var t=new FileReader;t.onload=function(e){a.attr("src",e.target.result)},t.readAsDataURL(e)}}function c(a,t){if(a.showFileCounter){var r=e(t.container).find(".ajax-file-upload-filename").length;t.fileCounter=r+1,e(t.container).find(".ajax-file-upload-filename").each(function(){var t=e(this).html().split(a.fileCounterStyle),o=(parseInt(t[0])-1,r+a.fileCounterStyle+t[1]);e(this).html(o),r--})}}function h(t,r,o,s){var i="ajax-upload-id-"+(new Date).getTime(),d=e("<form method='"+o.method+"' action='"+o.url+"' enctype='"+o.enctype+"'></form>"),p="<input type='file' id='"+i+"' name='"+o.fileName+"' accept='"+o.acceptFiles+"'/>";o.multiple&&(o.fileName.indexOf("[]")!=o.fileName.length-2&&(o.fileName+="[]"),p="<input type='file' id='"+i+"' name='"+o.fileName+"' accept='"+o.acceptFiles+"' multiple/>");var u=e(p).appendTo(d);u.change(function(){t.errorLog.html("");var i=(o.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(g=0;g<this.files.length;g++)i.push(this.files[g].name);if(0==o.onSelect(this.files))return}else{var p=e(this).val(),u=[];if(i.push(p),!n(t,o,p))return void(o.showError&&e("<div class='"+o.errorClass+"'><b>"+p+"</b> "+o.extErrorStr+o.allowedTypes+"</div>").appendTo(t.errorLog));if(u.push({name:p,size:"NA"}),0==o.onSelect(u))return}if(c(o,t),s.unbind("click"),d.hide(),h(t,r,o,s),d.addClass(r),o.serialize&&a.fileapi&&a.formdata){d.removeClass(r);var f=this.files;d.remove(),l(o,t,f)}else{for(var w="",g=0;g<i.length;g++)w+=o.showFileCounter?t.fileCounter+o.fileCounterStyle+i[g]+"<br>":i[g]+"<br>",t.fileCounter++;if(-1!=o.maxFileCount&&t.selectedFiles+i.length>o.maxFileCount)return void(o.showError&&e("<div class='"+o.errorClass+"'><b>"+w+"</b> "+o.maxFileCountErrorStr+o.maxFileCount+"</div>").appendTo(t.errorLog));t.selectedFiles+=i.length;var C=new m(t,o);C.filename.html(w),v(d,o,C,i,t,null)}}),o.nestedForms?(d.css({margin:0,padding:0}),s.css({position:"relative",overflow:"hidden",cursor:"default"}),u.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"100%",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),d.appendTo(s)):(d.appendTo(e("body")),d.css({margin:0,padding:0,display:"block",position:"absolute",left:"-250px"}),-1!=navigator.appVersion.indexOf("MSIE ")?s.attr("for",i):s.click(function(){u.click()}))}function f(a,t){return this.statusbar=e("<div class='ajax-file-upload-statusbar'></div>").width(t.statusBarWidth),this.preview=e("<img class='ajax-file-upload-preview' />").width(t.previewWidth).height(t.previewHeight).appendTo(this.statusbar).hide(),this.filename=e("<div class='ajax-file-upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='ajax-file-upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='ajax-file-upload-bar'></div>").appendTo(this.progressDiv),this.abort=e("<div>"+t.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div>"+t.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div>"+t.doneStr+"</div>").appendTo(this.statusbar).hide(),this.download=e("<div>"+t.downloadStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div>"+t.deletelStr+"</div>").appendTo(this.statusbar).hide(),this.abort.addClass("ajax-file-upload-red"),this.done.addClass("ajax-file-upload-green"),this.download.addClass("ajax-file-upload-green"),this.cancel.addClass("ajax-file-upload-red"),this.del.addClass("ajax-file-upload-red"),this}function m(a,t){var r=null;return r=t.customProgressBar?new t.customProgressBar(a,t):new f(a,t),r.abort.addClass(a.formGroup),r.abort.addClass(t.abortButtonClass),r.cancel.addClass(a.formGroup),r.cancel.addClass(t.cancelButtonClass),t.extraHTML&&(r.extraHTML=e("<div class='extrahtml'>"+t.extraHTML()+"</div>").insertAfter(r.filename)),"bottom"==t.uploadQueuOrder?e(a.container).append(r.statusbar):e(a.container).prepend(r.statusbar),r}function v(t,o,s,l,n,d){var h={cache:!1,contentType:!1,processData:!1,forceSync:!1,type:o.method,data:o.formData,formData:o.fileData,dataType:o.returnType,beforeSubmit:function(a,r,d){if(0!=o.onSubmit.call(this,l)){if(o.dynamicFormData){var u=i(o.dynamicFormData());if(u)for(var h=0;h<u.length;h++)u[h]&&(void 0!=o.fileData?d.formData.append(u[h][0],u[h][1]):d.data[u[h][0]]=u[h][1])}return o.extraHTML&&e(s.extraHTML).find("input,select,textarea").each(function(){void 0!=o.fileData?d.formData.append(e(this).attr("name"),e(this).val()):d.data[e(this).attr("name")]=e(this).val()}),!0}return s.statusbar.append("<div class='"+o.errorClass+"'>"+o.uploadErrorStr+"</div>"),s.cancel.show(),t.remove(),s.cancel.click(function(){x.splice(x.indexOf(t),1),p(n,l),s.statusbar.remove(),o.onCancel.call(n,l,s),n.selectedFiles-=l.length,c(o,n)}),!1},beforeSend:function(e){s.progressDiv.show(),s.cancel.hide(),s.done.hide(),o.showAbort&&(s.abort.show(),s.abort.click(function(){p(n,l),e.abort(),n.selectedFiles-=l.length,o.onAbort.call(n,l,s)})),s.progressbar.width(a.formdata?"1%":"5%")},uploadProgress:function(e,a,t,r){r>98&&(r=98);var i=r+"%";r>1&&s.progressbar.width(i),o.showProgress&&(s.progressbar.html(i),s.progressbar.css("text-align","center"))},success:function(a,r,i){if(s.cancel.remove(),D.pop(),"json"==o.returnType&&"object"==e.type(a)&&a.hasOwnProperty(o.customErrorKeyStr)){s.abort.hide();var d=a[o.customErrorKeyStr];return o.onError.call(this,l,200,d,s),o.showStatusAfterError?(s.progressDiv.hide(),s.statusbar.append("<span class='"+o.errorClass+"'>ERROR: "+d+"</span>")):(s.statusbar.hide(),s.statusbar.remove()),n.selectedFiles-=l.length,void t.remove()}n.responses.push(a),s.progressbar.width("100%"),o.showProgress&&(s.progressbar.html("100%"),s.progressbar.css("text-align","center")),s.abort.hide(),o.onSuccess.call(this,l,a,i,s),o.showStatusAfterSuccess?(o.showDone?(s.done.show(),s.done.click(function(){s.statusbar.hide("slow"),s.statusbar.remove()})):s.done.hide(),o.showDelete?(s.del.show(),s.del.click(function(){s.statusbar.hide().remove(),o.deleteCallback&&o.deleteCallback.call(this,a,s),n.selectedFiles-=l.length,c(o,n)})):s.del.hide()):(s.statusbar.hide("slow"),s.statusbar.remove()),o.showDownload&&(s.download.show(),s.download.click(function(){o.downloadCallback&&o.downloadCallback(a)})),t.remove()},error:function(e,a,r){s.cancel.remove(),D.pop(),s.abort.hide(),"abort"==e.statusText?(s.statusbar.hide("slow").remove(),c(o,n)):(o.onError.call(this,l,a,r,s),o.showStatusAfterError?(s.progressDiv.hide(),s.statusbar.append("<span class='"+o.errorClass+"'>ERROR: "+r+"</span>")):(s.statusbar.hide(),s.statusbar.remove()),n.selectedFiles-=l.length),t.remove()}};o.showPreview&&null!=d&&"image"==d.type.toLowerCase().split("/").shift()&&u(d,s.preview),o.autoSubmit?(t.ajaxForm(h),x.push(t),r()):(o.showCancel&&(s.cancel.show(),s.cancel.click(function(){x.splice(x.indexOf(t),1),p(n,l),t.remove(),s.statusbar.remove(),o.onCancel.call(n,l,s),n.selectedFiles-=l.length,c(o,n)})),t.ajaxForm(h))}var w=e.extend({url:"",method:"POST",enctype:"multipart/form-data",returnType:null,allowDuplicates:!0,duplicateStrict:!1,allowedTypes:"*",acceptFiles:"*",fileName:"file",formData:!1,dynamicFormData:!1,maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!1,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showFileSize:!0,showProgress:!1,nestedForms:!0,showDownload:!1,onLoad:function(){},onSelect:function(){return!0},onSubmit:function(){},onSuccess:function(){},onError:function(){},onCancel:function(){},onAbort:function(){},downloadCallback:!1,deleteCallback:!1,afterUploadAll:!1,serialize:!0,sequential:!1,sequentialCount:2,customProgressBar:!1,abortButtonClass:"ajax-file-upload-abort",cancelButtonClass:"ajax-file-upload-cancel",dragDropContainerClass:"ajax-upload-dragdrop",dragDropHoverClass:"state-hover",errorClass:"ajax-file-upload-error",uploadButtonClass:"ajax-file-upload",dragDropStr:"<span><b>Drag & Drop Files</b></span>",uploadStr:"Upload",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"is not allowed. Allowed extensions: ",duplicateErrorStr:"is not allowed. File already exists.",sizeErrorStr:"is not allowed. Allowed Max size: ",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:" is not allowed. Maximum allowed files are:",downloadStr:"Download",customErrorKeyStr:"jquery-upload-file-error",showQueueDiv:!1,statusBarWidth:400,dragdropWidth:400,showPreview:!1,previewHeight:"auto",previewWidth:"100%",extraHTML:!1,uploadQueuOrder:"top"},t);this.fileCounter=1,this.selectedFiles=0;var g="ajax-file-upload-"+(new Date).getTime();this.formGroup=g,this.errorLog=e("<div></div>"),this.responses=[],this.existingFileNames=[],a.formdata||(w.dragDrop=!1),a.formdata||(w.multiple=!1),e(this).html("");var C=this,b=e("<div>"+w.uploadStr+"</div>");e(b).addClass(w.uploadButtonClass),function F(){if(e.fn.ajaxForm){if(w.dragDrop){var a=e('<div class="'+w.dragDropContainerClass+'" style="vertical-align:top;"></div>').width(w.dragdropWidth);e(C).append(a),e(a).append(b),e(a).append(e(w.dragDropStr)),o(C,w,a)}else e(C).append(b);e(C).append(C.errorLog),C.container=w.showQueueDiv?e("#"+w.showQueueDiv):e("<div class='ajax-file-upload-container'></div>").insertAfter(e(C)),w.onLoad.call(this,C),h(C,g,w,b)}else window.setTimeout(F,10)}(),this.startUpload=function(){e("form").each(function(){e(this).hasClass(C.formGroup)&&x.push(e(this))}),x.length>=1&&r()},this.getFileCount=function(){return C.selectedFiles},this.stopUpload=function(){e("."+w.abortButtonClass).each(function(){e(this).hasClass(C.formGroup)&&e(this).click()}),e("."+w.cancelButtonClass).each(function(){e(this).hasClass(C.formGroup)&&e(this).click()})},this.cancelAll=function(){e("."+w.cancelButtonClass).each(function(){e(this).hasClass(C.formGroup)&&e(this).click()})},this.update=function(a){w=e.extend(w,a)},this.reset=function(e){C.fileCounter=1,C.selectedFiles=0,C.errorLog.html(""),0!=e&&C.container.html("")},this.remove=function(){C.container.html(""),e(C).remove()},this.createProgress=function(e,a,t){var r=new m(this,w);r.progressDiv.show(),r.progressbar.width("100%");var o="";o=w.showFileCounter?C.fileCounter+w.fileCounterStyle+e:e,w.showFileSize&&(o+=" ("+s(t)+")"),r.filename.html(o),C.fileCounter++,C.selectedFiles++,w.showPreview&&(r.preview.attr("src",a),r.preview.show()),w.showDownload&&(r.download.show(),r.download.click(function(){w.downloadCallback&&w.downloadCallback.call(C,[e])})),w.showDelete&&(r.del.show(),r.del.click(function(){r.statusbar.hide().remove();var a=[e];w.deleteCallback&&w.deleteCallback.call(this,a,r),C.selectedFiles-=1,c(w,C)}))},this.getResponses=function(){return this.responses};var x=[],D=[],S=!1;return this}}(jQuery);
8
+ !function(e){void 0==jQuery.fn.ajaxForm&&e.getScript(("https:"==document.location.protocol?"https://":"http://")+"malsup.github.io/jquery.form.js");var a={};a.fileapi=void 0!==e("<input type='file'/>").get(0).files,a.formdata=void 0!==window.FormData,e.fn.uploadFile=function(t){function r(){S||(S=!0,function e(){if(w.sequential||(w.sequentialCount=99999),0==x.length&&0==D.length)w.afterUploadAll&&w.afterUploadAll(C),S=!1;else{if(D.length<w.sequentialCount){var a=x.shift();void 0!=a&&(D.push(a),a.submit())}window.setTimeout(e,100)}}())}function o(a,t,r){r.on("dragenter",function(a){a.stopPropagation(),a.preventDefault(),e(this).addClass(t.dragDropHoverClass)}),r.on("dragover",function(a){a.stopPropagation(),a.preventDefault();var r=e(this);r.hasClass(t.dragDropContainerClass)&&!r.hasClass(t.dragDropHoverClass)&&r.addClass(t.dragDropHoverClass)}),r.on("drop",function(r){r.preventDefault(),e(this).removeClass(t.dragDropHoverClass),a.errorLog.html("");var o=r.originalEvent.dataTransfer.files;return!t.multiple&&o.length>1?void(t.showError&&e("<div class='"+t.errorClass+"'>"+t.multiDragErrorStr+"</div>").appendTo(a.errorLog)):void(0!=t.onSelect(o)&&l(t,a,o))}),r.on("dragleave",function(){e(this).removeClass(t.dragDropHoverClass)}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(a){a.stopPropagation(),a.preventDefault();var r=e(this);r.hasClass(t.dragDropContainerClass)||r.removeClass(t.dragDropHoverClass)}),e(document).on("drop",function(a){a.stopPropagation(),a.preventDefault(),e(this).removeClass(t.dragDropHoverClass)})}function s(e){var a="",t=e/1024;if(parseInt(t)>1024){var r=t/1024;a=r.toFixed(2)+" MB"}else a=t.toFixed(2)+" KB";return a}function i(a){var t=[];t="string"==jQuery.type(a)?a.split("&"):e.param(a).split("&");var r,o,s=t.length,i=[];for(r=0;s>r;r++)t[r]=t[r].replace(/\+/g," "),o=t[r].split("="),i.push([decodeURIComponent(o[0]),decodeURIComponent(o[1])]);return i}function l(a,t,r){for(var o=0;o<r.length;o++)if(n(t,a,r[o].name))if(a.allowDuplicates||!d(t,r[o].name))if(-1!=a.maxFileSize&&r[o].size>a.maxFileSize)a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.sizeErrorStr+s(a.maxFileSize)+"</div>").appendTo(t.errorLog);else if(-1!=a.maxFileCount&&t.selectedFiles>=a.maxFileCount)a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.maxFileCountErrorStr+a.maxFileCount+"</div>").appendTo(t.errorLog);else{t.selectedFiles++,t.existingFileNames.push(r[o].name);var l=a,p=new FormData,u=a.fileName.replace("[]","");p.append(u,r[o]);var c=a.formData;if(c)for(var h=i(c),f=0;f<h.length;f++)h[f]&&p.append(h[f][0],h[f][1]);l.fileData=p;var w=new m(t,a),g="";g=a.showFileCounter?t.fileCounter+a.fileCounterStyle+r[o].name:r[o].name,a.showFileSize&&(g+=" ("+s(r[o].size)+")"),w.filename.html(g);var C=e("<form style='display:block; position:absolute;left: 150px;' class='"+t.formGroup+"' method='"+a.method+"' action='"+a.url+"' enctype='"+a.enctype+"'></form>");C.appendTo("body");var b=[];b.push(r[o].name),v(C,l,w,b,t,r[o]),t.fileCounter++}else a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.duplicateErrorStr+"</div>").appendTo(t.errorLog);else a.showError&&e("<div class='"+a.errorClass+"'><b>"+r[o].name+"</b> "+a.extErrorStr+a.allowedTypes+"</div>").appendTo(t.errorLog)}function n(e,a,t){var r=a.allowedTypes.toLowerCase().split(/[\s,]+/g),o=t.split(".").pop().toLowerCase();return"*"!=a.allowedTypes&&jQuery.inArray(o,r)<0?!1:!0}function d(e,a){var t=!1;if(e.existingFileNames.length)for(var r=0;r<e.existingFileNames.length;r++)(e.existingFileNames[r]==a||w.duplicateStrict&&e.existingFileNames[r].toLowerCase()==a.toLowerCase())&&(t=!0);return t}function p(e,a){if(e.existingFileNames.length)for(var t=0;t<a.length;t++){var r=e.existingFileNames.indexOf(a[t]);-1!=r&&e.existingFileNames.splice(r,1)}}function u(e,a){if(e){a.show();var t=new FileReader;t.onload=function(e){a.attr("src",e.target.result)},t.readAsDataURL(e)}}function c(a,t){if(a.showFileCounter){var r=e(t.container).find(".ajax-file-upload-filename").length;t.fileCounter=r+1,e(t.container).find(".ajax-file-upload-filename").each(function(){var t=e(this).html().split(a.fileCounterStyle),o=(parseInt(t[0])-1,r+a.fileCounterStyle+t[1]);e(this).html(o),r--})}}function h(t,r,o,s){var i="ajax-upload-id-"+(new Date).getTime(),d=e("<form method='"+o.method+"' action='"+o.url+"' enctype='"+o.enctype+"'></form>"),p="<input type='file' id='"+i+"' name='"+o.fileName+"' accept='"+o.acceptFiles+"'/>";o.multiple&&(o.fileName.indexOf("[]")!=o.fileName.length-2&&(o.fileName+="[]"),p="<input type='file' id='"+i+"' name='"+o.fileName+"' accept='"+o.acceptFiles+"' multiple/>");var u=e(p).appendTo(d);u.change(function(){t.errorLog.html("");var i=(o.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(g=0;g<this.files.length;g++)i.push(this.files[g].name);if(0==o.onSelect(this.files))return}else{var p=e(this).val(),u=[];if(i.push(p),!n(t,o,p))return void(o.showError&&e("<div class='"+o.errorClass+"'><b>"+p+"</b> "+o.extErrorStr+o.allowedTypes+"</div>").appendTo(t.errorLog));if(u.push({name:p,size:"NA"}),0==o.onSelect(u))return}if(c(o,t),s.unbind("click"),d.hide(),h(t,r,o,s),d.addClass(r),o.serialize&&a.fileapi&&a.formdata){d.removeClass(r);var f=this.files;d.remove(),l(o,t,f)}else{for(var w="",g=0;g<i.length;g++)w+=o.showFileCounter?t.fileCounter+o.fileCounterStyle+i[g]+"<br>":i[g]+"<br>",t.fileCounter++;if(-1!=o.maxFileCount&&t.selectedFiles+i.length>o.maxFileCount)return void(o.showError&&e("<div class='"+o.errorClass+"'><b>"+w+"</b> "+o.maxFileCountErrorStr+o.maxFileCount+"</div>").appendTo(t.errorLog));t.selectedFiles+=i.length;var C=new m(t,o);C.filename.html(w),v(d,o,C,i,t,null)}}),o.nestedForms?(d.css({margin:0,padding:0}),s.css({position:"relative",overflow:"hidden",cursor:"default"}),u.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"100%",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),d.appendTo(s)):(d.appendTo(e("body")),d.css({margin:0,padding:0,display:"block",position:"absolute",left:"-250px"}),-1!=navigator.appVersion.indexOf("MSIE ")?s.attr("for",i):s.click(function(){u.click()}))}function f(a,t){return this.statusbar=e("<div class='ajax-file-upload-statusbar'></div>").width(t.statusBarWidth),this.preview=e("<img class='ajax-file-upload-preview' />").width(t.previewWidth).height(t.previewHeight).appendTo(this.statusbar).hide(),this.filename=e("<div class='ajax-file-upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='ajax-file-upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='ajax-file-upload-bar'></div>").appendTo(this.progressDiv),this.abort=e("<div>"+t.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div>"+t.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div>"+t.doneStr+"</div>").appendTo(this.statusbar).hide(),this.download=e("<div>"+t.downloadStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div>"+t.deletelStr+"</div>").appendTo(this.statusbar).hide(),this.abort.addClass("ajax-file-upload-red"),this.done.addClass("ajax-file-upload-green"),this.download.addClass("ajax-file-upload-green"),this.cancel.addClass("ajax-file-upload-red"),this.del.addClass("ajax-file-upload-red"),this}function m(a,t){var r=null;return r=t.customProgressBar?new t.customProgressBar(a,t):new f(a,t),r.abort.addClass(a.formGroup),r.abort.addClass(t.abortButtonClass),r.cancel.addClass(a.formGroup),r.cancel.addClass(t.cancelButtonClass),t.extraHTML&&(r.extraHTML=e("<div class='extrahtml'>"+t.extraHTML()+"</div>").insertAfter(r.filename)),"bottom"==t.uploadQueuOrder?e(a.container).append(r.statusbar):e(a.container).prepend(r.statusbar),r}function v(t,o,s,l,n,d){var h={cache:!1,contentType:!1,processData:!1,forceSync:!1,type:o.method,data:o.formData,formData:o.fileData,dataType:o.returnType,beforeSubmit:function(a,r,d){if(0!=o.onSubmit.call(this,l)){if(o.dynamicFormData){var u=i(o.dynamicFormData());if(u)for(var h=0;h<u.length;h++)u[h]&&(void 0!=o.fileData?d.formData.append(u[h][0],u[h][1]):d.data[u[h][0]]=u[h][1])}return o.extraHTML&&e(s.extraHTML).find("input,select,textarea").each(function(){void 0!=o.fileData?d.formData.append(e(this).attr("name"),e(this).val()):d.data[e(this).attr("name")]=e(this).val()}),!0}return s.statusbar.append("<div class='"+o.errorClass+"'>"+o.uploadErrorStr+"</div>"),s.cancel.show(),t.remove(),s.cancel.click(function(){x.splice(x.indexOf(t),1),p(n,l),s.statusbar.remove(),o.onCancel.call(n,l,s),n.selectedFiles-=l.length,c(o,n)}),!1},beforeSend:function(e){s.progressDiv.show(),s.cancel.hide(),s.done.hide(),o.showAbort&&(s.abort.show(),s.abort.click(function(){p(n,l),e.abort(),n.selectedFiles-=l.length,o.onAbort.call(n,l,s)})),s.progressbar.width(a.formdata?"1%":"5%")},uploadProgress:function(e,a,t,r){r>98&&(r=98);var i=r+"%";r>1&&s.progressbar.width(i),o.showProgress&&(s.progressbar.html(i),s.progressbar.css("text-align","center"))},success:function(a,r,i){if(s.cancel.remove(),D.pop(),"json"==o.returnType&&"object"==e.type(a)&&a.hasOwnProperty(o.customErrorKeyStr)){s.abort.hide();var d=a[o.customErrorKeyStr];return o.onError.call(this,l,200,d,s),o.showStatusAfterError?(s.progressDiv.hide(),s.statusbar.append("<span class='"+o.errorClass+"'>ERROR: "+d+"</span>")):(s.statusbar.hide(),s.statusbar.remove()),n.selectedFiles-=l.length,void t.remove()}n.responses.push(a),s.progressbar.width("100%"),o.showProgress&&(s.progressbar.html("100%"),s.progressbar.css("text-align","center")),s.abort.hide(),o.onSuccess.call(this,l,a,i,s),o.showStatusAfterSuccess?(o.showDone?(s.done.show(),s.done.click(function(){s.statusbar.hide("slow"),s.statusbar.remove()})):s.done.hide(),o.showDelete?(s.del.show(),s.del.click(function(){s.statusbar.hide().remove(),o.deleteCallback&&o.deleteCallback.call(this,a,s),n.selectedFiles-=l.length,c(o,n)})):s.del.hide()):(s.statusbar.hide("slow"),s.statusbar.remove()),o.showDownload&&(s.download.show(),s.download.click(function(){o.downloadCallback&&o.downloadCallback(a)})),t.remove()},error:function(e,a,r){s.cancel.remove(),D.pop(),s.abort.hide(),"abort"==e.statusText?(s.statusbar.hide("slow").remove(),c(o,n)):(o.onError.call(this,l,a,r,s),o.showStatusAfterError?(s.progressDiv.hide(),s.statusbar.append("<span class='"+o.errorClass+"'>ERROR: "+r+"</span>")):(s.statusbar.hide(),s.statusbar.remove()),n.selectedFiles-=l.length),t.remove()}};o.showPreview&&null!=d&&"image"==d.type.toLowerCase().split("/").shift()&&u(d,s.preview),o.autoSubmit?(t.ajaxForm(h),x.push(t),r()):(o.showCancel&&(s.cancel.show(),s.cancel.click(function(){x.splice(x.indexOf(t),1),p(n,l),t.remove(),s.statusbar.remove(),o.onCancel.call(n,l,s),n.selectedFiles-=l.length,c(o,n)})),t.ajaxForm(h))}var w=e.extend({url:"",method:"POST",enctype:"multipart/form-data",returnType:null,allowDuplicates:!0,duplicateStrict:!1,allowedTypes:"*",acceptFiles:"*",fileName:"file",formData:!1,dynamicFormData:!1,maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!1,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showFileSize:!0,showProgress:!1,nestedForms:!0,showDownload:!1,onLoad:function(){},onSelect:function(){return!0},onSubmit:function(){},onSuccess:function(){},onError:function(){},onCancel:function(){},onAbort:function(){},downloadCallback:!1,deleteCallback:!1,afterUploadAll:!1,serialize:!0,sequential:!1,sequentialCount:2,customProgressBar:!1,abortButtonClass:"ajax-file-upload-abort",cancelButtonClass:"ajax-file-upload-cancel",dragDropContainerClass:"ajax-upload-dragdrop",dragDropHoverClass:"state-hover",errorClass:"ajax-file-upload-error",uploadButtonClass:"ajax-file-upload",dragDropStr:"<span><b>Drag & Drop Files</b></span>",uploadStr:"Upload",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"is not allowed. Allowed extensions: ",duplicateErrorStr:"is not allowed. File already exists.",sizeErrorStr:"is not allowed. Allowed Max size: ",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:" is not allowed. Maximum allowed files are:",downloadStr:"Download",customErrorKeyStr:"jquery-upload-file-error",showQueueDiv:!1,statusBarWidth:400,dragdropWidth:400,showPreview:!1,previewHeight:"auto",previewWidth:"100%",extraHTML:!1,uploadQueuOrder:"top"},t);this.fileCounter=1,this.selectedFiles=0;var g="ajax-file-upload-"+(new Date).getTime();this.formGroup=g,this.errorLog=e("<div></div>"),this.responses=[],this.existingFileNames=[],a.formdata||(w.dragDrop=!1),a.formdata||(w.multiple=!1),e(this).html("");var C=this,b=e("<div>"+w.uploadStr+"</div>");e(b).addClass(w.uploadButtonClass),function F(){if(e.fn.ajaxForm){if(w.dragDrop){var a=e('<div class="'+w.dragDropContainerClass+'" style="vertical-align:top;"></div>').width(w.dragdropWidth);e(C).append(a),e(a).append(b),e(a).append(e(w.dragDropStr)),o(C,w,a)}else e(C).append(b);e(C).append(C.errorLog),C.container=w.showQueueDiv?e("#"+w.showQueueDiv):e("<div class='ajax-file-upload-container'></div>").insertAfter(e(C)),w.onLoad.call(this,C),h(C,g,w,b)}else window.setTimeout(F,10)}(),this.startUpload=function(){e("form").each(function(){e(this).hasClass(C.formGroup)&&x.push(e(this))}),x.length>=1&&r()},this.getFileCount=function(){return C.selectedFiles},this.stopUpload=function(){e("."+w.abortButtonClass).each(function(){e(this).hasClass(C.formGroup)&&e(this).click()}),e("."+w.cancelButtonClass).each(function(){e(this).hasClass(C.formGroup)&&e(this).click()})},this.cancelAll=function(){e("."+w.cancelButtonClass).each(function(){e(this).hasClass(C.formGroup)&&e(this).click()})},this.update=function(a){w=e.extend(w,a)},this.reset=function(e){C.fileCounter=1,C.selectedFiles=0,C.errorLog.html(""),0!=e&&C.container.html("")},this.remove=function(){C.container.html(""),e(C).remove()},this.createProgress=function(e,a,t){var r=new m(this,w);r.progressDiv.show(),r.progressbar.width("100%");var o="";o=w.showFileCounter?C.fileCounter+w.fileCounterStyle+e:e,w.showFileSize&&(o+=" ("+s(t)+")"),r.filename.html(o),C.fileCounter++,C.selectedFiles++,w.showPreview&&(r.preview.attr("src",a),r.preview.show()),w.showDownload&&(r.download.show(),r.download.click(function(){w.downloadCallback&&w.downloadCallback.call(C,[e])})),w.showDelete&&(r.del.show(),r.del.click(function(){r.statusbar.hide().remove();var a=[e];w.deleteCallback&&w.deleteCallback.call(this,a,r),C.selectedFiles-=1,c(w,C)}))},this.getResponses=function(){return this.responses};var x=[],D=[],S=!1;return this}}(jQuery);
@@ -30,6 +30,7 @@ class CamaleonCms::Admin::PostTagsController < CamaleonCms::AdminController
30
30
  def update
31
31
  if @post_tag.update(params[:post_tag])
32
32
  @post_tag.set_options_from_form(params[:meta]) if params[:meta].present?
33
+ @post_tag.set_field_values(params[:field_options])
33
34
  flash[:notice] = t('camaleon_cms.admin.post_type.message.updated')
34
35
  redirect_to action: :index
35
36
  else
@@ -43,6 +44,7 @@ class CamaleonCms::Admin::PostTagsController < CamaleonCms::AdminController
43
44
  @post_tag = @post_type.post_tags.new(data_term)
44
45
  if @post_tag.save
45
46
  @post_tag.set_options_from_form(params[:meta]) if params[:meta].present?
47
+ @post_tag.set_field_values(params[:field_options])
46
48
  flash[:notice] = t('camaleon_cms.admin.post_type.message.created')
47
49
  redirect_to action: :index
48
50
  else
@@ -9,6 +9,7 @@
9
9
  module CamaleonCms::Frontend::SeoHelper
10
10
  # add seo attributes to your page
11
11
  # you can pass custom data to overwrite default data generated by the system
12
+ # return hash of seo attributes used by the_head(...)
12
13
  def cama_the_seo(data = {})
13
14
  if is_home?
14
15
  data2 = {}
@@ -21,7 +22,7 @@ module CamaleonCms::Frontend::SeoHelper
21
22
  elsif is_post_type?
22
23
  data2 = {image: @cama_visited_post_type.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_post_type.the_title}", description: @cama_visited_post_type.the_excerpt, keywords: @cama_visited_post_type.the_keywords, object: @cama_visited_post_type }
23
24
  elsif is_post_tag?
24
- data2 = {image: @cama_visited_tag.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_tag.the_title}", description: @cama_visited_tag.the_excerpt, keywords: @cama_visited_tag.the_keywords, object: @cama_visited_tag }
25
+ data2 = {title: "#{current_site.the_title} | #{@cama_visited_tag.the_title}", description: @cama_visited_tag.the_excerpt, keywords: @cama_visited_tag.the_keywords, object: @cama_visited_tag }
25
26
  elsif is_category?
26
27
  data2 = {image: @cama_visited_category.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_category.the_title}", description: @cama_visited_category.the_excerpt, keywords: @cama_visited_category.the_keywords, object: @cama_visited_category }
27
28
  else
@@ -32,11 +33,13 @@ module CamaleonCms::Frontend::SeoHelper
32
33
 
33
34
  # permit to define seo attributes by code without hooks (check here for more attributes: https://github.com/kpumuk/meta-tags)
34
35
  # @Sample: cama_seo_settings({title: "my custom title", description: "my descr", keywords: "my keywords", image: 'my img url'})
36
+ # This values will be shown within the_head(...)
35
37
  def cama_seo_settings(options)
36
38
  @_cama_seo_setting_values ||= {}
37
39
  @_cama_seo_setting_values = @_cama_seo_setting_values.merge(options)
38
40
  end
39
41
 
42
+ private
40
43
  # create seo attributes with options + default attributes
41
44
  def cama_build_seo(options = {})
42
45
  options[:image] = current_site.get_option("screenshot", current_site.the_logo) unless options[:image].present?
@@ -71,9 +71,9 @@ module CamaleonCms::UploaderHelper
71
71
 
72
72
  # save file
73
73
  if settings[:same_name]
74
- partial_path = "#{"#{current_site.id}"}/#{"#{settings[:folder]}/" if settings[:folder].present?}#{settings[:filename]}"
74
+ partial_path = "#{current_site.upload_directory_name}/#{"#{settings[:folder]}/" if settings[:folder].present?}#{settings[:filename]}"
75
75
  else
76
- partial_path = "#{"#{current_site.id}"}/#{cama_uploader_check_name("#{"#{settings[:folder]}/" if settings[:folder].present?}#{settings[:filename]}")}"
76
+ partial_path = "#{current_site.upload_directory_name}/#{cama_uploader_check_name("#{"#{settings[:folder]}/" if settings[:folder].present?}#{settings[:filename]}")}"
77
77
  end
78
78
  partial_path = partial_path.gsub(/(\/){2,}/, "/")
79
79
  file = @fog_connection_bucket_dir.files.create({:key => partial_path, :body => uploaded_io, :public => true})
@@ -102,7 +102,7 @@ module CamaleonCms::UploaderHelper
102
102
  # sample: "owen/campaign-date-picker_1.png"
103
103
  def cama_uploader_destroy_file(file_path, destroy_thumb = true)
104
104
  cama_uploader_init_connection(true)
105
- file = @fog_connection_bucket_dir.files.head("#{current_site.id}/#{file_path}".gsub(/(\/){2,}/, "/"))
105
+ file = @fog_connection_bucket_dir.files.head("#{current_site.upload_directory_name}/#{file_path}".gsub(/(\/){2,}/, "/"))
106
106
  _file = cama_uploader_parse_file(file)
107
107
  if destroy_thumb && _file["format"] == "image" && File.extname(file_path) != ".gif" # destroy thumb
108
108
  cama_uploader_destroy_file("#{File.dirname(file_path)}/#{cama_parse_for_thumb_name(file.key)}", false) rescue ""
@@ -114,16 +114,16 @@ module CamaleonCms::UploaderHelper
114
114
  def cama_uploader_destroy_folder(folder)
115
115
  cama_uploader_init_connection(true)
116
116
  if @fog_connection.class.name.include?("AWS")
117
- dir = @fog_connection.directories.get(@fog_connection_hook_res[:bucket_name], prefix: "#{current_site.id}/#{folder}".gsub(/(\/){2,}/, "/"))
117
+ dir = @fog_connection.directories.get(@fog_connection_hook_res[:bucket_name], prefix: "#{current_site.upload_directory_name}/#{folder}".gsub(/(\/){2,}/, "/"))
118
118
  dir.files.each{|f| f.destroy }
119
119
  end
120
- @fog_connection_bucket_dir.files.head("#{current_site.id}/#{folder}/".gsub(/(\/){2,}/, "/")).destroy rescue ""
120
+ @fog_connection_bucket_dir.files.head("#{current_site.upload_directory_name}/#{folder}/".gsub(/(\/){2,}/, "/")).destroy rescue ""
121
121
  end
122
122
 
123
123
  # add a new folder in fog
124
124
  def cama_uploader_add_folder(folder)
125
125
  cama_uploader_init_connection(true)
126
- key = "#{current_site.id}/#{folder}/".split("/").clean_empty.join("/")
126
+ key = "#{current_site.upload_directory_name}/#{folder}/".split("/").clean_empty.join("/")
127
127
  key += '/_tmp.txt' unless @fog_connection.class.name.include?("AWS")
128
128
  @fog_connection_bucket_dir.files.create({:key => key, content: "", :public => true})
129
129
  end
@@ -132,9 +132,9 @@ module CamaleonCms::UploaderHelper
132
132
  def cama_uploader_init_connection(clear_cache = false)
133
133
  server = current_site.get_option("filesystem_type", "local")
134
134
  @fog_connection_hook_res ||= {server: server, connection: nil, thumb_folder_name: "thumb", bucket_name: server == "local" ? "media" : current_site.get_option("filesystem_s3_bucket_name"), thumb: {w: 100, h: 100}}; hooks_run("on_uploader", @fog_connection_hook_res)
135
- case server
135
+ case @fog_connection_hook_res[:server]
136
136
  when "local"
137
- Dir.mkdir(Rails.root.join("public", "media").to_s) unless Dir.exist?(Rails.root.join("public", "media").to_s)
137
+ Dir.mkdir(Rails.root.join("public", @fog_connection_hook_res[:bucket_name]).to_s) unless Dir.exist?(Rails.root.join("public", @fog_connection_hook_res[:bucket_name]).to_s)
138
138
  @fog_connection ||= !@fog_connection_hook_res[:connection].present? ? Fog::Storage.new({ :local_root => Rails.root.join("public").to_s, :provider => 'Local', endpoint: (root_url rescue cama_root_url) }) : @fog_connection_hook_res[:connection]
139
139
  when "s3"
140
140
  @fog_connection ||= !@fog_connection_hook_res[:connection].present? ? Fog::Storage.new({ :aws_access_key_id => current_site.get_option("filesystem_s3_access_key"), :provider => 'AWS', aws_secret_access_key: current_site.get_option("filesystem_s3_secret_key"), :region => current_site.get_option("filesystem_region") }) : @fog_connection_hook_res[:connection]
@@ -150,11 +150,11 @@ module CamaleonCms::UploaderHelper
150
150
  cama_uploader_init_connection()
151
151
  files = @fog_connection_bucket_dir.files
152
152
  res = partial_path
153
- if files.head("#{current_site.id}/#{res}".gsub(/(\/){2,}/, "/")).present?
153
+ if files.head("#{current_site.upload_directory_name}/#{res}".gsub(/(\/){2,}/, "/")).present?
154
154
  dirname = "#{File.dirname(partial_path)}/" if partial_path.include?("/")
155
155
  (1..999).each do |i|
156
156
  res = "#{dirname}#{File.basename(partial_path, File.extname(partial_path))}_#{i}#{File.extname(partial_path)}"
157
- break unless files.head("#{current_site.id}/#{res}".gsub(/(\/){2,}/, "/")).present?
157
+ break unless files.head("#{current_site.upload_directory_name}/#{res}".gsub(/(\/){2,}/, "/")).present?
158
158
  end
159
159
  end
160
160
  res.gsub(/(\/){2,}/, "/")
@@ -165,7 +165,7 @@ module CamaleonCms::UploaderHelper
165
165
  def cama_media_find_folder(path = "")
166
166
  cama_uploader_init_connection(true)
167
167
 
168
- prefix = "#{current_site.id}/#{path}/".gsub(/(\/){2,}/, "/")
168
+ prefix = "#{current_site.upload_directory_name}/#{path}/".gsub(/(\/){2,}/, "/")
169
169
  res = {folders: {}, files: []}
170
170
 
171
171
  @fog_connection.directories.get(@fog_connection_hook_res[:bucket_name], prefix: prefix).files.each do |file|
@@ -205,9 +205,14 @@ class CamaleonCms::Site < CamaleonCms::TermTaxonomy
205
205
  end
206
206
  end
207
207
 
208
- # return upload directory for this site
208
+ # return upload directory for this site (deprecated for cloud support)
209
209
  def upload_directory(inner_directory = nil)
210
- File.join(Rails.public_path, "/media/#{self.id}", inner_directory.to_s)
210
+ File.join(Rails.public_path, "/media/#{PluginRoutes.static_system_info["media_slug_folder"] ? self.slug : self.id}", inner_directory.to_s)
211
+ end
212
+
213
+ # return the directory name where to upload file for this site
214
+ def upload_directory_name
215
+ "#{PluginRoutes.static_system_info["media_slug_folder"] ? self.slug : self.id}"
211
216
  end
212
217
 
213
218
  # return an available slug for a new post
@@ -237,7 +242,7 @@ class CamaleonCms::Site < CamaleonCms::TermTaxonomy
237
242
  unless PluginRoutes.system_info["users_share_sites"]
238
243
  CamaleonCms::User.where(site_id: self.id).destroy_all
239
244
  end
240
- FileUtils.rm_rf(upload_directory) # destroy current media directory
245
+ FileUtils.rm_rf(File.join(Rails.public_path, "/media/#{upload_directory_name}").to_s) # destroy current media directory
241
246
  users.destroy_all unless PluginRoutes.system_info["users_share_sites"] # destroy all users assigned fot this site
242
247
  end
243
248
 
@@ -17,9 +17,8 @@
17
17
  <%= f.label t('camaleon_cms.admin.table.description') %><br>
18
18
  <%= f.text_area :description, :class => "form-control", :rows => 4 %>
19
19
  </div>
20
-
20
+ <%= render partial: "camaleon_cms/admin/settings/custom_fields/render", locals: {record: @post_tag, field_groups: @post_type.get_field_groups({kind: "PostTag"})} %>
21
21
  </div>
22
-
23
22
  <div class="panel-footer">
24
23
  <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
25
24
  <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit')%></button>
@@ -1,136 +1,144 @@
1
1
  <%= javascript_include_tag "camaleon_cms/admin/custom_fields_form" %>
2
2
  <div class="page-title">
3
- <h2><span class="fa fa-cog"></span> <%= @field_group.new_record? ? t('camaleon_cms.admin.settings.new_custom_field_group') : "#{t('camaleon_cms.admin.settings.new_custom_field_group')}: #{@field_group.name} "%> </h2>
3
+ <h2><span class="fa fa-cog"></span> <%= @field_group.new_record? ? t('camaleon_cms.admin.settings.new_custom_field_group') : "#{t('camaleon_cms.admin.settings.new_custom_field_group')}: #{@field_group.name} "%> </h2>
4
4
  </div>
5
5
 
6
6
  <!-- PAGE CONTENT WRAPPER -->
7
7
  <div class="page-content-wrap" id="cama_custom_field_form" data-group_class_name="<%= @field_group.object_class %>,<%= @field_group.objectid %>">
8
- <div class="row">
9
- <%= form_for @field_group, as: "custom_field_group", url:{action: @field_group.new_record? ? :create : :update}, html: {class: 'validate-custom-field cama_ajax_request'} do |f| %>
10
- <div class="col-md-4">
11
- <div class="panel panel-default">
12
- <div class="panel-heading">
13
- <h3 class="panel-title"><%= t('camaleon_cms.admin.settings.details_custom_field_group') %></h3>
14
- </div>
15
- <div class="panel-body">
16
- <%= render partial: 'layouts/camaleon_cms/admin/form_error', locals: {data: @field_group} %>
17
- <div class="form-group">
18
- <%= f.label t('camaleon_cms.admin.table.name') %><br>
19
- <%= f.text_field :name, :class => "form-control required" %>
20
- </div>
21
- <div class="form-group">
22
- <%= f.label t('camaleon_cms.admin.table.description') %><br>
23
- <%= f.text_area :description, :class => "form-control" %>
24
- </div>
25
- <div class="form-group">
26
- <%= f.label t('camaleon_cms.admin.settings.where_display_group') %><br>
27
- <select id="select_assign_group" name="custom_field_group[assign_group]" class="form-control required">
28
- <option value="">&nbsp;</option>
29
- <optgroup label="<%= t('camaleon_cms.admin.settings.posts_in') %>">
30
- <% current_site.post_types.each do |pt| pt = pt.decorate; value = "PostType_Post,#{pt.id}" %>
31
- <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_posts')}"+ pt.the_title %>"><%= pt.the_title %></option>
32
- <% end %>
33
- </optgroup>
8
+ <div class="row">
9
+ <%= form_for @field_group, as: "custom_field_group", url:{action: @field_group.new_record? ? :create : :update}, html: {class: 'validate-custom-field cama_ajax_request'} do |f| %>
10
+ <div class="col-md-4">
11
+ <div class="panel panel-default">
12
+ <div class="panel-heading">
13
+ <h3 class="panel-title"><%= t('camaleon_cms.admin.settings.details_custom_field_group') %></h3>
14
+ </div>
15
+ <div class="panel-body">
16
+ <%= render partial: 'layouts/camaleon_cms/admin/form_error', locals: {data: @field_group} %>
17
+ <div class="form-group">
18
+ <%= f.label t('camaleon_cms.admin.table.name') %><br>
19
+ <%= f.text_field :name, :class => "form-control required" %>
20
+ </div>
21
+ <div class="form-group">
22
+ <%= f.label t('camaleon_cms.admin.table.description') %><br>
23
+ <%= f.text_area :description, :class => "form-control" %>
24
+ </div>
25
+ <div class="form-group">
26
+ <%= f.label t('camaleon_cms.admin.settings.where_display_group') %><br>
27
+ <select id="select_assign_group" name="custom_field_group[assign_group]" class="form-control required">
28
+ <option value="">&nbsp;</option>
29
+ <optgroup label="<%= t('camaleon_cms.admin.settings.posts_in') %>">
30
+ <% current_site.post_types.each do |pt| pt = pt.decorate; value = "PostType_Post,#{pt.id}" %>
31
+ <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_posts')}"+ pt.the_title %>"><%= pt.the_title %></option>
32
+ <% end %>
33
+ </optgroup>
34
34
 
35
- <optgroup label="<%= t('camaleon_cms.admin.settings.categories_in') %>">
36
- <% current_site.post_types.each do |pt| pt = pt.decorate; value = "PostType_Category,#{pt.id}" %>
37
- <% if pt.manage_categories? %>
38
- <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_categories')}"+ pt.the_title %>"><%= pt.the_title %></option>
39
- <% end %>
40
- <% end %>
41
- </optgroup>
35
+ <optgroup label="<%= t('camaleon_cms.admin.settings.categories_in') %>">
36
+ <% current_site.post_types.each do |pt| pt = pt.decorate; value = "PostType_Category,#{pt.id}" %>
37
+ <% if pt.manage_categories? %>
38
+ <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_categories')}"+ pt.the_title %>"><%= pt.the_title %></option>
39
+ <% end %>
40
+ <% end %>
41
+ </optgroup>
42
42
 
43
- <optgroup label="<%= t('camaleon_cms.admin.settings.others') %>">
44
- <% value = "User,#{current_site.id}" %>
45
- <option value="<%= value %>" data-help="<%= t('camaleon_cms.admin.settings.tooltip.add_custom_field_users') %>"><%= t('camaleon_cms.admin.sidebar.users') %></option>
46
- <% value = "Site,#{current_site.id}" %>
47
- <option value="<%= value %>" data-help="<%= t('camaleon_cms.admin.settings.tooltip.add_custom_field_sites') %>"><%= t('camaleon_cms.admin.sidebar.site_settings') %></option>
48
- <% @_extra_models_for_fields.each do |model| %>
49
- <% value = "#{model.name},#{current_site.id}" %>
50
- <option value="<%= value %>" data-help=""><%= model.name %></option><%= model.name %>
51
- <% end %>
52
- </optgroup>
43
+ <optgroup label="<%= t('camaleon_cms.admin.settings.post_tags_in', default: 'Post Tags In') %>">
44
+ <% current_site.post_types.each do |pt| pt = pt.decorate; value = "PostType_PostTag,#{pt.id}" %>
45
+ <% if pt.manage_tags? %>
46
+ <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_tags', default: 'Add Custom Field in Post Tags of ')}"+ pt.the_title %>"><%= pt.the_title %></option>
47
+ <% end %>
48
+ <% end %>
49
+ </optgroup>
53
50
 
54
- <optgroup label="<%= t('camaleon_cms.admin.sidebar.themes') %>">
55
- <option value="Theme,<%= current_theme.id %>" data-help=""><%= current_theme.name %></option>
56
- </optgroup>
51
+ <optgroup label="<%= t('camaleon_cms.admin.settings.others') %>">
52
+ <% value = "User,#{current_site.id}" %>
53
+ <option value="<%= value %>" data-help="<%= t('camaleon_cms.admin.settings.tooltip.add_custom_field_users') %>"><%= t('camaleon_cms.admin.sidebar.users') %></option>
54
+ <% value = "Site,#{current_site.id}" %>
55
+ <option value="<%= value %>" data-help="<%= t('camaleon_cms.admin.settings.tooltip.add_custom_field_sites') %>"><%= t('camaleon_cms.admin.sidebar.site_settings') %></option>
56
+ <% @_extra_models_for_fields.each do |model| %>
57
+ <% value = "#{model.name},#{current_site.id}" %>
58
+ <option value="<%= value %>" data-help=""><%= model.name %></option><%= model.name %>
59
+ <% end %>
60
+ </optgroup>
57
61
 
58
- <optgroup label="<%= t('camaleon_cms.admin.sidebar.menus') %>">
59
- <% current_site.nav_menus.each do |menu| %>
60
- <option value="NavMenu,<%= menu.id %>" data-help=""><%= menu.name %></option>
61
- <% end %>
62
- </optgroup>
62
+ <optgroup label="<%= t('camaleon_cms.admin.sidebar.themes') %>">
63
+ <option value="Theme,<%= current_theme.id %>" data-help=""><%= current_theme.name %></option>
64
+ </optgroup>
63
65
 
64
- <optgroup label="<%= t('camaleon_cms.admin.sidebar.widgets') %>">
65
- <% current_site.widgets.each do |widget| %>
66
- <% value = "#{widget.class.name},#{widget.id}" %>
67
- <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_widget')}"+ widget.name %>"><%= widget.name %></option>
68
- <% end %>
69
- </optgroup>
70
- <option value="_post_simple" >Select Post Simple</option>
71
- </select>
72
- <select id="select_post_simple" name="custom_field_group[assign_group]" class="form-control required" style="display: none" disabled>
73
- <% current_site.post_types.each do |pt| pt = pt.decorate %>
74
- <optgroup label="<%= pt.the_title %>">
75
- <% pt.posts.visible_frontend.each do |post| value = "#{post.class.name},#{post.id}".parseCamaClass; post = post.decorate %>
76
- <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_posts')}"+ post.the_title %>"><%= post.the_title %></option>
77
- <% end %>
78
- </optgroup>
79
- <% end %>
80
- </select>
81
- <input id="select_assign_group_caption" type="hidden" name="custom_field_group[caption]"/>
82
- <div id="select_assign_group_help"></div>
83
- </div>
84
- </div>
85
- <div class="panel-footer">
86
- <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
87
- <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
88
- </div>
89
- </div>
90
- </div>
91
- <div class="col-md-5">
92
- <div class="panel panel-default">
93
- <div class="panel-heading">
94
- <h3 class="panel-title"><%= t('camaleon_cms.admin.settings.fields') %></h3>
95
- </div>
96
- <div class="panel-body padding-0">
97
- <% fields = @field_group.new_record? ? [] : @field_group.fields %>
98
- <ul id="sortable-fields" class="clear">
99
- <% fields.each do |field| @item_value = field; @item_options_value = field.options; @key = field.options[:field_key] %>
100
- <li class="item">
101
- <%= render "get_items" %>
102
- </li>
103
- <% end %>
104
- </ul>
105
- </div>
106
- <div class="panel-footer hidden">
107
- <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
108
- <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
109
- </div>
110
- </div>
111
- </div>
66
+ <optgroup label="<%= t('camaleon_cms.admin.sidebar.menus') %>">
67
+ <% current_site.nav_menus.each do |menu| %>
68
+ <option value="NavMenu,<%= menu.id %>" data-help=""><%= menu.name %></option>
69
+ <% end %>
70
+ </optgroup>
112
71
 
113
- <div class="col-md-3">
114
- <div class="panel panel-default">
115
- <div class="panel-heading">
116
- <h3 class="panel-title"><%= t('camaleon_cms.admin.settings.available_fields')%></h3>
72
+ <!--optgroup label="<%#= t('camaleon_cms.admin.sidebar.widgets') %>">
73
+ <%# current_site.widgets.each do |widget| %>
74
+ <%# value = "#{widget.class.name},#{widget.id}" %>
75
+ <option value="<%#= value %>" data-help="<%#= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_widget')}"+ widget.name %>"><%#= widget.name %></option>
76
+ <%# end %>
77
+ </optgroup -->
78
+ <option value="_post_simple" >Select Post Simple</option>
79
+ </select>
80
+ <select id="select_post_simple" name="custom_field_group[assign_group]" class="form-control required" style="display: none" disabled>
81
+ <% current_site.post_types.each do |pt| pt = pt.decorate %>
82
+ <optgroup label="<%= pt.the_title %>">
83
+ <% pt.posts.visible_frontend.each do |post| value = "#{post.class.name},#{post.id}".parseCamaClass; post = post.decorate %>
84
+ <option value="<%= value %>" data-help="<%= "#{t('camaleon_cms.admin.settings.tooltip.add_custom_field_posts')}"+ post.the_title %>"><%= post.the_title %></option>
85
+ <% end %>
86
+ </optgroup>
87
+ <% end %>
88
+ </select>
89
+ <input id="select_assign_group_caption" type="hidden" name="custom_field_group[caption]"/>
90
+ <div id="select_assign_group_help"></div>
91
+ </div>
92
+ </div>
93
+ <div class="panel-footer">
94
+ <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
95
+ <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
96
+ </div>
97
+ </div>
117
98
  </div>
118
- <div class="panel-body">
119
- <div id="content-items-default" class="form-group input-group-sm">
120
- <% cf_get_items.each do |i,item| %>
121
- <% next if item[:key] == "select_eval" %>
122
- <a id="item-<%= item[:key] %>" class="btn btn-default" href="<%= get_items_cama_admin_settings_custom_fields_path(item[:key]) %>" style="margin-bottom: 4px"><%= item[:label] %></a>
123
- <% end %>
124
- </div>
99
+ <div class="col-md-5">
100
+ <div class="panel panel-default">
101
+ <div class="panel-heading">
102
+ <h3 class="panel-title"><%= t('camaleon_cms.admin.settings.fields') %></h3>
103
+ </div>
104
+ <div class="panel-body padding-0">
105
+ <% fields = @field_group.new_record? ? [] : @field_group.fields %>
106
+ <ul id="sortable-fields" class="clear">
107
+ <% fields.each do |field| @item_value = field; @item_options_value = field.options; @key = field.options[:field_key] %>
108
+ <li class="item">
109
+ <%= render "get_items" %>
110
+ </li>
111
+ <% end %>
112
+ </ul>
113
+ </div>
114
+ <div class="panel-footer hidden">
115
+ <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
116
+ <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
117
+ </div>
118
+ </div>
125
119
  </div>
126
- <div class="panel-footer hidden">
127
- <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
128
- <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
120
+
121
+ <div class="col-md-3">
122
+ <div class="panel panel-default">
123
+ <div class="panel-heading">
124
+ <h3 class="panel-title"><%= t('camaleon_cms.admin.settings.available_fields')%></h3>
125
+ </div>
126
+ <div class="panel-body">
127
+ <div id="content-items-default" class="form-group input-group-sm">
128
+ <% cf_get_items.each do |i,item| %>
129
+ <% next if item[:key] == "select_eval" %>
130
+ <a id="item-<%= item[:key] %>" class="btn btn-default" href="<%= get_items_cama_admin_settings_custom_fields_path(item[:key]) %>" style="margin-bottom: 4px"><%= item[:label] %></a>
131
+ <% end %>
132
+ </div>
133
+ </div>
134
+ <div class="panel-footer hidden">
135
+ <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
136
+ <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
137
+ </div>
138
+ </div>
129
139
  </div>
130
- </div>
131
- </div>
132
- <% end %>
133
- </div>
140
+ <% end %>
141
+ </div>
134
142
  </div>
135
143
 
136
144
 
@@ -9,7 +9,9 @@
9
9
  "default_user_role": "client", // default user role for all new users
10
10
  "users_share_sites": true, //(boolean) true: permit to share users between sites, false: All users are assigned for an unique site.
11
11
  "db_prefix": "", // prefix name for database tables
12
- "relative_url_root": "" // URL prefix, for example to get http://localhost:3000/blog/, this should be "blog"
12
+ "relative_url_root": "", // URL prefix, for example to get http://localhost:3000/blog/, this should be "blog"
13
+
14
+ "media_slug_folder": false // permit to use site slug for upload media folder instead of site-id
13
15
  }
14
16
 
15
17
  // Note: after any change in this file, you need to restart your server to apply changes.
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -7,6 +7,7 @@ module Themes::ThemeClass::MainHelper
7
7
  # here your code on save settings for current site, by default params[:theme_fields] is auto saved into theme
8
8
  # Also, you can save your extra values added in admin/settings.html.erb
9
9
  # sample: theme.set_meta("my_key", params[:my_value])
10
+ theme.set_field_values(params[:field_options])
10
11
  end
11
12
 
12
13
  # callback called after theme installed
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <!-- META SECTION -->
5
- <title>My theme</title>
5
+ <title><%= current_site.the_title %></title>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
7
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1" />
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camaleon_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo Diaz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt