diff --git a/web/concrete/blocks/image_slider/form_setup_html.php b/web/concrete/blocks/image_slider/form_setup_html.php index 16511e1a897..d7ae803bd31 100644 --- a/web/concrete/blocks/image_slider/form_setup_html.php +++ b/web/concrete/blocks/image_slider/form_setup_html.php @@ -16,6 +16,22 @@ }); } + var attachSortDesc = function($obj) { + $obj.click(function(){ + var myContainer = $(this).closest($('.ccm-image-slider-entry')); + myContainer.insertAfter(myContainer.next('.ccm-image-slider-entry')); + doSortCount(); + }); + } + + var attachSortAsc = function($obj) { + $obj.click(function(){ + var myContainer = $(this).closest($('.ccm-image-slider-entry')); + myContainer.insertBefore(myContainer.prev('.ccm-image-slider-entry')); + doSortCount(); + }); + } + var attachFileManagerLaunch = function($obj) { $obj.click(function(){ var oldLauncher = $(this); @@ -23,7 +39,8 @@ ConcreteFileManager.getFileDetails(data.fID, function(r) { jQuery.fn.dialog.hideLoader(); var file = r.files[0]; - oldLauncher.html(''); + console.log(file.resultsThumbnailImg); + oldLauncher.html(file.resultsThumbnailImg); oldLauncher.next('.image-fID').val(file.fID) }); }); @@ -41,7 +58,7 @@ sliderEntriesContainer.append(_templateSlide({ fID: '', - image_url: 'getURL();?>', + image_url: 'getThumbnailURL('file_manager_listing');?>', image_url: '', @@ -55,14 +72,9 @@ doSortCount(); - //sliderEntriesContainer.sortable({ - // stop: function( event, ui ) { - // doSortCount(); // recount every time icon divs are resorted. - // } - //}); - $('.ccm-add-image-slider-entry').click(function(){ - var newSlide = sliderEntriesContainer.append(_templateSlide({ + var thisModal = $(this).closest('.ui-dialog-content'); + sliderEntriesContainer.append(_templateSlide({ fID: '', title: '', link_url: '', @@ -71,14 +83,20 @@ sort_order: '', image_url: '' })); - $(newSlide).find('.redactor-content').redactor({ + var newSlide = $('.ccm-image-slider-entry').last(); + thisModal.scrollTop(newSlide.offset().top); + newSlide.find('.redactor-content').redactor({ minHeight: '200' }); - attachDelete($(newSlide).find('.ccm-delete-image-slider-entry')); - attachFileManagerLaunch($(newSlide).find('.ccm-pick-slide-image')); + attachDelete(newSlide.find('.ccm-delete-image-slider-entry')); + attachFileManagerLaunch(newSlide.find('.ccm-pick-slide-image')); + attachSortDesc(newSlide.find('i.fa-sort-desc')); + attachSortAsc(newSlide.find('i.fa-sort-asc')); doSortCount(); }); attachDelete($('.ccm-delete-image-slider-entry')); + attachSortAsc($('i.fa-sort-asc')); + attachSortDesc($('i.fa-sort-desc')); attachFileManagerLaunch($('.ccm-pick-slide-image')); $(function() { // activate redactors $('.redactor-content').redactor({ @@ -124,10 +142,22 @@ - .ccm-image-slider-block-container i.fa-arrows { + .ccm-image-slider-block-container i.fa-sort-asc { position: absolute; top: 10px; right: 10px; + cursor: pointer; + } + + .ccm-image-slider-block-container i:hover { + color: #5cb85c; + } + + .ccm-image-slider-block-container i.fa-sort-desc { + position: absolute; + top: 15px; + cursor: pointer; + right: 10px; }
@@ -150,7 +180,8 @@