From 78c7170c4e629a887799b116fdf9cbe41abc3ea3 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Fri, 27 Feb 2015 17:19:37 -0500 Subject: [PATCH] Reformatted logo remove button to use Zend --- airtime_mvc/application/forms/GeneralPreferences.php | 7 +++++++ .../views/scripts/form/preferences_general.phtml | 6 ++++-- airtime_mvc/public/css/styles.css | 7 ++++++- airtime_mvc/public/js/airtime/preferences/preferences.js | 9 +++++---- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 52f14332a..aa2906d82 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -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', diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index 99cb4384c..85e9a9b7e 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -7,10 +7,12 @@ element->getElement('stationLogo')->render() ?> - + element->getElement('stationLogoRemove')->render() ?> + +
- +
element->getElement('locale')->render() ?> diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index 05987d876..44e0db75b 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -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 { diff --git a/airtime_mvc/public/js/airtime/preferences/preferences.js b/airtime_mvc/public/js/airtime/preferences/preferences.js index f7875ec7b..faef03218 100644 --- a/airtime_mvc/public/js/airtime/preferences/preferences.js +++ b/airtime_mvc/public/js/airtime/preferences/preferences.js @@ -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();