CC-2145 : Redesign & layout fixes for the Preferences screen
added javascript to page, got rid of separate index/update actions and moved everything to just index since update was not needed as a separate action.
This commit is contained in:
parent
a28d8ce305
commit
9bd1aa14a9
|
@ -10,42 +10,37 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
|
$this->view->headScript()->appendFile('/js/airtime/preferences/preferences.js','text/javascript');
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
$this->view->statusMsg = "";
|
$this->view->statusMsg = "";
|
||||||
|
|
||||||
$form = new Application_Form_Preferences();
|
$form = new Application_Form_Preferences();
|
||||||
$this->view->form = $form;
|
|
||||||
}
|
if ($request->isPost()) {
|
||||||
|
|
||||||
public function updateAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
if (!$this->getRequest()->isPost()) {
|
|
||||||
return $this->_forward('Preference/index');
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new Application_Form_Preferences();
|
if ($form->isValid($request->getPost())) {
|
||||||
if ($form->isValid($request->getPost())) {
|
|
||||||
|
|
||||||
$values = $form->getValues();
|
$values = $form->getValues();
|
||||||
|
|
||||||
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
|
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
|
||||||
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
|
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
|
||||||
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
|
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
|
||||||
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
|
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
|
||||||
|
|
||||||
Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]);
|
Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||||
Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]);
|
Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]);
|
||||||
Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]);
|
Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]);
|
||||||
Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]);
|
Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]);
|
||||||
Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]);
|
Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]);
|
||||||
Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]);
|
Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]);
|
||||||
Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]);
|
Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]);
|
||||||
|
|
||||||
$this->view->statusMsg = "<div class='success'>Preferences updated.</div>";
|
$this->view->statusMsg = "<div class='success'>Preferences updated.</div>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
return $this->render('index'); //render the phtml file
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ class Application_Form_Preferences extends Zend_Form
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->setAction('/Preference/update')->setMethod('post');
|
$this->setAction('/Preference');
|
||||||
|
$this->setMethod('post');
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
|
array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<form method="post" action="/Preference/update" enctype="application/x-www-form-urlencoded">
|
<form method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="application/x-www-form-urlencoded">
|
||||||
|
|
||||||
<?php echo $this->element->getSubform('preferences_general') ?>
|
<?php echo $this->element->getSubform('preferences_general') ?>
|
||||||
|
|
||||||
<h3 class="collapsible-header"><span class="arrow-icon"></span>SoundCloud settings</h3>
|
<h3 class="collapsible-header"><span class="arrow-icon"></span>SoundCloud settings</h3>
|
||||||
<div class="collapsible-content" id="soundcloud-settings" style="display: block;">
|
<div class="collapsible-content" id="soundcloud-settings" style="display: none;">
|
||||||
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
|
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Left empty on purpose
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var form = $("form");
|
||||||
|
|
||||||
|
form.find("h3").click(function(){
|
||||||
|
var h3 = $(this);
|
||||||
|
h3.next().toggle();
|
||||||
|
|
||||||
|
if(h3.hasClass("close")) {
|
||||||
|
h3.removeClass("close");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
h3.addClass("close");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue