Skip to content
This repository
Browse code

Merge pull request #236 from funkedgeek/master

Posts field fix and image tweaks
  • Loading branch information...
commit 7f3953e3deaa6097f37d9a3f5e3990fbe83e9557 2 parents 15856d2 + caa4ee3
Tran Ngoc Tuan Anh authored March 03, 2013
21  css/image.css
@@ -8,7 +8,7 @@
8 8
 	width: 150px;
9 9
 	height: 150px;
10 10
 	text-align: center;
11  
-	border: 3px solid #ccc;
  11
+	border: 2px solid #ccc;
12 12
 	cursor: move;
13 13
 	position: relative;
14 14
 }
@@ -20,12 +20,29 @@
20 20
 	color: #fff;
21 21
 	font-weight: bold;
22 22
 	background: #000;
  23
+	background: rgba(0, 0, 0, .5);
23 24
 	position: absolute;
24  
-	bottom: 0;
  25
+	top: 0;
25 26
 	right: 0;
26 27
 	padding: 5px;
  28
+	display:none;
  29
+	text-align: center;
  30
+	vertical-align:middle;
  31
+}
  32
+li:hover .rwmb-image-bar{
  33
+	display:block;	
27 34
 }
  35
+
28 36
 .rwmb-image-bar a {
29 37
 	color: #fff;
30 38
 	font-weight: bold;
  39
+	text-decoration:none;
  40
+	text-align: center;
  41
+	vertical-align:inherit;
  42
+}
  43
+
  44
+.rwmb-image-bar a.rwmb-delete-file {
  45
+	font-weight:lighter;
  46
+	font-size:23px;
  47
+	width:18px;
31 48
 }
8  inc/fields/image.php
@@ -149,7 +149,7 @@ static function img_html( $image )
149 149
 					<img src="%s" />
150 150
 					<div class="rwmb-image-bar">
151 151
 						<a title="%s" class="rwmb-edit-file" href="%s" target="_blank">%s</a> |
152  
-						<a title="%s" class="rwmb-delete-file" href="#" data-attachment_id="%s">%s</a>
  152
+						<a title="%s" class="rwmb-delete-file" href="#" data-attachment_id="%s">×</a>
153 153
 					</div>
154 154
 				</li>
155 155
 			';
@@ -158,14 +158,12 @@ static function img_html( $image )
158 158
 			$src  = $src[0];
159 159
 			$link = get_edit_post_link( $image );
160 160
 
161  
-			$force_delete = false; // Previously undeclared, is it needed?
162  
-
163 161
 			return sprintf(
164 162
 				$li,
165 163
 				$image,
166 164
 				$src,
167 165
 				$i18n_edit, $link, $i18n_edit,
168  
-				$i18n_delete, $image,  $i18n_delete
  166
+				$i18n_delete, $image
169 167
 			);
170 168
 		}
171 169
 
@@ -201,4 +199,4 @@ static function meta( $meta, $post_id, $saved, $field )
201 199
 			return (array) $meta;
202 200
 		}
203 201
 	}
204  
-}
  202
+}
14  inc/fields/posts.php
@@ -33,14 +33,12 @@ static function html( $html, $meta, $field )
33 33
 			$field['options'] = self::get_options( $field );
34 34
 			switch( $field['field_type'] ) {
35 35
 				case 'select':
36  
-					$html = RWMB_Select_Field::html( $html, $meta, $field );
  36
+					return RWMB_Select_Field::html( $html, $meta, $field );
37 37
 					break;
38 38
 				case 'select_advanced':
39 39
 				default:
40  
-					$html = RWMB_Select_Advanced_Field::html( $html, $meta, $field );
  40
+					return RWMB_Select_Advanced_Field::html( $html, $meta, $field );
41 41
 			}
42  
-
43  
-			return $html;
44 42
 		}
45 43
 
46 44
 		/**
@@ -57,21 +55,22 @@ static function normalize_field( $field )
57 55
 				'post_type' => 'post',
58 56
 				'field_type' => 'select_advanced',
59 57
 				'default'    =>  sprintf( __( 'Select a %s' , 'rwmb' ), $pt_obj->labels->singular_name ), 
60  
-				'parent' => false
  58
+				'parent' => false,
  59
+				'query_args' => array()
61 60
 			) );
62 61
 			
63 62
 			if( $field['parent'] ) {
64 63
 				 $field['multiple'] = false;
65 64
 				 $field['field_name'] = 'parent_id';
66 65
 			}
  66
+			
67 67
 			$field['query_args'] = wp_parse_args( $field['query_args'], array(
68 68
 				'post_type' => $field['post_type'],
69 69
 				'post_status' => 'publish',
70 70
 				'posts_per_page'=>'-1'
71 71
 			) );
72  
-			$field = RWMB_Select_Advanced_Field::normalize_field( $field );	
73 72
 				
74  
-			return $field;
  73
+			return  RWMB_Select_Advanced_Field::normalize_field( $field );
75 74
 		}
76 75
 		
77 76
 		/**
@@ -114,7 +113,6 @@ static function meta( $meta, $post_id, $saved, $field )
114 113
 		static function save( $new, $old, $post_id, $field )
115 114
 		{
116 115
 			return  RWMB_Select_Field::save( $new, $old, $post_id, $field );
117  
-
118 116
 		}
119 117
 		
120 118
 		/**

0 notes on commit 7f3953e

Please sign in to comment.
Something went wrong with that request. Please try again.