Permalink
Browse files

Merge pull request #236 from funkedgeek/master

Posts field fix and image tweaks
  • Loading branch information...
2 parents 15856d2 + caa4ee3 commit 7f3953e3deaa6097f37d9a3f5e3990fbe83e9557 @rilwis committed Mar 3, 2013
Showing with 28 additions and 15 deletions.
  1. +19 −2 css/image.css
  2. +3 −5 inc/fields/image.php
  3. +6 −8 inc/fields/posts.php
View
@@ -8,7 +8,7 @@
width: 150px;
height: 150px;
text-align: center;
- border: 3px solid #ccc;
+ border: 2px solid #ccc;
cursor: move;
position: relative;
}
@@ -20,12 +20,29 @@
color: #fff;
font-weight: bold;
background: #000;
+ background: rgba(0, 0, 0, .5);
position: absolute;
- bottom: 0;
+ top: 0;
right: 0;
padding: 5px;
+ display:none;
+ text-align: center;
+ vertical-align:middle;
+}
+li:hover .rwmb-image-bar{
+ display:block;
}
+
.rwmb-image-bar a {
color: #fff;
font-weight: bold;
+ text-decoration:none;
+ text-align: center;
+ vertical-align:inherit;
+}
+
+.rwmb-image-bar a.rwmb-delete-file {
+ font-weight:lighter;
+ font-size:23px;
+ width:18px;
}
@@ -149,7 +149,7 @@ static function img_html( $image )
<img src="%s" />
<div class="rwmb-image-bar">
<a title="%s" class="rwmb-edit-file" href="%s" target="_blank">%s</a> |
- <a title="%s" class="rwmb-delete-file" href="#" data-attachment_id="%s">%s</a>
+ <a title="%s" class="rwmb-delete-file" href="#" data-attachment_id="%s">×</a>
</div>
</li>
';
@@ -158,14 +158,12 @@ static function img_html( $image )
$src = $src[0];
$link = get_edit_post_link( $image );
- $force_delete = false; // Previously undeclared, is it needed?
-
return sprintf(
$li,
$image,
$src,
$i18n_edit, $link, $i18n_edit,
- $i18n_delete, $image, $i18n_delete
+ $i18n_delete, $image
);
}
@@ -201,4 +199,4 @@ static function meta( $meta, $post_id, $saved, $field )
return (array) $meta;
}
}
-}
+}
View
@@ -33,14 +33,12 @@ static function html( $html, $meta, $field )
$field['options'] = self::get_options( $field );
switch( $field['field_type'] ) {
case 'select':
- $html = RWMB_Select_Field::html( $html, $meta, $field );
+ return RWMB_Select_Field::html( $html, $meta, $field );
break;
case 'select_advanced':
default:
- $html = RWMB_Select_Advanced_Field::html( $html, $meta, $field );
+ return RWMB_Select_Advanced_Field::html( $html, $meta, $field );
}
-
- return $html;
}
/**
@@ -57,21 +55,22 @@ static function normalize_field( $field )
'post_type' => 'post',
'field_type' => 'select_advanced',
'default' => sprintf( __( 'Select a %s' , 'rwmb' ), $pt_obj->labels->singular_name ),
- 'parent' => false
+ 'parent' => false,
+ 'query_args' => array()
) );
if( $field['parent'] ) {
$field['multiple'] = false;
$field['field_name'] = 'parent_id';
}
+
$field['query_args'] = wp_parse_args( $field['query_args'], array(
'post_type' => $field['post_type'],
'post_status' => 'publish',
'posts_per_page'=>'-1'
) );
- $field = RWMB_Select_Advanced_Field::normalize_field( $field );
- return $field;
+ return RWMB_Select_Advanced_Field::normalize_field( $field );
}
/**
@@ -114,7 +113,6 @@ static function meta( $meta, $post_id, $saved, $field )
static function save( $new, $old, $post_id, $field )
{
return RWMB_Select_Field::save( $new, $old, $post_id, $field );
-
}
/**

0 comments on commit 7f3953e

Please sign in to comment.