Permalink
Browse files

Refactor media sorting.

  • Loading branch information...
1 parent 28b2ca9 commit bc606ea500dd079f3551518a95617c728393a2ff Michael Sisk committed Feb 3, 2013
Showing with 24 additions and 24 deletions.
  1. +16 −16 -/css/admin-media.css
  2. +3 −3 -/js/admin-media.js
  3. +5 −5 -/php/media.php
View
@@ -1,27 +1,27 @@
body {
- margin: .5rem;
+ margin: .5em;
}
div {
- margin: .5rem;
+ margin: .5em;
}
li {
float: left;
- margin: .5rem;
+ margin: .5em;
text-align: right;
}
-li span {
- background: #eee;
- outline: thin solid #bbb;
- box-shadow: 0 0 1rem 0 rgba( 0, 0, 0, .1 ) inset;
+b {
+ background: rgba( 0, 0, 0, .05 );
+ box-shadow: 0 0 1em 0 rgba( 0, 0, 0, .1 ) inset;
display: block;
- height: 120px;
- line-height: 120px;
+ height: 10em;
+ line-height: 10em;
+ outline: thin solid rgba( 0, 0, 0, .2 );
overflow: hidden;
text-align: center;
- width: 120px;
+ width: 10em;
}
img {
@@ -31,29 +31,29 @@ img {
li a {
background: url( ../img/media-actions.png ) no-repeat;
display: inline-block;
- margin: 0 0 0 .25rem;
+ margin: 0 0 0 .25em;
height: 24px;
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
width: 24px;
}
+li a + a {
+ background-position: -24px 0;
+}
+
li a:focus,
li a:hover {
background-position: 0 -24px;
}
-li a + a {
- background-position: -24px 0;
-}
-
li a + a:focus,
li a + a:hover {
background-position: -24px -24px;
}
hr {
border: 0;
- border-bottom: thin solid #ccc;
+ border-bottom: thin solid rgba( 0, 0, 0, .2 );
}
View
@@ -26,11 +26,11 @@ jQuery( function( $ ) {
$( '.webcomic-generator .wp-list-table tbody' ).sortable();
/** Handle webcomic media reordering. */
- $( '.webcomic-media' ).sortable( {
+ $( '.webcomic-media-sort' ).sortable( {
update: function() {
- $.post( url, {
+ $.post( $( '[data-webcomic-admin-url]' ).data( 'webcomic-admin-url' ), {
ids: $( '[name="ids[]"]' ).serializeArray(),
- webcomic_admin_ajax: 'WebcomicMedia::ajax_order_media'
+ webcomic_admin_ajax: 'WebcomicMedia::ajax_sort_media'
}, function( data ) {
var message = $( 'div p' ).html();
View
@@ -188,10 +188,10 @@ public function admin_menu() {
public function media_upload_webcomic_media( $output = false ) {
if ( $output ) {
if ( $attachments = self::get_attachments( $_GET[ 'post_id' ] ) ) {
- printf( '<div data-webcomic-modal-media="%s"><p>%s</p><hr></div><ul class="webcomic-media">', admin_url(), __( 'Drag and drop the media attachments to change the order Webcomic will display them.', 'webcomic' ) );
+ printf( '<div data-webcomic-modal-media="%s"><p>%s</p><hr></div><ul class="webcomic-media-sort">', admin_url(), __( 'Drag and drop the media attachments to change the order Webcomic will display them.', 'webcomic' ) );
foreach ( $attachments as $attachment ) {
- printf( '<li><span>%s</span><a href="%s" title="%s">%s</a><a href="%s" title="%s">%s</a><input type="hidden" name="ids[]" value="%s"></li>',
+ printf( '<li><b>%s</b><a href="%s" title="%s">%s</a><a href="%s" title="%s">%s</a><input type="hidden" name="ids[]" value="%s"></li>',
wp_get_attachment_image( $attachment->ID ),
esc_html( wp_nonce_url( add_query_arg( array_merge( $_GET, array( 'post' => $attachment->ID, 'action' => 'edit', 'webcomic_action' => 'regenerate' ) ), admin_url( 'media-upload.php' ) ), 'webcomic_regenerate' ) ),
__( 'Regenerate', 'webcomic' ),
@@ -400,7 +400,7 @@ public function page_attacher() {
?>
<div class="wrap">
<div class="icon32" id="icon-upload"></div>
- <h2><?php _e( 'Webcomic Attacher', 'webcomic' ); ?></h2>
+ <h2><?php echo get_admin_page_title(); ?></h2>
<div id="col-container">
<div id="col-right">
<div class="col-wrap">
@@ -596,7 +596,7 @@ public function page_generator() {
?>
<div class="wrap">
<div class="icon32" id="icon-upload"></div>
- <h2><?php _e( 'Webcomic Generator', 'webcomic' ); ?></h2>
+ <h2><?php echo get_admin_page_title(); ?></h2>
<form method="post" class="webcomic-generator" data-webcomic-daycheck="<?php esc_attr_e( 'The start date is not one of the selected publish days. Continue anyway?', 'webcomic' ); ?>">
<?php wp_nonce_field( 'webcomic_generate', 'webcomic_generate' ); ?>
<div id="col-container">
@@ -665,7 +665,7 @@ public function page_generator() {
*
* @param array $ids Array of attachment ID's to update.
*/
- public static function ajax_order_media( $ids ) {
+ public static function ajax_sort_media( $ids ) {
$i = 0;
foreach ( $ids as $id ) {

0 comments on commit bc606ea

Please sign in to comment.