templates/form.php 0000644 00000006441 15073233406 0010226 0 ustar 00
>
css/admin-rtl.min.css 0000644 00000000244 15073233406 0010522 0 ustar 00 .gallery-widget-thumbs-wrapper{margin:-5px 0 .3em}.gallery-widget-thumbs img{background-color:#fff;border:1px solid #ccc;float:right;margin:0 0 5px 5px;padding:2px} css/rtl/admin-rtl.css 0000644 00000000406 15073233406 0010541 0 ustar 00 /* This file was automatically generated on Mar 22 2013 21:33:14 */ .gallery-widget-thumbs-wrapper { margin: -5px 0 0.3em 0; } .gallery-widget-thumbs img { border: 1px solid #ccc; padding: 2px; background-color: #fff; margin: 0 0 5px 5px; float: right; } css/admin.min.css 0000644 00000000243 15073233406 0007722 0 ustar 00 .gallery-widget-thumbs-wrapper{margin:-5px 0 .3em}.gallery-widget-thumbs img{background-color:#fff;border:1px solid #ccc;float:left;margin:0 5px 5px 0;padding:2px} css/admin-rtl.css 0000644 00000000310 15073233406 0007732 0 ustar 00 .gallery-widget-thumbs-wrapper { margin: -5px 0 0.3em 0; } .gallery-widget-thumbs img { border: 1px solid #ccc; padding: 2px; background-color: #fff; margin: 0 0 5px 5px; float: right; } css/admin.css 0000644 00000000300 15073233406 0007132 0 ustar 00 .gallery-widget-thumbs-wrapper { margin: -5px 0 0.3em 0; } .gallery-widget-thumbs img { border: 1px solid #ccc; padding: 2px; background-color: #fff; margin: 0 5px 5px 0; float: left; } js/admin.js 0000644 00000014463 15073233406 0006621 0 ustar 00 /* global _wpMediaViewsL10n, _wpGalleryWidgetAdminSettings */ ( function ( $ ) { var $ids; var $thumbs; $( function () { $( document.body ).on( 'click', '.gallery-widget-choose-images', function ( event ) { event.preventDefault(); var widget_form = $( this ).closest( 'form, .form' ); $ids = widget_form.find( '.gallery-widget-ids' ); $thumbs = widget_form.find( '.gallery-widget-thumbs' ); var idsString = $ids.val(); var attachments = getAttachments( idsString ); var selection = null; var editing = false; if ( attachments ) { selection = getSelection( attachments ); editing = true; } var options = { state: 'gallery-edit', title: wp.media.view.l10n.addMedia, multiple: true, editing: editing, selection: selection, }; var workflow = getWorkflow( options ); workflow.open(); } ); // Setup an onchange handler to toggle various options when changing style. The different style options // require different form inputs to be presented in the widget; this event will keep the UI in sync // with the selected style $( '.widget-inside' ).on( 'change', '.gallery-widget-style', setupStyleOptions ); // Setup the Link To options for all forms currently on the page. Does the same as the onChange handler, but // is called once to display the correct form inputs for each widget on the page setupStyleOptions(); } ); var media = wp.media, l10n; // Link any localized strings. l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n; /** * wp.media.view.MediaFrame.GalleryWidget * * This behavior can be very nearly had by setting the workflow's state to 'gallery-edit', but * we cannot use the custom WidgetGalleryEdit controller with it (must overide createStates(), * which is necessary to disable the sidebar gallery settings in the media browser) */ media.view.MediaFrame.GalleryWidget = media.view.MediaFrame.Post.extend( { createStates: function () { var options = this.options; // `CollectionEdit` and `CollectionAdd` were only introduced in r27214-core, // so they may not be available yet. if ( 'CollectionEdit' in media.controller ) { this.states.add( [ new media.controller.CollectionEdit( { type: 'image', collectionType: 'gallery', title: l10n.editGalleryTitle, SettingsView: media.view.Settings.Gallery, library: options.selection, editing: options.editing, menu: 'gallery', } ), new media.controller.CollectionAdd( { type: 'image', collectionType: 'gallery', title: l10n.addToGalleryTitle, } ), ] ); } else { // If `CollectionEdit` is not available, then use the old approach. if ( ! ( 'WidgetGalleryEdit' in media.controller ) ) { // Remove the gallery settings sidebar when editing widgets. media.controller.WidgetGalleryEdit = media.controller.GalleryEdit.extend( { gallerySettings: function (/*browser*/) { return; }, } ); } this.states.add( [ new media.controller.WidgetGalleryEdit( { library: options.selection, editing: options.editing, menu: 'gallery', } ), new media.controller.GalleryAdd( {} ), ] ); } }, } ); function setupStyleOptions() { $( '.widget-inside .gallery-widget-style' ).each( function (/*i*/) { var style = $( this ).val(); var form = $( this ).parents( 'form' ); switch ( style ) { case 'slideshow': form.find( '.gallery-widget-link-wrapper' ).hide(); form.find( '.gallery-widget-columns-wrapper' ).hide(); break; default: form.find( '.gallery-widget-link-wrapper' ).show(); form.find( '.gallery-widget-columns-wrapper' ).show(); } } ); } /** * Take a given Selection of attachments and a thumbs wrapper div (jQuery object) * and fill it with thumbnails */ function setupThumbs( selection, wrapper ) { wrapper.empty(); var imageSize = _wpGalleryWidgetAdminSettings.thumbSize; selection.each( function ( model ) { var sizedUrl = model.get( 'url' ) + '?w=' + imageSize + '&h=' + imageSize + '&crop=true'; var thumb = jQuery( '