Reformatted logo remove button to use Zend

This commit is contained in:
Duncan Sommerville 2015-02-27 17:19:37 -05:00
parent 5e256df061
commit 78c7170c4e
4 changed files with 22 additions and 7 deletions

View File

@ -49,6 +49,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$stationLogoUpload->setAttrib('accept', 'image/*');
$this->addElement($stationLogoUpload);
$stationLogoRemove = new Zend_Form_Element_Button('stationLogoRemove');
$stationLogoRemove->setLabel(_('Remove'));
$stationLogoRemove->setAttrib('class', 'btn');
$stationLogoRemove->setAttrib('id', 'logo-remove-btn');
$stationLogoRemove->setAttrib('onclick', 'removeLogo();');
$this->addElement($stationLogoRemove);
//Default station crossfade duration
$this->addElement('text', 'stationDefaultCrossfadeDuration', array(
'class' => 'input_text',

View File

@ -7,10 +7,12 @@
<?php echo $this->element->getElement('stationLogo')->render() ?>
<button id="logo-remove-btn" value="Remove" class="btn">Remove</button>
<?php echo $this->element->getElement('stationLogoRemove')->render() ?>
<!-- <button id="logo-remove-btn" value="Remove" class="btn">Remove</button>-->
<div id="Logo-img-container">
<img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();" id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" />
<img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();$('[id^=stationLogoRemove]').each(function(i,v){v.style.width=v.style.height=v.style.margin=v.style.padding='0px';});" id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" />
</div>
<?php echo $this->element->getElement('locale')->render() ?>

View File

@ -2187,12 +2187,17 @@ dd.radio-inline-list, .preferences dd.radio-inline-list, .stream-config dd.radio
height: 120px;
}
.preferences #stationLogoRemove-label {
display: none;
}
.preferences #logo-remove-btn {
float: right;
margin-bottom: 4px;
}
.preferences #Logo-img-container {
float: left;
margin-top: 30px;
}
#show_time_info {

View File

@ -96,6 +96,11 @@ function setSoundCloudCheckBoxListener() {
});
}
function removeLogo() {
$.post(baseUrl+'Preference/remove-logo', function(json){});
location.reload();
}
$(document).ready(function() {
$('.collapsible-header').live('click',function() {
@ -104,10 +109,6 @@ $(document).ready(function() {
return false;
}).next().hide();
$('#logo-remove-btn').click(function() {
$.post(baseUrl+'Preference/remove-logo', function(json){});
});
/* No longer using AJAX for this form. Zend + our code makes it needlessly hard to deal with. -- Albert
$('#pref_save').live('click', function() {
var data = $('#pref_form').serialize();