diff --git a/CHANGELOG.md b/CHANGELOG.md
index e419ff0b0..890e599c5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
* **Build 15x** (2014-10-x)
- Added twig filters `|trans` for `Lang::get(...)` and `|transchoice` for `Lang::choice(...)`.
+ - `SettingsModel` behavior now uses a cached database query.
* **Build 153** (2014-10-09)
- Plugins are now updated in order of their dependency definitions.
diff --git a/modules/backend/ServiceProvider.php b/modules/backend/ServiceProvider.php
index 1b0eb7ea2..565513ce7 100644
--- a/modules/backend/ServiceProvider.php
+++ b/modules/backend/ServiceProvider.php
@@ -79,12 +79,12 @@ class ServiceProvider extends ModuleServiceProvider
*/
SettingsManager::instance()->registerCallback(function($manager){
$manager->registerSettingItems('October.Backend', [
- 'backend_settings' => [
- 'label' => 'backend::lang.backend_settings.menu_label',
- 'description' => 'backend::lang.backend_settings.menu_description',
+ 'branding' => [
+ 'label' => 'backend::lang.branding.menu_label',
+ 'description' => 'backend::lang.branding.menu_description',
'category' => SettingsManager::CATEGORY_SYSTEM,
'icon' => 'icon-paint-brush',
- 'class' => 'Backend\Models\BackendSettings',
+ 'class' => 'Backend\Models\BrandSettings',
'order' => 500,
],
'editor' => [
diff --git a/modules/backend/assets/css/october.css b/modules/backend/assets/css/october.css
index e05843206..b01bcdd4d 100644
--- a/modules/backend/assets/css/october.css
+++ b/modules/backend/assets/css/october.css
@@ -8257,7 +8257,7 @@ body.mainmenu-open .mainmenu-collapsed ul {
padding: 13px;
display: block;
font-size: 12px;
- color: #808b93;
+ color: rgba(255, 255, 255, 0.35);
font-weight: normal;
}
#layout-sidenav ul li a:hover {
@@ -8268,7 +8268,7 @@ body.mainmenu-open .mainmenu-collapsed ul {
background: transparent;
}
#layout-sidenav ul li a i {
- color: #808b93;
+ color: rgba(255, 255, 255, 0.35);
display: block;
margin-bottom: 5px;
font-size: 28px;
@@ -8331,7 +8331,7 @@ body.mainmenu-open .mainmenu-collapsed ul {
top: 0;
height: 9px;
font-size: 10px;
- color: #808b93;
+ color: rgba(255, 255, 255, 0.35);
}
#layout-sidenav .scroll-marker.before {
top: 0;
@@ -8350,11 +8350,11 @@ body.mainmenu-open .mainmenu-collapsed ul {
}
#layout-sidenav.layout-sidenav ul.drag li:not(.active) a:hover,
.touch #layout-sidenav.layout-sidenav li:not(.active) a:hover {
- color: #808b93 !important;
+ color: rgba(255, 255, 255, 0.35) !important;
}
#layout-sidenav.layout-sidenav ul.drag li:not(.active) a:hover i,
.touch #layout-sidenav.layout-sidenav li:not(.active) a:hover i {
- color: #808b93 !important;
+ color: rgba(255, 255, 255, 0.35) !important;
}
#layout-sidenav.layout-sidenav ul.drag li:not(.active) a:hover:after,
.touch #layout-sidenav.layout-sidenav li:not(.active) a:hover:after {
@@ -8418,7 +8418,7 @@ body.side-panel-fix-shadow #layout-side-panel {
border-top: 1px solid #dfdfdf;
}
#layout-footer .brand,
-#layout-footer .motto {
+#layout-footer .tagline {
margin: 10px;
height: 40px;
line-height: 40px;
@@ -8430,10 +8430,10 @@ body.side-panel-fix-shadow #layout-side-panel {
#layout-footer .brand .logo {
margin: 0 10px;
}
-#layout-footer .motto {
+#layout-footer .tagline {
float: right;
}
-#layout-footer .motto p {
+#layout-footer .tagline p {
color: #999999;
}
body.outer {
@@ -8513,10 +8513,10 @@ body.outer .layout > .layout-row > .layout-cell .outer-form-container .forgot-pa
top: 8px;
}
body.outer .layout > .layout-row > .layout-cell .outer-form-container .forgot-password a {
- color: #8d969d;
+ color: rgba(255, 255, 255, 0.44);
}
body.outer .layout > .layout-row > .layout-cell .outer-form-container .forgot-password:before {
- color: #8d969d;
+ color: rgba(255, 255, 255, 0.44);
font-size: 14px;
position: relative;
margin-right: 5px;
@@ -12650,7 +12650,7 @@ div.popover-overlay {
.fancy-layout.control-tabs.master:after {
top: 7px;
font-size: 14px;
- color: #e39664;
+ color: rgba(255, 255, 255, 0.35);
}
.fancy-layout .control-tabs.master:before,
.fancy-layout.control-tabs.master:before {
@@ -12705,7 +12705,7 @@ div.popover-overlay {
border-bottom: none;
background: transparent;
font-size: 14px;
- color: #e39664;
+ color: rgba(255, 255, 255, 0.35);
padding: 6px 0 0 0;
overflow: visible;
}
@@ -13007,7 +13007,7 @@ div.popover-overlay {
}
.fancy-layout .form-tabless-fields label {
text-transform: uppercase;
- color: #f4c69e;
+ color: rgba(255, 255, 255, 0.5);
margin-bottom: 0;
}
.fancy-layout .form-tabless-fields input[type=text] {
@@ -13093,7 +13093,7 @@ div.popover-overlay {
.fancy-layout .form-tabless-fields .loading-indicator-container .loading-indicator {
background-color: #e67e22;
padding: 0 0 0 30px;
- color: #f4c69e;
+ color: rgba(255, 255, 255, 0.5);
margin-top: 1px;
height: 90%;
font-size: 12px;
@@ -14438,7 +14438,7 @@ div[data-control="balloon-selector"]:not(.control-disabled) ul li:hover {
padding: 15px 15px 15px 40px;
background: #3d5265;
margin-bottom: 1px;
- color: #808c8d;
+ color: rgba(255, 255, 255, 0.26);
text-decoration: none!important;
}
.sidenav-tree ul.top-level > li > ul li a:hover {
@@ -14455,24 +14455,24 @@ div[data-control="balloon-selector"]:not(.control-disabled) ul li:hover {
line-height: 150%;
}
.sidenav-tree ul.top-level > li > ul li a span.header {
- color: #cad5d8;
+ color: rgba(255, 255, 255, 0.74);
font-size: 14px;
margin-bottom: 5px;
}
.sidenav-tree ul.top-level > li > ul li a span.description {
- color: #bdc3c7;
+ color: rgba(255, 255, 255, 0.64);
font-size: 12px;
font-weight: 100;
}
.sidenav-tree ul.top-level > li > ul li.active a {
background: #34495e;
- color: #ecf0f1;
+ color: rgba(255, 255, 255, 0.91);
}
.sidenav-tree ul.top-level > li > ul li.active a:before {
content: ' ';
position: absolute;
width: 4px;
- background: #e6802b;
+ background: #e67e22;
left: 0;
top: 0;
height: 100%;
@@ -14481,7 +14481,7 @@ div[data-control="balloon-selector"]:not(.control-disabled) ul li:hover {
color: #ffffff;
}
.sidenav-tree ul.top-level > li > ul li.active a span.description {
- color: #ecf0f1;
+ color: rgba(255, 255, 255, 0.91);
}
.sidenav-tree ul.top-level > li > ul li:last-child a {
margin-bottom: 0;
@@ -14495,34 +14495,34 @@ div[data-control="balloon-selector"]:not(.control-disabled) ul li:hover {
@media (max-width: 768px) {
.sidenav-tree {
width: 100%;
- height: auto!important;
- display: block!important;
+ height: auto !important;
+ display: block !important;
}
.sidenav-tree > .layout {
display: none;
}
.sidenav-tree-root .sidenav-tree {
- width: 100%!important;
- height: 100%!important;
+ width: 100% !important;
+ height: 100% !important;
display: table-cell !important;
}
.sidenav-tree-root .sidenav-tree .back-link {
- display: none!important;
+ display: none !important;
}
.sidenav-tree-root .sidenav-tree > .layout {
- display: table!important;
+ display: table !important;
}
.sidenav-tree-root #layout-body {
display: none;
}
body.has-sidenav-tree .sidenav-tree .back-link {
display: block;
- background: #2b3e50;
padding: 13px 15px;
+ background: #2b3e50;
color: #bdc3c7;
font-size: 14px;
- text-transform: uppercase;
line-height: 14px;
+ text-transform: uppercase;
}
body.has-sidenav-tree .sidenav-tree .back-link i {
display: inline-block;
@@ -14532,6 +14532,6 @@ div[data-control="balloon-selector"]:not(.control-disabled) ul li:hover {
text-decoration: none;
}
body.has-sidenav-tree #layout-body {
- display: block!important;
+ display: block !important;
}
}
diff --git a/modules/backend/assets/less/controls/fancylayout.less b/modules/backend/assets/less/controls/fancylayout.less
index 6585f5f95..f0223a242 100644
--- a/modules/backend/assets/less/controls/fancylayout.less
+++ b/modules/backend/assets/less/controls/fancylayout.less
@@ -142,17 +142,17 @@
}
}
- &[data-modified] {
- span.tab-close i {
- top: 4px;
- .hide-text();
+ &[data-modified] {
+ span.tab-close i {
+ top: 4px;
+ .hide-text();
- &:before {
- .icon(@circle);
- font-size: 9px;
- }
+ &:before {
+ .icon(@circle);
+ font-size: 9px;
}
}
+ }
&:first-child {
margin-left: 0;
diff --git a/modules/backend/assets/less/controls/sidenav-tree.less b/modules/backend/assets/less/controls/sidenav-tree.less
index 3e5ba2973..7b63e0bfb 100644
--- a/modules/backend/assets/less/controls/sidenav-tree.less
+++ b/modules/backend/assets/less/controls/sidenav-tree.less
@@ -20,10 +20,10 @@
background: #2b3e50!important;
}
- ul.top-level > li {
+ ul.top-level > li {
&[data-status=collapsed] {
> div.group h3:before {
- .transform( ~'rotate(0deg) translate(3px, 0)' );
+ .transform(~'rotate(0deg) translate(3px, 0)');
}
ul {
@@ -55,7 +55,7 @@
top: 15px;
color: @color-list-arrow;
.icon(@caret-right);
- .transform( ~'rotate(90deg) translate(5px, 0)' );
+ .transform(~'rotate(90deg) translate(5px, 0)');
.transition(all 0.1s ease);
}
}
@@ -137,16 +137,14 @@
.back-link {
display: none;
-
-
}
}
@media (max-width: @screen-sm) {
.sidenav-tree {
width: 100%;
- height: auto!important;
- display: block!important;
+ height: auto !important;
+ display: block !important;
> .layout {
display: none;
@@ -155,16 +153,16 @@
.sidenav-tree-root {
.sidenav-tree {
- width: 100%!important;
- height: 100%!important;
- display: table-cell!important;
+ width: 100% !important;
+ height: 100% !important;
+ display: table-cell !important;
.back-link {
- display: none!important;
+ display: none !important;
}
> .layout {
- display: table!important;
+ display: table !important;
}
}
@@ -177,12 +175,12 @@
.sidenav-tree {
.back-link {
display: block;
- background: @color-sidebarnav-back-link-bg;
padding: 13px 15px;
+ background: @color-sidebarnav-back-link-bg;
color: @color-sidebarnav-back-link-text;
font-size: 14px;
- text-transform: uppercase;
line-height: 14px;
+ text-transform: uppercase;
i {
display: inline-block;
margin-right: 10px;
@@ -194,7 +192,7 @@
}
#layout-body {
- display: block!important;
+ display: block !important;
}
}
}
\ No newline at end of file
diff --git a/modules/backend/assets/less/core/variables.less b/modules/backend/assets/less/core/variables.less
index 7263ee9aa..3575c99e9 100644
--- a/modules/backend/assets/less/core/variables.less
+++ b/modules/backend/assets/less/core/variables.less
@@ -69,23 +69,23 @@
@color-footer-text: #666666;
@color-sidebarnav-bg: #34495e;
-@color-sidebarnav-inactive-text: #808b93;
-@color-sidebarnav-inactive-icon: #808b93;
@color-sidebarnav-active-text: #ffffff;
@color-sidebarnav-active-icon: #ffffff;
+@color-sidebarnav-inactive-text: rgba(255,255,255,.35);
+@color-sidebarnav-inactive-icon: rgba(255,255,255,.35);
@color-sidebarnav-counter-bg: #d9350f;
@color-sidebarnav-counter-text: #ffffff;
@color-sidebarnav-tree-group: #ecf0f1;
@color-sidebarnav-tree-group-bg: #2b3e50;
-@color-sidebarnav-tree-inactive-header: #CAD5D8;
-@color-sidebarnav-tree-inactive-desc: #bdc3c7;
-@color-sidebarnav-tree-inactive-text: #808c8d;
+@color-sidebarnav-tree-inactive-header: rgba(255,255,255,.74);
+@color-sidebarnav-tree-inactive-desc: rgba(255,255,255,.64);
+@color-sidebarnav-tree-inactive-text: rgba(255,255,255,.26);
@color-sidebarnav-tree-active-header: #ffffff;
@color-sidebarnav-tree-inactive-bg: #3d5265;
@color-sidebarnav-tree-active-bg: #34495e;
-@color-sidebarnav-tree-active-text: #ecf0f1;
-@color-sidebarnav-tree-active-marker: #e6802b;
+@color-sidebarnav-tree-active-text: rgba(255,255,255,.91);
+@color-sidebarnav-tree-active-marker: #e67e22;
@color-sidebarnav-back-link-bg: #2b3e50;
@color-sidebarnav-back-link-text: #bdc3c7;
@@ -156,7 +156,7 @@
@color-ui-border: #d7d7d7;
-@color-outer-muted-text: #8d969d;
+@color-outer-muted-text: rgba(255,255,255,.44);
@color-outer-heading: #feffff;
@color-outer-description: #999999;
@color-outer-bg: #2b3e50;
@@ -229,7 +229,7 @@
@color-fancy-master-tabs-bg: #d35400;
@color-fancy-master-tabs-active-text: #ffffff;
-@color-fancy-master-tabs-inactive-text: #e39664;
+@color-fancy-master-tabs-inactive-text: rgba(255, 255, 255, .35);
@color-fancy-master-panel-bg: #d35400;
@color-fancy-secondary-tabs-bg: #475354;
@@ -243,7 +243,7 @@
@color-fancy-primary-tabs-inactive-bg: #d5d9d8;
@color-fancy-form-tabless-fields-bg: #e67e22;
-@color-fancy-form-label: #f4c69e;
+@color-fancy-form-label: rgba(255, 255, 255, .5);
@color-fancy-form-text: #ffffff;
@color-fancy-form-text-selection: #d35400;
@color-fancy-form-placeholder: #f4c69e;
diff --git a/modules/backend/assets/less/layout/footer.less b/modules/backend/assets/less/layout/footer.less
index 5ff344059..f3ae25f73 100644
--- a/modules/backend/assets/less/layout/footer.less
+++ b/modules/backend/assets/less/layout/footer.less
@@ -11,7 +11,7 @@
background-color: @color-footer;
border-top: 1px solid @color-footer-border;
- .brand, .motto {
+ .brand, .tagline {
margin: 10px;
height: (@footer-height - 20) + 0px;
line-height: (@footer-height - 20) + 0px;
@@ -24,7 +24,7 @@
.name { }
}
- .motto {
+ .tagline {
float: right;
p { color: lighten(@color-footer-text, 20%); }
}
diff --git a/modules/backend/behaviors/UserPreferencesModel.php b/modules/backend/behaviors/UserPreferencesModel.php
index c88e61afa..ffc9944af 100644
--- a/modules/backend/behaviors/UserPreferencesModel.php
+++ b/modules/backend/behaviors/UserPreferencesModel.php
@@ -38,10 +38,7 @@ class UserPreferencesModel extends SettingsModel
if (isset(self::$instances[$this->recordCode]))
return self::$instances[$this->recordCode];
- $item = UserPreferences::forUser();
- $item = $item->scopeFindRecord($this->model, $this->recordCode, $item->userContext)->first();
-
- if (!$item) {
+ if (!$item = $this->getSettingsRecord()) {
$this->model->initSettingsData();
if (method_exists($this->model, 'forceSave'))
@@ -61,7 +58,21 @@ class UserPreferencesModel extends SettingsModel
*/
public function isConfigured()
{
- return UserPreferences::forUser()->findRecord($this->recordCode, $item->userContext)->count() > 0;
+ return $this->getSettingsRecord() !== null;
+ }
+
+ /**
+ * Returns the raw Model record that stores the settings.
+ * @return Model
+ */
+ public function getSettingsRecord()
+ {
+ $item = UserPreferences::forUser();
+ $record = $item->scopeFindRecord($this->model, $this->recordCode, $item->userContext)
+ ->remember(1440, $this->getCacheKey())
+ ->first();
+
+ return $record ?: null;
}
/**
@@ -95,4 +106,12 @@ class UserPreferencesModel extends SettingsModel
return parent::isKeyAllowed($key);
}
-}
\ No newline at end of file
+
+ /**
+ * Returns a cache key for this record.
+ */
+ protected function getCacheKey()
+ {
+ return 'backend::userpreferences.'.$this->recordCode;
+ }
+}
\ No newline at end of file
diff --git a/modules/backend/classes/Controller.php b/modules/backend/classes/Controller.php
index 88d6557df..4c214048d 100644
--- a/modules/backend/classes/Controller.php
+++ b/modules/backend/classes/Controller.php
@@ -276,10 +276,9 @@ class Controller extends Extendable
if ($result instanceof RedirectResponse)
return $result;
- // Translate the page title
- $this->pageTitle = $this->pageTitle
- ? Lang::get($this->pageTitle)
- : Lang::get('backend::lang.page.untitled');
+ // No page title
+ if (!$this->pageTitle)
+ $this->pageTitle = 'backend::lang.page.untitled';
// Load the view
if (!$this->suppressView && is_null($result))
diff --git a/modules/backend/controllers/EditorPreferences.php b/modules/backend/controllers/EditorPreferences.php
index e73c695de..6969673cb 100644
--- a/modules/backend/controllers/EditorPreferences.php
+++ b/modules/backend/controllers/EditorPreferences.php
@@ -1,6 +1,5 @@
vars['margin'] = 0;
$this->asExtension('FormController')->update();
- $this->pageTitle = Lang::get('backend::lang.editor.menu_label');
+ $this->pageTitle = 'backend::lang.editor.menu_label';
}
public function index_onSave()
diff --git a/modules/backend/controllers/Index.php b/modules/backend/controllers/Index.php
index 8f422c1f3..499bd6013 100644
--- a/modules/backend/controllers/Index.php
+++ b/modules/backend/controllers/Index.php
@@ -37,7 +37,7 @@ class Index extends Controller
public function index()
{
- $this->pageTitle = trans('backend::lang.dashboard.menu_label');
+ $this->pageTitle = 'backend::lang.dashboard.menu_label';
BackendMenu::setContextMainMenu('dashboard');
}
}
\ No newline at end of file
diff --git a/modules/backend/controllers/Users.php b/modules/backend/controllers/Users.php
index 5db153b3d..2839cfbef 100644
--- a/modules/backend/controllers/Users.php
+++ b/modules/backend/controllers/Users.php
@@ -1,6 +1,5 @@
pageTitle = Lang::get('backend::lang.myaccount.menu_label');
+ $this->pageTitle = 'backend::lang.myaccount.menu_label';
return $this->update($this->user->id, 'myaccount');
}
diff --git a/modules/backend/controllers/auth/signin.htm b/modules/backend/controllers/auth/signin.htm
index 82ce38808..f5ddccf52 100644
--- a/modules/backend/controllers/auth/signin.htm
+++ b/modules/backend/controllers/auth/signin.htm
@@ -1,4 +1,4 @@
-
= e(trans('system::lang.app.motto')) ?>
+= e(Backend\Models\BrandSettings::get('app_tagline')) ?>
= Form::open() ?>
diff --git a/modules/backend/controllers/editorpreferences/index.htm b/modules/backend/controllers/editorpreferences/index.htm
index 25be31fb9..948d944ef 100644
--- a/modules/backend/controllers/editorpreferences/index.htm
+++ b/modules/backend/controllers/editorpreferences/index.htm
@@ -52,6 +52,6 @@
= Form::close() ?>
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('system::lang.settings.return')) ?>
\ No newline at end of file
diff --git a/modules/backend/controllers/groups/create.htm b/modules/backend/controllers/groups/create.htm
index 62f852781..3000b0d79 100644
--- a/modules/backend/controllers/groups/create.htm
+++ b/modules/backend/controllers/groups/create.htm
@@ -2,7 +2,7 @@
@@ -37,6 +37,6 @@
= Form::close() ?>
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('backend::lang.user.group.return')) ?>
\ No newline at end of file
diff --git a/modules/backend/controllers/groups/index.htm b/modules/backend/controllers/groups/index.htm
index c3dccaf27..ee75b8527 100644
--- a/modules/backend/controllers/groups/index.htm
+++ b/modules/backend/controllers/groups/index.htm
@@ -1,7 +1,7 @@
diff --git a/modules/backend/controllers/groups/update.htm b/modules/backend/controllers/groups/update.htm
index b5d8e4019..ca4184f1e 100644
--- a/modules/backend/controllers/groups/update.htm
+++ b/modules/backend/controllers/groups/update.htm
@@ -2,7 +2,7 @@
@@ -46,6 +46,6 @@
= Form::close() ?>
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('backend::lang.user.group.return')) ?>
\ No newline at end of file
diff --git a/modules/backend/controllers/users/create.htm b/modules/backend/controllers/users/create.htm
index 828987baa..bbbb4c83b 100644
--- a/modules/backend/controllers/users/create.htm
+++ b/modules/backend/controllers/users/create.htm
@@ -1,7 +1,7 @@
@@ -54,7 +54,7 @@
= Block::placeholder('breadcrumb') ?>
\ No newline at end of file
diff --git a/modules/backend/controllers/users/myaccount.htm b/modules/backend/controllers/users/myaccount.htm
index 32578229e..fe9641d1d 100644
--- a/modules/backend/controllers/users/myaccount.htm
+++ b/modules/backend/controllers/users/myaccount.htm
@@ -44,7 +44,7 @@
= Block::placeholder('breadcrumb') ?>
\ No newline at end of file
diff --git a/modules/backend/controllers/users/update.htm b/modules/backend/controllers/users/update.htm
index aa3a486a9..54bb51a6f 100644
--- a/modules/backend/controllers/users/update.htm
+++ b/modules/backend/controllers/users/update.htm
@@ -1,7 +1,7 @@
@@ -62,7 +62,7 @@
= Block::placeholder('breadcrumb') ?>
\ No newline at end of file
diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php
index a8c67a703..b9e39b434 100644
--- a/modules/backend/lang/en/lang.php
+++ b/modules/backend/lang/en/lang.php
@@ -1,6 +1,9 @@
[
+ 'title' => 'Administration Area',
+ ],
'field' => [
'invalid_type' => 'Invalid field type used :type.',
'options_method_not_exists' => 'The model class :model must define a method :method() returning options for the ":field" form field.',
@@ -211,7 +214,7 @@ return [
'extension' => 'The PHP extension :name is not installed. Please install this library and activate the extension.'
],
'editor' => [
- 'menu_label' => 'Code Editor Preferences',
+ 'menu_label' => 'Code editor preferences',
'menu_description' => 'Customize your code editor preferences, such as font size and color scheme.',
'font_size' => 'Font size',
'tab_size' => 'Tab size',
@@ -231,23 +234,23 @@ return [
'menu_description' => 'Settings relate to your administration account',
],
'myaccount' => [
- 'menu_label' => 'My Account',
+ 'menu_label' => 'My account',
'menu_description' => 'Update your account details such as name, email address and password.',
'menu_keywords' => 'security login'
],
- 'backend_settings' => [
- 'menu_label' => 'Backend Settings',
- 'menu_description' => 'Customize the back-end area such as name, colors and logo.',
+ 'branding' => [
+ 'menu_label' => 'Customize back-end',
+ 'menu_description' => 'Customize the administration area such as name, colors and logo.',
],
'backend_preferences' => [
- 'menu_label' => 'Backend Preferences',
+ 'menu_label' => 'Back-end preferences',
'menu_description' => 'Manage your account preferences such as desired language.',
'locale' => 'Language',
'locale_comment' => 'Select your desired locale for language use.',
],
'access_log' => [
'hint' => 'This log displays a list of successful sign in attempts by administrators. Records are kept for a total of :days days.',
- 'menu_label' => 'Access Log',
+ 'menu_label' => 'Access log',
'menu_description' => 'View a list of successful back-end user sign ins.',
'created_at' => 'Date & Time',
'login' => 'Login',
diff --git a/modules/backend/layouts/_custom_styles.htm b/modules/backend/layouts/_custom_styles.htm
index 22d95d21d..902db3121 100644
--- a/modules/backend/layouts/_custom_styles.htm
+++ b/modules/backend/layouts/_custom_styles.htm
@@ -1,24 +1,8 @@
-
-
-
-
-
+ = BrandSettings::renderCss() ?>
+
\ No newline at end of file
diff --git a/modules/backend/layouts/_footer.htm b/modules/backend/layouts/_footer.htm
index 97a3a97e8..870fac32c 100644
--- a/modules/backend/layouts/_footer.htm
+++ b/modules/backend/layouts/_footer.htm
@@ -3,7 +3,7 @@
= e(trans('system::lang.app.name')) ?>
-
-
= e(trans('system::lang.app.motto')) ?>
+
+
= e(trans('system::lang.app.tagline')) ?>
\ No newline at end of file
diff --git a/modules/backend/layouts/_head.htm b/modules/backend/layouts/_head.htm
index c790eb592..21215f8c1 100644
--- a/modules/backend/layouts/_head.htm
+++ b/modules/backend/layouts/_head.htm
@@ -2,8 +2,8 @@
-
- = $this->pageTitle ?> | October CMS
+
+ = e(trans($this->pageTitle)) ?> | = e(Backend\Models\BrandSettings::get('app_name')) ?>
diff --git a/modules/backend/layouts/auth.htm b/modules/backend/layouts/auth.htm
index ba9058093..57040a8bb 100644
--- a/modules/backend/layouts/auth.htm
+++ b/modules/backend/layouts/auth.htm
@@ -3,7 +3,7 @@
- Administration Area
+ = e(trans('backend::lang.auth.title')) ?>
@@ -28,7 +28,7 @@
-
= e(trans('system::lang.app.name')) ?>
+ = e(Backend\Models\BrandSettings::get('app_name')) ?>
diff --git a/modules/backend/models/BackendSettings.php b/modules/backend/models/BackendSettings.php
deleted file mode 100644
index 7c2813386..000000000
--- a/modules/backend/models/BackendSettings.php
+++ /dev/null
@@ -1,82 +0,0 @@
- ['System\Models\File']
- ];
-
- /**
- * Validation rules
- */
- public $rules = [
- 'app_name' => 'required',
- 'app_motto' => 'required',
- ];
-
- public function initSettingsData()
- {
- $this->app_name = Lang::get('system::lang.app.name');
- $this->app_motto = Lang::get('system::lang.app.motto');
-
- // Carrot
- $this->primary_color_dark = '#d35400';
-
- // Pumpkin
- $this->primary_color_light = '#e67e22';
-
- // Midnight Blue
- $this->secondary_color_dark = '#2b3e50';
-
- // Wet Asphalt
- $this->secondary_color_light = '#34495e';
- }
-
- public static function getLogo()
- {
- $settings = self::instance();
- if (!$settings->logo)
- return null;
-
- return $settings->logo->getPath();
- }
-
- public function renderCss()
- {
- $parser = new Less_Parser(['compress' => true]);
-
- $parser->ModifyVars([
- 'logo-image' => "'".self::getLogo()."'",
- 'primary-color-light' => $this->primary_color_light,
- 'primary-color-dark' => $this->primary_color_dark,
- 'secondary-color-light' => $this->secondary_color_light,
- 'secondary-color-dark' => $this->secondary_color_dark,
- ]);
-
- $parser->parse(File::get(__DIR__.'/backendsettings/custom.less'));
-
- $css = $parser->getCss();
- return $css;
- }
-
-}
\ No newline at end of file
diff --git a/modules/backend/models/BrandSettings.php b/modules/backend/models/BrandSettings.php
new file mode 100644
index 000000000..95034ebcd
--- /dev/null
+++ b/modules/backend/models/BrandSettings.php
@@ -0,0 +1,87 @@
+ ['System\Models\File']
+ ];
+
+ // Pumpkin
+ const PRIMARY_LIGHT = '#e67e22';
+
+ // Carrot
+ const PRIMARY_DARK = '#d35400';
+
+ // Wet Asphalt
+ const SECONDARY_LIGHT = '#34495e';
+
+ // Midnight Blue
+ const SECONDARY_DARK = '#2b3e50';
+
+ /**
+ * Validation rules
+ */
+ public $rules = [
+ 'app_name' => 'required',
+ 'app_tagline' => 'required',
+ ];
+
+ public function initSettingsData()
+ {
+ $this->app_name = Lang::get('system::lang.app.name');
+ $this->app_tagline = Lang::get('system::lang.app.tagline');
+
+ $this->primary_color_light = self::PRIMARY_LIGHT;
+ $this->primary_color_dark = self::PRIMARY_DARK;
+ $this->secondary_color_light = self::SECONDARY_LIGHT;
+ $this->secondary_color_dark = self::SECONDARY_DARK;
+ }
+
+ public static function getLogo()
+ {
+ $settings = self::instance();
+ if (!$settings->logo)
+ return null;
+
+ return $settings->logo->getPath();
+ }
+
+ public static function renderCss()
+ {
+ $parser = new Less_Parser(['compress' => true]);
+
+ $parser->ModifyVars([
+ 'logo-image' => "'".self::getLogo()."'",
+ 'primary-color-light' => self::get('primary_color_light', self::PRIMARY_LIGHT),
+ 'primary-color-dark' => self::get('primary_color_dark', self::PRIMARY_DARK),
+ 'secondary-color-light' => self::get('secondary_color_light', self::SECONDARY_LIGHT),
+ 'secondary-color-dark' => self::get('secondary_color_dark', self::SECONDARY_DARK),
+ ]);
+
+ $parser->parse(File::get(__DIR__.'/brandsettings/custom.less'));
+ $css = $parser->getCss();
+
+ return $css;
+ }
+
+}
\ No newline at end of file
diff --git a/modules/backend/models/backendsettings/fields.yaml b/modules/backend/models/backendsettings/fields.yaml
deleted file mode 100644
index 1d66c081b..000000000
--- a/modules/backend/models/backendsettings/fields.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
-# ===================================
-# Field Definitions
-# ===================================
-
-fields:
-
- logo:
- label: Logo
- type: fileupload
- commentAbove: Upload a custom logo to use in the back-end.
- mode: image
- imageHeight: 170
- imageWidth: 170
-
- app_name:
- label: App Name
- commentAbove: This name is shown in the title area of the back-end.
-
- app_motto:
- label: App Motto
- commentAbove: This name is shown on the sign in screen for the back-end.
-
- primary_color_light:
- label: Primary color light
- type: colorpicker
- span: auto
-
- primary_color_dark:
- label: Primary color dark
- type: colorpicker
- span: auto
-
- secondary_color_light:
- label: Secondary color light
- type: colorpicker
- span: auto
-
- secondary_color_dark:
- label: Secondary color dark
- type: colorpicker
- span: auto
-
-
diff --git a/modules/backend/models/backendsettings/custom.less b/modules/backend/models/brandsettings/custom.less
similarity index 75%
rename from modules/backend/models/backendsettings/custom.less
rename to modules/backend/models/brandsettings/custom.less
index 12d230307..d65485c92 100644
--- a/modules/backend/models/backendsettings/custom.less
+++ b/modules/backend/models/brandsettings/custom.less
@@ -39,27 +39,19 @@ body.outer .layout > .layout-row.layout-head {
// Side navigation bar
//
-//color-sidebarnav-bg: mix(white, saturate(@secondary-color, 6.25%), 5.75%);
@color-sidebarnav-bg: @secondary-color-light;
#layout-sidenav {
background-color: @color-sidebarnav-bg;
-
- ul li a {
- &, i { color: rgba(255, 255, 255, .35); }
- }
}
//
// Fancy layout
//
-//color-fancy-master-tabs-bg: mix(black, saturate(spin(@primary-color, -5.5), 100%), 17.25%);
-//color-fancy-form-inactive-tab: mix(black, saturate(spin(@primary-color-light, -4.25), 11.25%), 24%);
@color-fancy-form-tabless-fields-bg: @primary-color-light;
@color-fancy-master-tabs-bg: @primary-color-dark;
@color-fancy-form-inactive-tab: mix(black, desaturate(@primary-color-dark, 14.5%), 5%);
-
@tab-svg: escape('
');
.fancy-layout {
@@ -80,7 +72,6 @@ body.outer .layout > .layout-row.layout-head {
&.master {
> div > div.tabs-container > ul.nav-tabs > li {
- a { color: rgba(255, 255, 255, .35); }
a > span.title {
background-color: @color-fancy-form-inactive-tab;
&:before, &:after {
@@ -88,21 +79,16 @@ body.outer .layout > .layout-row.layout-head {
}
}
&.active {
- a { color: #fff; }
a > span.title {
background-color: @color-fancy-form-tabless-fields-bg;
}
}
}
}
-
}
.form-tabless-fields {
background: @color-fancy-form-tabless-fields-bg;
- label {
- color: rgba(255, 255, 255, .5);
- }
}
}
@@ -124,8 +110,47 @@ div.control-componentlist {
// File List
//
+@color-list-active-border: @primary-color-light;
+
.control-filelist {
ul li.active a:after {
- background: @primary-color-light;
+ background: @color-list-active-border;
+ }
+}
+
+//
+// Sidenav Tree
+//
+
+@color-sidebarnav-bg: @secondary-color-light;
+@color-sidebarnav-tree-group-bg: @secondary-color-dark;
+@color-sidebarnav-tree-inactive-bg: mix(white, @secondary-color-light, 7%);
+@color-sidebarnav-tree-active-bg: @secondary-color-light;
+@color-sidebarnav-tree-active-marker: @primary-color-light;
+
+.sidenav-tree {
+ background: @color-sidebarnav-bg;
+
+ ul.top-level > li {
+ > div.group h3 {
+ background: @color-sidebarnav-tree-group-bg;
+ }
+
+ > ul li {
+ a {
+ background: @color-sidebarnav-tree-inactive-bg;
+ }
+ &.active a {
+ background: @color-sidebarnav-tree-active-bg;
+
+ &:before {
+ background: @color-sidebarnav-tree-active-marker;
+ }
+ }
+
+ &:hover a {
+ background: @color-sidebarnav-tree-active-bg;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/modules/backend/models/brandsettings/fields.yaml b/modules/backend/models/brandsettings/fields.yaml
new file mode 100644
index 000000000..7f1e4ecfb
--- /dev/null
+++ b/modules/backend/models/brandsettings/fields.yaml
@@ -0,0 +1,58 @@
+# ===================================
+# Field Definitions
+# ===================================
+
+
+tabs:
+ fields:
+
+ logo:
+ label: Logo
+ type: fileupload
+ commentAbove: Upload a custom logo to use in the back-end.
+ mode: image
+ imageHeight: 170
+ imageWidth: 170
+ tab: Brand
+
+ app_name:
+ label: App Name
+ commentAbove: This name is shown in the title area of the back-end.
+ tab: Brand
+
+ app_tagline:
+ label: App Tagline
+ commentAbove: This name is shown on the sign in screen for the back-end.
+ tab: Brand
+
+ primary_color_light:
+ label: Primary (Light)
+ type: colorpicker
+ tab: Colors
+ availableColors: [#1abc9c, #2ecc71, #3498db, #9b59b6, #34495e, #f1c40f, #e67e22, #e74c3c, #ecf0f1, #95a5a6]
+
+ primary_color_dark:
+ label: Primary (Dark)
+ type: colorpicker
+ tab: Colors
+ availableColors: [#16a085, #27ae60, #2980b9, #8e44ad, #2b3e50, #f39c12, #d35400, #c0392b, #bdc3c7, #7f8c8d]
+
+ secondary_color_light:
+ label: Secondary (Light)
+ type: colorpicker
+ tab: Colors
+ availableColors: [#1abc9c, #2ecc71, #3498db, #9b59b6, #34495e, #f1c40f, #e67e22, #e74c3c, #ecf0f1, #95a5a6]
+
+ secondary_color_dark:
+ label: Secondary (Dark)
+ type: colorpicker
+ tab: Colors
+ availableColors: [#16a085, #27ae60, #2980b9, #8e44ad, #2b3e50, #f39c12, #d35400, #c0392b, #bdc3c7, #7f8c8d]
+
+ custom_css:
+ label: Custom stylesheet
+ type: codeeditor
+ tab: Styles
+ size: giant
+
+
diff --git a/modules/cms/controllers/Index.php b/modules/cms/controllers/Index.php
index 8800f20e1..311cfb096 100644
--- a/modules/cms/controllers/Index.php
+++ b/modules/cms/controllers/Index.php
@@ -101,8 +101,8 @@ class Index extends Controller
$this->addJs('/modules/backend/formwidgets/codeeditor/assets/vendor/ace/mode-'.$mode.'.js', 'core');
$this->bodyClass = 'compact-container side-panel-not-fixed';
- $this->pageTitle = Lang::get('cms::lang.cms.menu_label');
- $this->pageTitleTemplate = '%s CMS | October';
+ $this->pageTitle = 'cms::lang.cms.menu_label';
+ $this->pageTitleTemplate = '%s CMS';
}
public function index_onOpenTemplate()
diff --git a/modules/cms/controllers/Themes.php b/modules/cms/controllers/Themes.php
index a1c0b98fa..6e3e117a7 100644
--- a/modules/cms/controllers/Themes.php
+++ b/modules/cms/controllers/Themes.php
@@ -1,6 +1,5 @@
addCss('/modules/cms/assets/css/october.theme-selector.css', 'core');
- $this->pageTitle = Lang::get('cms::lang.theme.settings_menu');
+ $this->pageTitle = 'cms::lang.theme.settings_menu';
BackendMenu::setContext('October.System', 'system', 'settings');
SettingsManager::setContext('October.Cms', 'theme');
}
diff --git a/modules/cms/controllers/index/index.htm b/modules/cms/controllers/index/index.htm
index 08c9e7ac1..56aa5368d 100644
--- a/modules/cms/controllers/index/index.htm
+++ b/modules/cms/controllers/index/index.htm
@@ -28,6 +28,6 @@
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= Block::endPut() ?>
\ No newline at end of file
diff --git a/modules/system/behaviors/SettingsModel.php b/modules/system/behaviors/SettingsModel.php
index f4c7c30a8..9db0900ee 100644
--- a/modules/system/behaviors/SettingsModel.php
+++ b/modules/system/behaviors/SettingsModel.php
@@ -1,5 +1,6 @@
model->bindEvent('model.afterFetch', [$this, 'afterModelFetch']);
$this->model->bindEvent('model.beforeSave', [$this, 'beforeModelSave']);
+ $this->model->bindEvent('model.afterSave', [$this, 'afterModelSave']);
$this->model->bindEvent('model.setAttribute', [$this, 'setModelAttribute']);
$this->model->bindEvent('model.saveInternal', [$this, 'saveModelInternal']);
@@ -72,9 +74,7 @@ class SettingsModel extends ModelBehavior
if (isset(self::$instances[$this->recordCode]))
return self::$instances[$this->recordCode];
- $item = $this->model->where('item', $this->recordCode)->first();
-
- if (!$item) {
+ if (!$item = $this->getSettingsRecord()) {
$this->model->initSettingsData();
if (method_exists($this->model, 'forceSave'))
@@ -94,7 +94,21 @@ class SettingsModel extends ModelBehavior
*/
public function isConfigured()
{
- return $this->model->where('item', $this->recordCode)->count() > 0;
+ return $this->getSettingsRecord() !== null;
+ }
+
+ /**
+ * Returns the raw Model record that stores the settings.
+ * @return Model
+ */
+ public function getSettingsRecord()
+ {
+ $record = $this->model
+ ->where('item', $this->recordCode)
+ ->remember(1440, $this->getCacheKey())
+ ->first();
+
+ return $record ?: null;
}
/**
@@ -108,17 +122,17 @@ class SettingsModel extends ModelBehavior
}
/**
- * Helper for getValue, intended as a static method
+ * Helper for getSettingsValue, intended as a static method
*/
public function get($key, $default = null)
{
- return $this->instance()->getValue($key, $default);
+ return $this->instance()->getSettingsValue($key, $default);
}
/**
* Get a single setting value, or return a default value
*/
- public function getValue($key, $default = null)
+ public function getSettingsValue($key, $default = null)
{
if (array_key_exists($key, $this->fieldValues))
return $this->fieldValues[$key];
@@ -161,6 +175,15 @@ class SettingsModel extends ModelBehavior
$this->model->value = $this->fieldValues;
}
+ /**
+ * After the model is saved, clear the cached query entry.
+ * @return void
+ */
+ public function afterModelSave()
+ {
+ Cache::forget($this->getCacheKey());
+ }
+
/**
* Adulterate the model setter to use our field values instead.
*/
@@ -200,4 +223,12 @@ class SettingsModel extends ModelBehavior
{
return $this->fieldConfig;
}
+
+ /**
+ * Returns a cache key for this record.
+ */
+ protected function getCacheKey()
+ {
+ return 'system::settings.'.$this->recordCode;
+ }
}
diff --git a/modules/system/classes/Controller.php b/modules/system/classes/Controller.php
index 50053b15c..a49caa6f9 100644
--- a/modules/system/classes/Controller.php
+++ b/modules/system/classes/Controller.php
@@ -2,6 +2,7 @@
use Controller as BaseController;
use System\Classes\ApplicationException;
+use System\Classes\CombineAssets;
use Exception;
/**
diff --git a/modules/system/controllers/Settings.php b/modules/system/controllers/Settings.php
index 2db37def9..0e5e98601 100644
--- a/modules/system/controllers/Settings.php
+++ b/modules/system/controllers/Settings.php
@@ -37,7 +37,7 @@ class Settings extends Controller
public function index()
{
- $this->pageTitle = Lang::get('system::lang.settings.menu_label');
+ $this->pageTitle = 'system::lang.settings.menu_label';
$this->vars['items'] = SettingsManager::instance()->listItems('system');
$this->bodyClass = 'compact-container sidenav-tree-root';
}
@@ -45,7 +45,7 @@ class Settings extends Controller
public function mysettings()
{
BackendMenu::setContextSideMenu('mysettings');
- $this->pageTitle = Lang::get('backend::lang.mysettings.menu_label');
+ $this->pageTitle = 'backend::lang.mysettings.menu_label';
$this->vars['items'] = SettingsManager::instance()->listItems('mysettings');
$this->bodyClass = 'compact-container';
}
@@ -58,18 +58,19 @@ class Settings extends Controller
{
SettingsManager::setContext($author.'.'.$plugin, $code);
+ $this->vars['parentLink'] = Backend::url('system/settings');
+ $this->vars['parentLabel'] = Lang::get('system::lang.settings.menu_label');
+
try {
- $item = $this->findSettingItem($author, $plugin, $code);
+ if (!$item = $this->findSettingItem($author, $plugin, $code))
+ throw new ApplicationException(Lang::get('system::lang.settings.not_found'));
+
$this->pageTitle = $item->label;
if ($item->context == 'mysettings') {
$this->vars['parentLink'] = Backend::url('system/settings/mysettings');
$this->vars['parentLabel'] = Lang::get('backend::lang.mysettings.menu_label');
}
- else {
- $this->vars['parentLink'] = Backend::url('system/settings');
- $this->vars['parentLabel'] = Lang::get('system::lang.settings.menu_label');
- }
$model = $this->createModel($item);
$this->initWidgets($model);
diff --git a/modules/system/controllers/Updates.php b/modules/system/controllers/Updates.php
index 37890c3d5..a0996ab9b 100644
--- a/modules/system/controllers/Updates.php
+++ b/modules/system/controllers/Updates.php
@@ -67,7 +67,7 @@ class Updates extends Controller
*/
public function manage()
{
- $this->pageTitle = Lang::get('system::lang.plugins.manage');
+ $this->pageTitle = 'system::lang.plugins.manage';
PluginManager::instance()->clearDisabledCache();
return $this->asExtension('ListController')->index();
}
diff --git a/modules/system/controllers/eventlogs/preview.htm b/modules/system/controllers/eventlogs/preview.htm
index 82d865062..e44db1bc7 100644
--- a/modules/system/controllers/eventlogs/preview.htm
+++ b/modules/system/controllers/eventlogs/preview.htm
@@ -1,7 +1,7 @@
@@ -30,7 +30,7 @@
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
diff --git a/modules/system/controllers/maillayouts/create.htm b/modules/system/controllers/maillayouts/create.htm
index 4347511fa..f8e64df4b 100644
--- a/modules/system/controllers/maillayouts/create.htm
+++ b/modules/system/controllers/maillayouts/create.htm
@@ -1,7 +1,7 @@
@@ -40,7 +40,7 @@
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('system::lang.mail_templates.return')) ?>
diff --git a/modules/system/controllers/maillayouts/update.htm b/modules/system/controllers/maillayouts/update.htm
index 52599fddb..d21fa821a 100644
--- a/modules/system/controllers/maillayouts/update.htm
+++ b/modules/system/controllers/maillayouts/update.htm
@@ -1,7 +1,7 @@
@@ -59,7 +59,7 @@
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('system::lang.mail_templates.return')) ?>
diff --git a/modules/system/controllers/mailtemplates/create.htm b/modules/system/controllers/mailtemplates/create.htm
index db42fd5c4..05b11f3fa 100644
--- a/modules/system/controllers/mailtemplates/create.htm
+++ b/modules/system/controllers/mailtemplates/create.htm
@@ -1,7 +1,7 @@
@@ -40,7 +40,7 @@
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('system::lang.mail_templates.return')) ?>
diff --git a/modules/system/controllers/mailtemplates/update.htm b/modules/system/controllers/mailtemplates/update.htm
index 61a06871c..e812f8639 100644
--- a/modules/system/controllers/mailtemplates/update.htm
+++ b/modules/system/controllers/mailtemplates/update.htm
@@ -1,7 +1,7 @@
@@ -65,7 +65,7 @@
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('system::lang.mail_templates.return')) ?>
diff --git a/modules/system/controllers/requestlogs/preview.htm b/modules/system/controllers/requestlogs/preview.htm
index b690986af..fe9b83583 100644
--- a/modules/system/controllers/requestlogs/preview.htm
+++ b/modules/system/controllers/requestlogs/preview.htm
@@ -1,7 +1,7 @@
@@ -34,7 +34,7 @@
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
diff --git a/modules/system/controllers/settings/update.htm b/modules/system/controllers/settings/update.htm
index 1232d9320..5d357c5d6 100644
--- a/modules/system/controllers/settings/update.htm
+++ b/modules/system/controllers/settings/update.htm
@@ -32,6 +32,6 @@
= Form::close() ?>
- = e($this->fatalError) ?>
+ = e(trans($this->fatalError)) ?>
= e(trans('system::lang.settings.return')) ?>
\ No newline at end of file
diff --git a/modules/system/controllers/updates/_execute.htm b/modules/system/controllers/updates/_execute.htm
index a1fa35d08..91a14471b 100644
--- a/modules/system/controllers/updates/_execute.htm
+++ b/modules/system/controllers/updates/_execute.htm
@@ -136,7 +136,7 @@
-
= e($this->fatalError) ?>
+
= e(trans($this->fatalError)) ?>