Preserve image width for smaller than column width images

This commit is contained in:
Tautvidas Sipavičius
2015-11-10 18:09:36 +02:00
parent 3a206b2c88
commit 4a0deb2182
5 changed files with 16 additions and 15 deletions

View File

@ -1,15 +1,19 @@
.mailpoet_image_block
img
vertical-align: bottom
max-width: 100%
width: auto
height: auto
&.mailpoet_full_image
padding-left: 0
padding-right: 0
margin-bottom: 0
img
width: 100%
.mailpoet_content a:hover
cursor: all-scroll
img
vertical-align: bottom
max-width: $newsletter-width
width: 100%
height: auto

View File

@ -203,6 +203,9 @@ define([
changeBoolField: function(field, event) {
this.model.set(field, (jQuery(event.target).val() === 'true') ? true : false);
},
changeBoolCheckboxField: function(field, event) {
this.model.set(field, (!!jQuery(event.target).prop('checked')));
},
changeColorField: function(field, event) {
var value = jQuery(event.target).val();
if (value === '') {

View File

@ -66,7 +66,7 @@ define([
"keyup .mailpoet_field_image_link": _.partial(this.changeField, "link"),
"keyup .mailpoet_field_image_address": _.partial(this.changeField, "src"),
"keyup .mailpoet_field_image_alt_text": _.partial(this.changeField, "alt"),
"change .mailpoet_field_image_padded": _.partial(this.changeBoolField, "padded"),
"change .mailpoet_field_image_padded": _.partial(this.changeBoolCheckboxField, "padded"),
"change .mailpoet_field_image_alignment": _.partial(this.changeField, "styles.block.textAlign"),
"click .mailpoet_field_image_select_another_image": "showMediaManager",
"click .mailpoet_done_editing": "close",

View File

@ -182,7 +182,7 @@ define([
it('updates the model when padding changes', function () {
var newValue = 'false';
view.$('.mailpoet_field_image_padded').val(newValue).change();
view.$('.mailpoet_field_image_padded').prop('checked', false).change();
expect(model.get('padded')).to.equal(false);
});

View File

@ -24,15 +24,9 @@
</label>
</div>
<div class="mailpoet_form_field">
<div class="mailpoet_form_field_radio_option">
<div class="mailpoet_form_field_checkbox_option">
<label>
<input type="radio" name="padded" class="mailpoet_field_image_padded" value="false" {{#unless padded}}CHECKED{{/unless}}/>
<%= __('Full width') %>
</label>
</div>
<div class="mailpoet_form_field_radio_option">
<label>
<input type="radio" name="padded" class="mailpoet_field_image_padded" value="true" {{#if padded}}CHECKED{{/if}}/>
<input type="checkbox" name="padded" class="mailpoet_field_image_padded" value="true" {{#if padded}}CHECKED{{/if}}/>
<%= __('With padding') %>
</label>
</div>