Commit 317cc9d9d059dc276a73a51cfe6e9e604e3d1362

Authored by Karpikau Andrei
1 parent 9aa1273d

check issues

@@ -1357,7 +1357,10 @@ $('body').on('click', '.copy-to-memory', function(){ @@ -1357,7 +1357,10 @@ $('body').on('click', '.copy-to-memory', function(){
1357 document.execCommand('copy'); 1357 document.execCommand('copy');
1358 document.body.removeChild(el); 1358 document.body.removeChild(el);
1359 1359
1360 - bootbox.alert('URL copied to memory'); 1360 + $.notify('URL is saved in the clipboard', {
  1361 + status: 'info',
  1362 + pos:"top-right"
  1363 + });
1361 1364
1362 return false; 1365 return false;
1363 }); 1366 });
@@ -1550,9 +1553,15 @@ var initAjaxFileUpload = function(selector){ @@ -1550,9 +1553,15 @@ var initAjaxFileUpload = function(selector){
1550 var key = $(data.jqXHR.responseXML).find("Key").text(); 1553 var key = $(data.jqXHR.responseXML).find("Key").text();
1551 var url = 'https://' + fileInputElem.data('host') + '/' + key; 1554 var url = 'https://' + fileInputElem.data('host') + '/' + key;
1552 1555
  1556 +
  1557 +
1553 // create hidden field 1558 // create hidden field
1554 - var input = $("<input />", {type: 'hidden', class: 'hidden-file-link', name: fileInputElem.attr('name'), value: url}) 1559 + var input = $("<input />", {type: 'hidden', class: 'hidden-file-link', name: fileInputElem.attr('name'), value: url});
  1560 + var inputFileType = $("<input />", {type: 'hidden', class: 'hidden-file-link', name: fileInputElem.attr('name').replace('image_link', 'file_type'), value: fileInputElem.data('files')[0].file.type})
  1561 +
1555 form.append(input); 1562 form.append(input);
  1563 + form.append(inputFileType);
  1564 +
1556 fileInputElem.val(''); 1565 fileInputElem.val('');
1557 }, 1566 },
1558 fail: function (e, data) { 1567 fail: function (e, data) {
@@ -1732,7 +1741,11 @@ jQuery(document).ready(function(){ @@ -1732,7 +1741,11 @@ jQuery(document).ready(function(){
1732 //fontFamily: fonts, 1741 //fontFamily: fonts,
1733 //fontSize: fontSizes, 1742 //fontSize: fontSizes,
1734 height:400, 1743 height:400,
1735 - toolbarButtons: ['underline', 'fontFamily', 'fontSize', 'color', 'paragraphStyle', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR', 'insertLink', 'cms-image', 'insertTable', 'undo', 'redo', 'clearFormatting', 'html', 'fullscreen'] 1744 + toolbarButtons: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  1745 + toolbarButtonsMD: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  1746 + toolbarButtonsSM: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  1747 + toolbarButtonsXS: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  1748 + imageEditButtons: ['imageAlign', 'imageCaption', 'imageRemove', '|', 'linkOpen', 'linkEdit', 'linkRemove', '-', 'imageDisplay', 'imageStyle', 'imageSize'],
1736 }); 1749 });
1737 1750
1738 } 1751 }
@@ -1801,6 +1814,9 @@ jQuery(document).ready(function(){ @@ -1801,6 +1814,9 @@ jQuery(document).ready(function(){
1801 1814
1802 $template.find('.remove').click(function(){ 1815 $template.find('.remove').click(function(){
1803 $(this).closest('.new-image-wrapper').find('.fileinput-remove').trigger('click'); 1816 $(this).closest('.new-image-wrapper').find('.fileinput-remove').trigger('click');
  1817 + if($('#new_images .card').length == 0){
  1818 + $('#gallery_form form input:submit').addClass('not-visible');
  1819 + }
1804 return false; 1820 return false;
1805 }); 1821 });
1806 $('#gallery_form form #new_images').append($template); 1822 $('#gallery_form form #new_images').append($template);
@@ -1915,6 +1931,23 @@ jQuery(document).ready(function(){ @@ -1915,6 +1931,23 @@ jQuery(document).ready(function(){
1915 source: tagnames.ttAdapter() 1931 source: tagnames.ttAdapter()
1916 } 1932 }
1917 }); 1933 });
  1934 + $this.find('.filestyle').each(function() {
  1935 + var $this = $(this), options = {
  1936 + 'input' : $this.attr('data-input') !== 'false',
  1937 + 'htmlIcon' : $this.attr('data-icon'),
  1938 + 'buttonBefore' : $this.attr('data-buttonBefore') === 'true',
  1939 + 'disabled' : $this.attr('data-disabled') === 'true',
  1940 + 'size' : $this.attr('data-size'),
  1941 + 'text' : $this.attr('data-text'),
  1942 + 'btnClass' : $this.attr('data-btnClass'),
  1943 + 'badge' : $this.attr('data-badge') === 'true',
  1944 + 'dragdrop' : $this.attr('data-dragdrop') !== 'false',
  1945 + 'badgeName' : $this.attr('data-badgeName'),
  1946 + 'placeholder': $this.attr('data-placeholder')
  1947 + };
  1948 +
  1949 + $this.filestyle(options);
  1950 + });
1918 initAjaxFileUpload($this); 1951 initAjaxFileUpload($this);
1919 1952
1920 }).on('hidden.bs.modal', function (e) { 1953 }).on('hidden.bs.modal', function (e) {
@@ -135,7 +135,11 @@ jQuery(document).ready(function(){ @@ -135,7 +135,11 @@ jQuery(document).ready(function(){
135 $selector.find('.page_html_content').froalaEditor({ 135 $selector.find('.page_html_content').froalaEditor({
136 theme: 'gray', 136 theme: 'gray',
137 height: 400, 137 height: 400,
138 - toolbarButtons: ['underline', 'fontFamily', 'fontSize', 'color', 'paragraphStyle', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR', 'insertLink', 'cms-image', 'insertTable', 'undo', 'redo', 'clearFormatting', 'html', 'fullscreen'] 138 + toolbarButtons: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  139 + toolbarButtonsMD: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  140 + toolbarButtonsSM: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  141 + toolbarButtonsXS: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  142 + imageEditButtons: ['imageAlign', 'imageCaption', 'imageRemove', '|', 'linkOpen', 'linkEdit', 'linkRemove', '-', 'imageDisplay', 'imageStyle', 'imageSize'],
139 }); 143 });
140 } 144 }
141 145
@@ -293,7 +293,11 @@ var csrf_token = $('meta[name=csrf-token]').attr('content'), @@ -293,7 +293,11 @@ var csrf_token = $('meta[name=csrf-token]').attr('content'),
293 $('.page_html_content').froalaEditor({ 293 $('.page_html_content').froalaEditor({
294 theme: 'gray', 294 theme: 'gray',
295 height: 400, 295 height: 400,
296 - toolbarButtons: ['underline', 'fontFamily', 'fontSize', 'color', 'paragraphStyle', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR', 'insertLink', 'cms-image', 'insertTable', 'undo', 'redo', 'clearFormatting', 'html', 'fullscreen'] 296 + toolbarButtons: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  297 + toolbarButtonsMD: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  298 + toolbarButtonsSM: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  299 + toolbarButtonsXS: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  300 + imageEditButtons: ['imageAlign', 'imageCaption', 'imageRemove', '|', 'linkOpen', 'linkEdit', 'linkRemove', '-', 'imageDisplay', 'imageStyle', 'imageSize'],
297 }); 301 });
298 302
299 ajaxFileUpload = initAjaxFileUpload($data); 303 ajaxFileUpload = initAjaxFileUpload($data);
@@ -341,7 +345,11 @@ var csrf_token = $('meta[name=csrf-token]').attr('content'), @@ -341,7 +345,11 @@ var csrf_token = $('meta[name=csrf-token]').attr('content'),
341 $data.find('.page_html_content').froalaEditor({ 345 $data.find('.page_html_content').froalaEditor({
342 theme: 'gray', 346 theme: 'gray',
343 height: 400, 347 height: 400,
344 - toolbarButtons: ['underline', 'fontFamily', 'fontSize', 'color', 'paragraphStyle', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR', 'insertLink', 'cms-image', 'insertTable', 'undo', 'redo', 'clearFormatting', 'html', 'fullscreen'] 348 + toolbarButtons: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  349 + toolbarButtonsMD: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  350 + toolbarButtonsSM: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  351 + toolbarButtonsXS: ['fontFamily', 'fontSize', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'subscript', 'superscript', '|' ,'color', 'paragraphStyle', 'paragraphFormat', 'align', '|', 'formatOL', 'formatUL', 'outdent', 'indent', '|', 'quote', 'insertHR', '|', 'cms-image', '|', 'insertTable', '-', 'undo', 'redo', 'clearFormatting', '|', 'html', 'fullscreen'],
  352 + imageEditButtons: ['imageAlign', 'imageCaption', 'imageRemove', '|', 'linkOpen', 'linkEdit', 'linkRemove', '-', 'imageDisplay', 'imageStyle', 'imageSize'],
345 }); 353 });
346 354
347 $('#accordion').append($data); 355 $('#accordion').append($data);
@@ -67,7 +67,7 @@ module Kanjai @@ -67,7 +67,7 @@ module Kanjai
67 end 67 end
68 68
69 def permitted_params 69 def permitted_params
70 - params.permit(:image => [:title, :tag_list, :image_link]) 70 + params.permit(:image => [:title, :tag_list, :image_link, :file_type])
71 end 71 end
72 end 72 end
73 end 73 end
@@ -43,7 +43,8 @@ @@ -43,7 +43,8 @@
43 <%= f.file_field :image_link, :class => "form-control filestyle", 'data-url' => @s3_direct_post.url, 'data-form-data' => @s3_direct_post.fields.to_json, 'data-host' => URI.parse(@s3_direct_post.url).host , 'data-type' => 'zip', 'data-classbutton' => 'btn btn-secondary', 'data-classinput' => "form-control inline", 'data-icon' => "<span class='fa fa-upload mr-2'></span>" %> 43 <%= f.file_field :image_link, :class => "form-control filestyle", 'data-url' => @s3_direct_post.url, 'data-form-data' => @s3_direct_post.fields.to_json, 'data-host' => URI.parse(@s3_direct_post.url).host , 'data-type' => 'zip', 'data-classbutton' => 'btn btn-secondary', 'data-classinput' => "form-control inline", 'data-icon' => "<span class='fa fa-upload mr-2'></span>" %>
44 </div> 44 </div>
45 </div> 45 </div>
46 - </fieldset> 46 + </fieldset>
  47 +
47 48
48 <div class="card-footer mt-20"> 49 <div class="card-footer mt-20">
49 <div class="clearfix"> 50 <div class="clearfix">
@@ -83,11 +83,10 @@ en: @@ -83,11 +83,10 @@ en:
83 default_use: "Use Default" 83 default_use: "Use Default"
84 kanjai/page_template: 84 kanjai/page_template:
85 title: "Title" 85 title: "Title"
86 - attachment: "Template file"  
87 updated_at: "Updated at" 86 updated_at: "Updated at"
88 unzip: "Status" 87 unzip: "Status"
89 notice: "Notice" 88 notice: "Notice"
90 - attachment: "Template" 89 + attachment: "Template (as ZIP file)"
91 kanjai/image: 90 kanjai/image:
92 name: "Name" 91 name: "Name"
93 tags: "Tags" 92 tags: "Tags"
1 module Kanjai 1 module Kanjai
2 - VERSION = "0.0.153" 2 + VERSION = "0.0.154"
3 end 3 end