Make WordPress Core

Ticket #19570: 19570.13.diff

File 19570.13.diff, 10.0 KB (added by lessbloat, 12 years ago)
  • wp-admin/js/post-formats.js

     
    11(function($){
    2 
    32        // Post formats selection
    4         $('.post-format-select a').on( 'click.post-format', function(e) {
     3        $('.post-format-options a').on( 'click', function(e){
    54                var $this = $(this),
    65                        editor,
    76                        body,
     7                        parent = $this.parent(),
    88                        format = $this.data('wp-format'),
    99                        container = $('#post-body-content');
    1010
    11                 $('.post-format-select a.nav-tab-active').removeClass('nav-tab-active');
    12                 $this.addClass('nav-tab-active').blur();
     11                parent.find('a.active').removeClass('active');
     12                $this.addClass('active');
     13                $('#icon-edit').removeClass(postFormats.currentPostFormat).addClass(format);
    1314                $('#post_format').val(format);
    1415
    1516                container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' );
    1617                container.addClass('wp-format-' + format);
     18                $('#title').focus();
    1719
     20                // Update description line
     21                $('.post-format-description').html($this.data('description'));
     22
    1823                if ( typeof tinymce != 'undefined' ) {
    1924                        editor = tinymce.get('content');
    2025
     
    2530                        }
    2631                }
    2732
     33                postFormats.currentPostFormat = format;
     34
    2835                e.preventDefault();
     36        }).on('mouseenter focusin', function () {
     37                $('.post-format-tip').html( $(this).prop('title') );
     38        }).on('mouseleave focusout', function () {
     39                $('.post-format-tip').html( $('.post-format-options a.active').prop('title') );
    2940        });
    30 
    3141})(jQuery);
  • wp-admin/edit-form-advanced.php

     
    138138        $format_class = " class='wp-format-{$post_format}'";
    139139}
    140140
     141if ( post_type_supports( $post_type, 'post-formats' ) ) {
     142        $all_post_formats = array(
     143                'standard' => array (
     144                        'description' => __('Add a title and description for your post below.')
     145                ),
     146                'image' => array (
     147                        'description' => __('Select an image using the Add Media button below.')
     148                ),
     149                'gallery' => array (
     150                        'description' => __('Use the Add Media button below to select images for your gallery.')
     151                ),
     152                'link' => array (
     153                        'description' => __('Add a link URL below.')
     154                ),
     155                'video' => array (
     156                        'description' => __('Paste a video embed URL below, or click Add Media to upload a video.')
     157                ),
     158                'audio' => array (
     159                        'description' => __('Paste an audio embed URL below, or click Add Media to upload an audio file.')
     160                ),
     161                'chat' => array (
     162                        'description' => __('Paste a chat transcript below.')
     163                ),
     164                'status' => array (
     165                        'description' => __('What are you up to?  Enter your status message below.')
     166                ),
     167                'quote' => array (
     168                        'description' => __('Enter a quote below.')
     169                ),
     170                'aside' => array (
     171                        'description' => __('Enter a quick thought or side topic below.')
     172                )
     173        );
     174        $post_format_options = '';
     175
     176        foreach ( $all_post_formats as $slug => $attr ) {
     177                $class = '';
     178                if ( $post_format == $slug ) {
     179                        $class = 'class="active"';
     180                        $active_post_type_slug = $slug;
     181                        $active_post_type_label = ucfirst( $slug );
     182                        $active_post_format_description = $attr['description'];
     183                }
     184
     185                $post_format_options .= '<a ' . $class . ' href="?format=' . $slug . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( sprintf( __( '%s Post' ), $slug ) ) . '"><div class="' . $slug . '"></div></a>';
     186        }
     187}
     188
     189$current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) );
     190wp_localize_script( 'post', 'postFormats', $current_post_format );
     191
    141192if ( post_type_supports($post_type, 'page-attributes') )
    142193        add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
    143194
     
    337388?>
    338389
    339390<div id="poststuff">
    340 
    341 <?php
    342 if ( post_type_supports( $post_type, 'post-formats' ) ) {
    343         $all_post_formats = get_post_format_strings();
    344 
    345         echo '<h2 class="nav-tab-wrapper post-format-select">';
    346 
    347         foreach ( $all_post_formats as $slug => $label ) {
    348                 if ( $post_format == $slug )
    349                         $class = 'nav-tab nav-tab-active';
    350                 else
    351                         $class = 'nav-tab';
    352 
    353                 echo '<a class="' . $class . '" href="?format=' . $slug . '" data-wp-format="' . $slug . '">' . $label . '</a>';
    354         }
    355 
    356         echo '</h2>';
    357 }
    358 ?>
    359 
    360391<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    361392<div id="post-body-content"<?php echo $format_class; ?>>
    362393
     394<?php if ( ! empty( $post_format_options ) ) : ?>
     395<div class="post-format-options">
     396        <span class="post-format-tip">Standard Post</span>
     397        <?php echo $post_format_options; ?>
     398</div>
     399<div class="post-format-description"><?php echo $active_post_format_description; ?></div>
     400<?php endif; ?>
     401
    363402<?php if ( post_type_supports($post_type, 'title') ) { ?>
    364403<div id="titlediv">
    365404<div id="titlewrap">
  • wp-admin/css/wp-admin-rtl.css

     
    2323        11.1 - Custom Fields
    2424        11.2 - Post Revisions
    2525        11.3 - Featured Images
     26        11.4 - Post Format Selection
    262712.0 - Categories
    272813.0 - Tags
    282914.0 - Media Screen
     
    964965}
    965966
    966967/*------------------------------------------------------------------------------
     968  11.4 - Post format selection
     969------------------------------------------------------------------------------*/
     970
     971.post-format-options a {
     972        border-left: 1px solid #ebebeb;
     973        border-right: none;
     974}
     975
     976.post-format-options a:first-child {
     977        -webkit-border-bottom-left-radius: 0;
     978        -webkit-border-top-left-radius: 0;
     979        border-bottom-left-radius: 0;
     980        border-top-left-radius: 0;
     981}
     982
     983.post-format-options a:last-child {
     984        -webkit-border-bottom-right-radius: 3px;
     985        -webkit-border-top-right-radius: 3px;
     986        border-bottom-right-radius: 3px;
     987        border-top-right-radius: 3px;
     988}
     989
     990.post-format-tip {
     991        float: left;
     992}
     993
     994/*------------------------------------------------------------------------------
    967995  12.0 - Categories
    968996------------------------------------------------------------------------------*/
    969997
  • wp-admin/css/wp-admin.css

     
    2424        11.1 - Custom Fields
    2525        11.2 - Post Revisions
    2626        11.3 - Featured Images
     27        11.4 - Post Format Selection
    272812.0 - Categories
    282913.0 - Tags
    293014.0 - Media Screen
     
    40614062}
    40624063
    40634064/*------------------------------------------------------------------------------
     4065  11.4 - Post format selection
     4066------------------------------------------------------------------------------*/
     4067
     4068#icon-edit.standard {
     4069        background: url(../images/post-formats32.png) no-repeat -3px -4px;
     4070}
     4071
     4072#icon-edit.image {
     4073        background: url(../images/post-formats32.png) no-repeat  -43px -4px;
     4074}
     4075
     4076#icon-edit.gallery {
     4077        background: url(../images/post-formats32.png) no-repeat -83px -4px;
     4078}
     4079
     4080#icon-edit.audio {
     4081        background: url(../images/post-formats32.png) no-repeat -123px -4px;
     4082}
     4083
     4084#icon-edit.video {
     4085        background: url(../images/post-formats32.png) no-repeat -163px -4px;
     4086}
     4087
     4088#icon-edit.chat {
     4089        background: url(../images/post-formats32.png) no-repeat -202px -4px;
     4090}
     4091
     4092#icon-edit.status {
     4093        background: url(../images/post-formats32.png) no-repeat -242px -4px;
     4094}
     4095
     4096#icon-edit.aside {
     4097        background: url(../images/post-formats32.png) no-repeat -282px -4px;
     4098}
     4099
     4100#icon-edit.quote {
     4101        background: url(../images/post-formats32.png) no-repeat -322px -4px;
     4102}
     4103
     4104#icon-edit.link {
     4105        background: url(../images/post-formats32.png) no-repeat -362px -4px;
     4106}
     4107
     4108.post-format-description {
     4109        color: #666;
     4110        margin: 10px 0;
     4111}
     4112
     4113.post-format-options {
     4114        height: 29px;
     4115        background: #f9f9f9;
     4116        border: 1px solid #dfdfdf;
     4117        -webkit-border-radius: 3px;
     4118        border-radius: 3px;
     4119        margin: 0 0 9px 1px;
     4120        padding: 0;
     4121}
     4122
     4123.post-format-options a {
     4124        border-right: 1px solid #ebebeb;
     4125        display: inline-block;
     4126        height: 16px;
     4127        width: 16px;
     4128        padding: 6px;
     4129        position: relative;
     4130        text-decoration: none;
     4131}
     4132
     4133.post-format-options a:first-child {
     4134        -webkit-border-bottom-left-radius: 3px;
     4135        -webkit-border-top-left-radius: 3px;
     4136        border-bottom-left-radius: 3px;
     4137        border-top-left-radius: 3px;
     4138}
     4139
     4140.post-format-options a.active,
     4141.post-format-options a:focus,
     4142.post-format-options a:hover {
     4143        background: #fff;
     4144        outline: none;
     4145        opacity: 1;
     4146}
     4147
     4148.post-format-options a div {
     4149        height: 16px;
     4150        width: 16px;
     4151        opacity: 0.4;
     4152}
     4153
     4154.post-format-options a.active div,
     4155.post-format-options a:focus div,
     4156.post-format-options a:hover div {
     4157        opacity: 1;
     4158}
     4159
     4160.post-format-options .standard {
     4161        background: url(../images/post-formats.png) no-repeat -8px -8px;
     4162}
     4163
     4164.post-format-options .image {
     4165        background: url(../images/post-formats.png) no-repeat -40px -8px;
     4166}
     4167
     4168.post-format-options .gallery {
     4169        background: url(../images/post-formats.png) no-repeat -72px -8px;
     4170}
     4171
     4172.post-format-options .audio {
     4173        background: url(../images/post-formats.png) no-repeat -104px -8px;
     4174}
     4175
     4176.post-format-options .video {
     4177        background: url(../images/post-formats.png) no-repeat -136px -8px;
     4178}
     4179
     4180.post-format-options .chat {
     4181        background: url(../images/post-formats.png) no-repeat -168px -8px;
     4182}
     4183
     4184.post-format-options .status {
     4185        background: url(../images/post-formats.png) no-repeat -200px -8px;
     4186}
     4187
     4188.post-format-options .aside {
     4189        background: url(../images/post-formats.png) no-repeat -232px -8px;
     4190}
     4191
     4192.post-format-options .quote {
     4193        background: url(../images/post-formats.png) no-repeat -264px -8px;
     4194}
     4195
     4196.post-format-options .link {
     4197        background: url(../images/post-formats.png) no-repeat -296px -8px;
     4198}
     4199
     4200.post-format-tip {
     4201        color: #999;
     4202        font-size: 14px;
     4203        float: right;
     4204        padding: 6px 10px;
     4205        text-transform: capitalize;
     4206}
     4207
     4208/*------------------------------------------------------------------------------
    40644209  12.0 - Categories
    40654210------------------------------------------------------------------------------*/
    40664211