Changeset 785449
- Timestamp:
- 10/09/2013 05:49:27 PM (11 years ago)
- Location:
- dashboard/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
dashboard/trunk/css/quickdraft.css
r784283 r785449 6 6 #dashboard_quick_draft .drafts, 7 7 #dashboard_quick_draft .easy-blogging { 8 margin: 0 12px 10px;8 padding: 0 12px; 9 9 } 10 10 … … 17 17 #dashboard_quick_draft form { 18 18 border-bottom: 1px solid #eee; 19 overflow: hidden; 19 20 } 20 21 … … 26 27 } 27 28 28 /* @todo: Position media buttons? Ignore media buttons? */ 29 .wp-media-buttons, 30 #publishing-action, 31 p.submit [type="reset"] { 32 display: none; 33 } 34 35 .initial-form #title-wrap, 36 .initial-form #tags-input-wrap, 29 .initial-form #description-wrap, 37 30 .initial-form p.submit { 38 31 display: none; … … 48 41 } 49 42 #title-wrap #title-prompt-text, 50 .textarea-wrap #content-prompt-text, 51 #tags-input-wrap #tags-input-prompt-text { 43 .textarea-wrap #content-prompt-text { 52 44 color: #BBB; 53 45 } … … 62 54 } 63 55 64 #tags-input-wrap {65 margin-right: 95px;66 }67 #tags-input-wrap #tags-input-prompt-text,68 #tags-input-wrap #tags-input {69 padding: 4px 6px;70 font-size: 1em;71 line-height: 18px;72 }73 74 56 #title-wrap #title { 75 57 margin: 0 0 10px; … … 78 60 margin: 0 0 10px; 79 61 padding: 6px 7px; 80 }81 #tags-input-wrap #tags-input {82 margin: 0 0 10px;83 padding: 4px 6px;84 62 } 85 63 … … 108 86 border: none; 109 87 } 88 89 #draft-list li { 90 margin-bottom: 1em; 91 } 92 93 #draft-list p { 94 margin: 0; 95 } -
dashboard/trunk/css/wpnews.css
r784802 r785449 1 1 #dashboard_rss .inside { 2 padding: 0 0 12px;2 padding: 0; 3 3 } 4 4 … … 16 16 .rss-widget:last-child { 17 17 border-bottom: none; 18 margin-bottom: 0;19 padding-bottom: 0;20 18 } 21 19 … … 33 31 34 32 body #dashboard-widgets .postbox form .submit { 35 margin: 0 ;33 margin: 0 0 12px; 36 34 } -
dashboard/trunk/js/quickdraft.js
r784283 r785449 1 var quickPressLoad; 1 2 2 3 3 (function ($) { 4 var quickPressLoad; 4 5 /* QuickPress */ 5 6 quickPressLoad = function() { 6 7 var act = $('#quickpost-action'), t; 7 8 t = $('#quick-press').submit( function() { 8 9 10 11 if ( 'post' == act.val()) {12 act.val( 'post-quickpress-publish' );13 }14 15 $.post( t.attr( 'action' ), t.serializeArray(), function( data ) {16 // Replace the form, and prepend the published post.17 $('#quick-press').html( $(data).filter('#quick-press').html() ).removeClass('initial-form');18 $('#quick-press').find('#save-post').addClass('button-primary');19 $('#quick-press').prepend( $(data).filter('div.updated'));20 $(data).find('li').prependTo("#draft-list");21 22 $('#dashboard_quick_draft #publishing-action .spinner').hide();23 $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', false);24 quickPressLoad();25 });26 27 9 $('#dashboard_quick_draft #publishing-action .spinner').show(); 10 $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', true); 11 12 $.post( t.attr( 'action' ), t.serializeArray(), function( data ) { 13 // Replace the form, and prepend the published post. 14 $('#dashboard_quick_draft .inside').html( data ); 15 quickPressLoad(); 16 highlightLatestPost(); 17 }); 18 19 function highlightLatestPost () { 20 var latestPost = $('#draft-list li').first(); 21 latestPost.css('background', '#fffbe5'); 22 setTimeout(function () { 23 latestPost.css('background', 'none'); 24 }, 1000); 25 } 26 27 return false; 28 } ); 28 29 29 30 $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); … … 49 50 }); 50 51 }); 51 52 53 52 54 53 $('#quick-press').on( 'click focusin', function() { 55 $("# title-wrap, #tags-input-wrap, p.submit").show(200);54 $("#description-wrap, p.submit").slideDown(200); 56 55 wpActiveEditor = 'content'; 57 56 }); -
dashboard/trunk/quickdraft.php
r784283 r785449 9 9 } 10 10 11 add_action( 'admin_post_new-quickdraft-post', 'dashboard_plugin_quickdraft_admin_post' ); 12 function dashboard_plugin_quickdraft_admin_post() { 13 $post = get_post( $_REQUEST['post_ID'] ); 14 check_admin_referer( 'add-' . $post->post_type ); 15 edit_post(); 16 return wp_dashboard_quick_draft(); 17 } 18 11 19 // The QuickDraft widget display and creation of drafts 12 20 function wp_dashboard_quick_draft() { 13 21 global $post_ID; 14 15 if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) {16 $view = get_permalink( $_POST['post_ID'] );17 $edit = esc_url( get_edit_post_link( $_POST['post_ID'] ) );18 if ( 'post-quickpress-publish' == $_POST['action'] ) {19 if ( current_user_can('publish_posts') )20 printf( '<div class="updated"><p>' . __( 'Post published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit );21 else22 printf( '<div class="updated"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );23 } else {24 printf( '<div class="updated"><p>' . __( 'Draft saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );25 }26 printf('<p class="easy-blogging">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="' . esc_url( admin_url( 'tools.php' ) ) . '">' . __('Press This') . '</a>' );27 $_REQUEST = array(); // hack for get_default_post_to_edit()28 }29 22 30 23 /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ … … 47 40 48 41 $post_ID = (int) $post->ID; 49 50 $media_settings = array(51 'id' => $post->ID,52 'nonce' => wp_create_nonce( 'update-post_' . $post->ID ),53 );54 55 if ( current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' ) ) {56 $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true );57 $media_settings['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;58 }59 42 ?> 60 43 61 <form name="post" action="<?php echo esc_url( admin_url( ' post.php' ) ); ?>" method="post" id="quick-press" class="initial-form">44 <form name="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post" id="quick-press" class="initial-form"> 62 45 <div class="input-text-wrap" id="title-wrap"> 63 <label class="screen-reader-text prompt" for="title" id="title-prompt-text"><?php _e( 'Enter title here'); ?></label>64 <input type="text" name="post_title" id="title" autocomplete="off" value="<?php echo esc_attr( $post->post_title ); ?>"/>46 <label class="screen-reader-text prompt" for="title" id="title-prompt-text"><?php _e( "What's on your mind?" ); ?></label> 47 <input type="text" name="post_title" id="title" autocomplete="off" /> 65 48 </div> 66 49 67 <?php if ( current_user_can( 'upload_files' ) ) : ?> 68 <div id="wp-content-wrap" class="wp-editor-wrap hide-if-no-js wp-media-buttons"> 69 <?php do_action( 'media_buttons', 'content' ); ?> 70 </div> 71 <?php endif; ?> 72 73 <div class="textarea-wrap"> 74 <label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( "What's on your mind?" ); ?></label> 75 <textarea name="content" id="content" class="mceEditor" rows="3" cols="15"><?php echo esc_textarea( $post->post_content ); ?></textarea> 76 </div> 77 78 <script type="text/javascript"> 79 edCanvas = document.getElementById('content'); 80 edInsertContent = null; 81 <?php if ( $_POST ) : ?> 82 wp.media.editor.remove('content'); 83 wp.media.view.settings.post = <?php echo json_encode( $media_settings ); // big juicy hack. ?>; 84 wp.media.editor.add('content'); 85 <?php endif; ?> 86 </script> 87 88 <div class="input-text-wrap" id="tags-input-wrap"> 89 <label class="screen-reader-text prompt" for="tags-input" id="tags-input-prompt-text"><?php _e( 'Tags (separate with commas)' ); ?></label> 90 <input type="text" name="tags_input" id="tags-input" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /> 50 <div class="textarea-wrap" id="description-wrap"> 51 <label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( 'Enter a description' ); ?></label> 52 <textarea name="content" id="content" class="mceEditor" rows="3" cols="15"></textarea> 91 53 </div> 92 54 93 55 <p class="submit"> 94 <input type="hidden" name="action" id="quickpost-action" value=" post-quickpress-save" />56 <input type="hidden" name="action" id="quickpost-action" value="new-quickdraft-post" /> 95 57 <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" /> 96 58 <input type="hidden" name="post_type" value="post" /> … … 112 74 'post_status' => 'draft', 113 75 'author' => $GLOBALS['current_user']->ID, 114 'posts_per_page' => 5,76 'posts_per_page' => 4, 115 77 'orderby' => 'modified', 116 78 'order' => 'DESC' … … 121 83 if ( $drafts && is_array( $drafts ) ) { 122 84 $list = array(); 85 $draft_count = 0; 123 86 foreach ( $drafts as $draft ) { 87 if ( 3 == $draft_count ) 88 break; 89 90 $draft_count++; 91 124 92 $url = get_edit_post_link( $draft->ID ); 125 93 $title = _draft_or_post_title( $draft->ID ); … … 131 99 ?> 132 100 <div class="drafts"> 101 <?php if ( 3 < count($drafts) ) { ?> 133 102 <p class="view-all"><a href="edit.php?post_status=draft" ><?php _e('View all'); ?></a></p> 103 <?php } ?> 134 104 <p class="title"><?php _e('Drafts'); ?></p> 135 105 <ul id="draft-list"> … … 138 108 </div> 139 109 <?php } else { ?> 140 <div class="drafts"><p><?php _e( 'There are no drafts at the moment'); ?></p></div>110 <div class="drafts"><p><?php _e("You have yet to add any drafts."); ?></p></div> 141 111 <?php } 142 112 }
Note: See TracChangeset
for help on using the changeset viewer.