Layouts can be reset to default
This commit is contained in:
parent
261760e4c8
commit
0a06582ce7
|
|
@ -35,4 +35,16 @@ class MailLayouts extends Controller
|
|||
BackendMenu::setContext('October.System', 'system', 'settings');
|
||||
SettingsManager::setContext('October.System', 'mail_templates');
|
||||
}
|
||||
|
||||
public function update_onResetDefault($recordId)
|
||||
{
|
||||
$model = $this->formFindModelObject($recordId);
|
||||
|
||||
$model->fillFromCode();
|
||||
$model->save();
|
||||
|
||||
Flash::success(Lang::get('backend::lang.form.reset_success'));
|
||||
|
||||
return Redirect::refresh();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,9 @@ class MailPartials extends Controller
|
|||
BackendMenu::setContext('October.System', 'system', 'settings');
|
||||
SettingsManager::setContext('October.System', 'mail_templates');
|
||||
}
|
||||
|
||||
public function formBeforeSave($model)
|
||||
{
|
||||
$model->is_custom = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,16 @@
|
|||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.save_and_close')) ?>
|
||||
</button>
|
||||
<?php if (!$formModel->is_locked): ?>
|
||||
<?php if ($formModel->is_locked): ?>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-danger pull-right"
|
||||
data-request="onResetDefault"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.resetting')) ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.form.action_confirm')) ?>">
|
||||
<?= e(trans('backend::lang.form.reset_default')) ?>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button
|
||||
type="button"
|
||||
class="oc-icon-trash-o btn-icon danger pull-right"
|
||||
|
|
|
|||
|
|
@ -44,15 +44,13 @@
|
|||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.save_and_close')) ?>
|
||||
</button>
|
||||
<?php if (!$formModel->is_locked): ?>
|
||||
<button
|
||||
type="button"
|
||||
class="oc-icon-trash-o btn-icon danger pull-right"
|
||||
data-request="onDelete"
|
||||
data-load-indicator="<?= e(trans('system::lang.mail_templates.deleting_layout')) ?>"
|
||||
data-request-confirm="<?= e(trans('system::lang.mail_templates.delete_layout_confirm')) ?>">
|
||||
</button>
|
||||
<?php endif ?>
|
||||
<button
|
||||
type="button"
|
||||
class="oc-icon-trash-o btn-icon danger pull-right"
|
||||
data-request="onDelete"
|
||||
data-load-indicator="<?= e(trans('system::lang.mail_templates.deleting_layout')) ?>"
|
||||
data-request-confirm="<?= e(trans('system::lang.mail_templates.delete_layout_confirm')) ?>">
|
||||
</button>
|
||||
<span class="btn-text">
|
||||
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/mailtemplates/index/partials') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -107,21 +107,21 @@ class MailLayout extends Model
|
|||
$sections = self::getTemplateSections($path);
|
||||
|
||||
$css = '
|
||||
@media only screen and (max-width: 600px) {
|
||||
.inner-body {
|
||||
width: 100% !important;
|
||||
}
|
||||
@media only screen and (max-width: 600px) {
|
||||
.inner-body {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
.footer {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 500px) {
|
||||
.button {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width: 500px) {
|
||||
.button {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
';
|
||||
|
||||
$this->name = array_get($sections, 'settings.name', '???');
|
||||
|
|
|
|||
Loading…
Reference in New Issue