Skip to content

Commit

Permalink
Do not show delete pin on first location url see #41
Browse files Browse the repository at this point in the history
  • Loading branch information
madalingorbanescu committed Dec 4, 2019
1 parent e96932e commit 77435f6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 29 deletions.
8 changes: 6 additions & 2 deletions features/metaboxes/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2934,6 +2934,7 @@ div.time-picker li.selected {
.gmap_pins_container {
position: relative; }
.gmap_pins_container .gmap_pin {
position: relative;
display: flex;
justify-content: space-between; }
.gmap_pins_container .gmap_pin > * {
Expand All @@ -2943,7 +2944,10 @@ div.time-picker li.selected {
.gmap_pins_container .gmap_pin .pin_name {
flex-basis: 29%; }
.gmap_pins_container .gmap_pin .pin_delete {
flex-basis: 2%;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: -12px;
opacity: 0;
color: #AA0000; }
.gmap_pins_container .gmap_pin:hover .pin_delete {
Expand Down Expand Up @@ -3413,7 +3417,7 @@ body .mce-toolbar.mce-last .mce-container.mce-first .mce-menubtn.mce-first .mce-
.cmb-type-colorpicker .wp-color-result:after {
content: none; }
.cmb-type-colorpicker .wp-color-result .wp-color-result-text {
display: none; }
display: none; }
.cmb-type-colorpicker .wp-picker-container {
position: absolute;
right: 0;
Expand Down
11 changes: 9 additions & 2 deletions features/metaboxes/fields/gmap_pins.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
}
}

$counter = 0;

foreach ( $meta as $key => $pin ) { ?>

<li class="gmap_pin">
<fieldset class="pin_location_url">
<label
Expand All @@ -45,7 +48,11 @@
<input type="text" name="<?php echo $field['id']; ?>[<?php echo $key ?>][name]"
value="<?php echo $pin['name']; ?>"/>
</fieldset>
<span class="pin_delete"></span>
<?php if( $counter > 0 ) { ?>
<span class="pin_delete"></span>
<?php }
$counter++;
?>
</li>
<?php } ?>
</ul>
Expand All @@ -55,4 +62,4 @@
<?php if ( isset( $field['desc'] ) && ! empty( $field['desc'] ) ) { ?>
<span class="cmb_metabox_description"><?php echo $field['desc']; ?></span>
<?php } ?>
</div>
</div>
54 changes: 29 additions & 25 deletions features/metaboxes/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ $accent: #07d3f8;
.gmap_pins_container {
flex-basis: 100%;
}

// Hide default field description
.cmb_metabox_description {
display: none;
Expand All @@ -1755,6 +1755,7 @@ $accent: #07d3f8;
// padding-bottom: 30px;

.gmap_pin {
position: relative;
display: flex;
justify-content: space-between;
& > * {
Expand All @@ -1770,7 +1771,10 @@ $accent: #07d3f8;
}

.pin_delete {
flex-basis: 2%;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: -12px;
opacity: 0;
color: #AA0000;
}
Expand Down Expand Up @@ -1938,7 +1942,7 @@ $accent: #07d3f8;
&:last-of-type {
padding-bottom: 0;
}

& + .cmb-type {
border-top: 1px solid #EEEEEE;
}
Expand All @@ -1953,7 +1957,7 @@ $accent: #07d3f8;
// Sidebar
#postbox-container-1 & {
padding: 10px 0;

+ .cmb-type {
border-top: none;
}
Expand Down Expand Up @@ -2063,11 +2067,11 @@ $accent: #07d3f8;
display: none;
}
}
.cmb-type-wysiwyg,
// .cmb-type-textarea_small,
// .cmb-type-textarea,
.cmb-type-wysiwyg,
// .cmb-type-textarea_small,
// .cmb-type-textarea,
// .cmb-type-textarea_medium,
// .cmb-type-text,
// .cmb-type-text,
{
.cmb_metabox_description {
flex-basis: 100%;
Expand Down Expand Up @@ -2102,25 +2106,25 @@ $accent: #07d3f8;
width: 100%;
}
.cmb_metabox {
input[type=text],
input[type=search],
input[type=tel],
input[type=time],
input[type=url],
input[type=week],
input[type=password],
input[type=date],
input[type=datetime],
input[type=datetime-local],
input[type=email],
input[type=text],
input[type=search],
input[type=tel],
input[type=time],
input[type=url],
input[type=week],
input[type=password],
input[type=date],
input[type=datetime],
input[type=datetime-local],
input[type=email],
input[type=month],
input[type=number],
select,
// textarea
input[type=number],
select,
// textarea
{
@extend %input-fields;
}

}

.cmb_metabox select,
Expand Down Expand Up @@ -2178,7 +2182,7 @@ $accent: #07d3f8;
display: flex;
flex-wrap: nowrap;
align-items: flex-start;

// Checkbox
input[type=checkbox],
input[type=radio] {
Expand Down Expand Up @@ -2281,7 +2285,7 @@ $accent: #07d3f8;
right: -19px;
}
}

}

.cmb-type-text_range output {
Expand Down

0 comments on commit 77435f6

Please sign in to comment.