feat(mvc): add preview mode setting

This commit is contained in:
Lucas Bickel 2021-01-03 11:40:06 +00:00 committed by GitHub
parent 104e9053e1
commit c2bfee60f1
6 changed files with 42 additions and 0 deletions

View File

@ -56,6 +56,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetDefaultTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
Application_Model_Preference::setRadioPageDisplayLoginButton($values["radioPageLoginButton"]);
Application_Model_Preference::SetFeaturePreviewMode($values["featurePreviewMode"]);
$logoUploadElement = $form->getSubForm('preferences_general')->getElement('stationLogo');
$logoUploadElement->receive();

View File

@ -210,6 +210,21 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$radioPageLoginButton->setLabel(_("Display login button on your Radio Page?"));
$radioPageLoginButton->setValue($displayRadioPageLoginButtonValue);
$this->addElement($radioPageLoginButton);
$feature_preview_mode = new Zend_Form_Element_Radio('featurePreviewMode');
$feature_preview_mode->setLabel(_('Feature Previews'));
$feature_preview_mode->setMultiOptions(array(
_("Disabled"),
_("Enabled"),
));
$feature_preview_mode->setValue(Application_Model_Preference::GetFeaturePreviewMode());
$feature_preview_mode->setDescription(_('Enable this to opt-in to test new features.'));
$feature_preview_mode->setSeparator(' '); //No <br> between radio buttons
$feature_preview_mode->addDecorator('HtmlTag', array('tag' => 'dd',
'id'=>"featurePreviewMode-element",
'class' => 'radio-inline-list',
));
$this->addElement($feature_preview_mode);
}
private function getWeekStartDays()

View File

@ -1653,4 +1653,23 @@ class Application_Model_Preference
public static function SetAllowedCorsUrls($value) {
self::setValue('allowed_cors_urls', $value);
}
/**
* Getter for feature preview mode.
*
* @return bool
*/
public static function GetFeaturePreviewMode() {
return self::getValue('feature_preview_mode') === '1';
}
/**
* Setter for feature preview mode.
*
* @param bool $value
* @return void
*/
public static function SetFeaturePreviewMode($value) {
return self::setValue('feature_preview_mode', $value);
}
}

View File

@ -41,6 +41,8 @@
<?php echo $this->element->getElement('podcastAutoSmartblock')->render() ?>
<?php echo $this->element->getElement('featurePreviewMode')->render() ?>
<?php echo $this->element->getElement('thirdPartyApi')->render() ?>
<?php echo $this->element->getElement('allowedCorsUrls')->render() ?>

View File

@ -52,6 +52,11 @@ default.
![](/img/api-settings.png)
You can opt-in to test new features with the **Feature Previews** option.
Features that we soft rollout this way may need more feedback or still have
tolerable bugs. This contains but is not limited to features like large ui
refactors. You can switch back at any time.
You can enable live, read-only access to the LibreTime schedule calendar for
your station's public website with the **Public LibreTime API** option, if you
wish. (There is more about this feature in the

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 32 KiB