Begin to move editor settings to its own controller

This commit is contained in:
Sam Georges 2014-06-11 18:48:16 +10:00
parent c4fa109868
commit ee27e91c43
3 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,42 @@
<?php namespace Backend\Controllers;
use BackendMenu;
use Backend\Classes\Controller;
use Backend\Models\EditorSettings as EditorSettingsModel;
/**
* Editor Settings controller
*
* @package october\backend
* @author Alexey Bobkov, Samuel Georges
*
*/
class EditorSettings extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
];
public $formConfig = 'config_form.yaml';
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
BackendMenu::setContext('October.System', 'system', 'settings');
}
public function index()
{
$this->getClassExtension('Backend.Behaviors.FormController')->update();
}
public function formFindModelObject()
{
return EditorSettingsModel::instance();
}
}

View File

@ -0,0 +1,12 @@
# ===================================
# Form Behavior Config
# ===================================
name: system::lang.email_templates.template
form: @/modules/backend/models/editorsettings/fields.yaml
modelClass: Backend\Models\EditorSettings
defaultRedirect: system/emailtemplates
update:
redirect: system/emailtemplates
redirectClose: system/emailtemplates

View File

@ -0,0 +1,37 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('system/settings') ?>"><?= e(trans('system::lang.settings.menu_label')) ?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<?= $this->formRender() ?>
<div class="form-buttons layout-item fix">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s"
data-hotkey-mac="cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/settings') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('system/settings') ?>" class="btn btn-default"><?= e(trans('system::lang.settings.return')) ?></a></p>
<?php endif ?>