Make WordPress Core

Changeset 29082


Ignore:
Timestamp:
07/10/2014 11:05:05 PM (12 years ago)
Author:
wonderboymusic
Message:

Media Grid: make the Uploader closable.

Props ericlewis.
See #24716.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/css/media-views.css

    r29081 r29082  
    10191019.attachments-browser .uploader-inline-content {
    10201020        top: 0;
     1021}
     1022
     1023.uploader-inline .close {
     1024        background-color: transparent;
     1025        border: 0;
     1026        cursor: pointer;
     1027        height: 48px;
     1028        position: absolute;
     1029        right: 20px;
     1030        text-align: center;
     1031        top: 20px;
     1032        width: 50px;
     1033        z-index: 1;
     1034}
     1035
     1036.uploader-inline .close:before {
     1037        font: normal 30px/50px 'dashicons' !important;
     1038        color: #777;
     1039        display: inline-block;
     1040        content: '\f335';
     1041        font-weight: 300;
    10211042}
    10221043
  • trunk/src/wp-includes/js/media-views.js

    r29081 r29082  
    36553655                template:  media.template('uploader-inline'),
    36563656
     3657                events: {
     3658                        'click .close': 'hide'
     3659                },
     3660
    36573661                initialize: function() {
    36583662                        _.defaults( this.options, {
    36593663                                message: '',
    3660                                 status:  true
     3664                                status:  true,
     3665                                canClose: false
    36613666                        });
    36623667
     
    36783683                prepare: function() {
    36793684                        var suggestedWidth = this.controller.state().get('suggestedWidth'),
    3680                                 suggestedHeight = this.controller.state().get('suggestedHeight');
     3685                                suggestedHeight = this.controller.state().get('suggestedHeight'),
     3686                                data = {};
     3687
     3688                        data.canClose = this.options.canClose;
    36813689
    36823690                        if ( suggestedWidth && suggestedHeight ) {
    3683                                 return {
    3684                                         suggestedWidth: suggestedWidth,
    3685                                         suggestedHeight: suggestedHeight
    3686                                 };
    3687                         }
     3691                                data.suggestedWidth = suggestedWidth;
     3692                                data.suggestedHeight = suggestedHeight;
     3693                        }
     3694                        return data;
    36883695                },
    36893696                /**
     
    37463753                        this.refresh();
    37473754                        return this;
     3755                },
     3756                show: function() {
     3757                        this.$el.removeClass( 'hidden' );
     3758                },
     3759                hide: function() {
     3760                        this.$el.addClass( 'hidden' );
    37483761                }
     3762
    37493763        });
    37503764
     
    57235737                                controller: this.controller,
    57245738                                status:     false,
    5725                                 message:    l10n.noItemsFound
     5739                                message:    l10n.noItemsFound,
     5740                                canClose:   this.controller.isModeActive( 'grid' )
    57265741                        });
    57275742
     
    57315746
    57325747                showUploader: function() {
    5733                         this.uploader.$el.removeClass( 'hidden' );
     5748                        this.uploader.show();
    57345749                },
    57355750
  • trunk/src/wp-includes/media-template.php

    r29078 r29082  
    161161        <script type="text/html" id="tmpl-uploader-inline">
    162162                <# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
     163                <# if ( data.canClose ) { #>
     164                <button class="close dashicons dashicons-no"><span class="screen-reader-text">Close overlay</span></button>
     165                <# } #>
    163166                <div class="uploader-inline-content {{ messageClass }}">
    164167                <# if ( data.message ) { #>
Note: See TracChangeset for help on using the changeset viewer.