WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/04/2014 04:47:40 AM (6 years ago)
Author:
wonderboymusic
Message:

Make media grid text fields (data) toggle-able. Checking/unchecking is saved in user settings cookie.

See #24716.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media-template.php

    r28993 r28995  
    230230    </script>
    231231
     232    <script type="text/html" id="tmpl-media-grid-field-options">
     233        <label class="setting">
     234            <span><?php _e( 'Name' ); ?></span>
     235            <input type="checkbox" data-setting="title" {{ '' === getUserSetting( 'hidegridtitle' ) && 'checked' }} />
     236        </label>
     237        <label class="setting">
     238            <span><?php _e( 'Attached to' ); ?></span>
     239            <input type="checkbox" data-setting="uploadedTo" {{ '' === getUserSetting( 'hidegriduploadedTo' ) && 'checked' }} />
     240        </label>
     241        <label class="setting">
     242            <span><?php _e( 'Date' ); ?></span>
     243            <input type="checkbox" data-setting="dateFormatted" {{ '' === getUserSetting( 'hidegriddateFormatted' ) && 'checked' }} />
     244        </label>
     245        <label class="setting">
     246            <span><?php _e( 'Mime-type' ); ?></span>
     247            <input type="checkbox" data-setting="mime" {{ '' === getUserSetting( 'hidegridmime' ) && 'checked' }} />
     248        </label>
     249    </script>
     250
    232251    <script type="text/html" id="tmpl-uploader-status">
    233252        <h3><?php _e( 'Uploading' ); ?></h3>
     
    419438        if ( _.contains( data.controller.options.mode, 'grid' ) ) { #>
    420439        <div class="data-fields">
    421         <# _.each( data.showAttachmentFields, function( field ) { #>
    422             <div class="data-field data-{{ field }}"><#
     440        <# _.each( data.showAttachmentFields, function( field ) {
     441            var className = 'data-field data-hidden';
     442            if ( '' === getUserSetting( 'hidegrid' + field ) ) {
     443                className = 'data-field data-visible';
     444            }
     445        #>
     446            <div class="{{ className }} data-{{ field }}"><#
    423447                if ( 'uploadedTo' === field ) {
    424448                    if ( data[field] ) {
    425                     #><?php _e( 'Uploaded To:' ) ?><#
     449                    #><?php _e( 'Uploaded To: ' ) ?><#
    426450                    } else {
    427451                    #><?php _e( 'Unattached' ) ?><#
Note: See TracChangeset for help on using the changeset viewer.