This commit is contained in:
parent
fc25d67230
commit
aee0777032
|
|
@ -1,5 +1,16 @@
|
|||
(function($){
|
||||
function updateLayout() {
|
||||
var OctoberLayout = function() {}
|
||||
|
||||
OctoberLayout.prototype.setPageTitle = function(title) {
|
||||
var $title = $('title')
|
||||
|
||||
if (this.pageTitleTemplate === undefined)
|
||||
this.pageTitleTemplate = $title.data('titleTemplate')
|
||||
|
||||
$title.text(this.pageTitleTemplate.replace('%s', title))
|
||||
}
|
||||
|
||||
OctoberLayout.prototype.updateLayout = function(title) {
|
||||
$('.layout-cell.width-fix').each(function(){
|
||||
var $el = $(this).children();
|
||||
if ($el.length > 0) {
|
||||
|
|
@ -14,6 +25,13 @@
|
|||
})
|
||||
}
|
||||
|
||||
$(document).ready(updateLayout)
|
||||
$(window).on('resize', updateLayout)
|
||||
if ($.oc === undefined)
|
||||
$.oc = {}
|
||||
|
||||
$.oc.layout = new OctoberLayout()
|
||||
|
||||
$(document).ready($.oc.layout.updateLayout())
|
||||
$(window).on('resize', function() {
|
||||
$.oc.layout.updateLayout()
|
||||
})
|
||||
})(jQuery);
|
||||
|
|
@ -76,6 +76,11 @@ class Controller extends Extendable
|
|||
*/
|
||||
public $pageTitle;
|
||||
|
||||
/**
|
||||
* @var string Page title template
|
||||
*/
|
||||
public $pageTitleTemplate;
|
||||
|
||||
/**
|
||||
* @var string Body class property used for customising the layout on a controller basis.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=0">
|
||||
<title><?= $this->pageTitle ?> | October CMS</title>
|
||||
<title data-title-template="<?= empty($this->pageTitleTemplate) ? '%s | October CMS' : e($this->pageTitleTemplate) ?>">
|
||||
<?= $this->pageTitle ?> | October CMS
|
||||
</title>
|
||||
|
||||
<link href="<?= URL::to('modules/backend/assets/vendor/select2/select2.css') ?>" rel="stylesheet">
|
||||
<link href="<?= URL::to('modules/backend/assets/css/october.css') ?>?v<?= System\Models\Parameters::get('system::core.build', 1) ?>" rel="stylesheet">
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
success: function(data) {
|
||||
this.success(data).done(function(){
|
||||
$.oc.stripeLoadIndicator.hide()
|
||||
$('#cms-master-tabs').ocTab('addTab', data.title, data.tab, tabId, $form.data('type-icon'))
|
||||
$('#cms-master-tabs').ocTab('addTab', data.tabTitle, data.tab, tabId, $form.data('type-icon'))
|
||||
}).always(function(){
|
||||
$.oc.stripeLoadIndicator.hide()
|
||||
})
|
||||
|
|
@ -82,6 +82,9 @@
|
|||
*/
|
||||
$('#cms-master-tabs').on('closed.oc.tab', function(event){
|
||||
updateModifiedCounter()
|
||||
|
||||
if ($('> div.tab-content > div.tab-pane', '#cms-master-tabs').length == 0)
|
||||
setPageTitle('')
|
||||
})
|
||||
|
||||
/*
|
||||
|
|
@ -92,6 +95,11 @@
|
|||
return
|
||||
|
||||
var dataId = $(event.target).closest('li').attr('data-tab-id')
|
||||
|
||||
var title = $(event.target).attr('title')
|
||||
if (title)
|
||||
setPageTitle(title)
|
||||
|
||||
$('#cms-side-panel [data-control=filelist]').fileList('markActive', dataId)
|
||||
$('#cms-side-panel form').trigger('oc.list.setActiveItem', [dataId])
|
||||
})
|
||||
|
|
@ -202,8 +210,10 @@
|
|||
$('[data-control=preview-button]', this).attr('href', data.pageUrl)
|
||||
}
|
||||
|
||||
if (data.title !== undefined)
|
||||
$('#cms-master-tabs').ocTab('updateTitle', $(this).closest('.tab-pane'), data.title)
|
||||
if (data.tabTitle !== undefined) {
|
||||
$('#cms-master-tabs').ocTab('updateTitle', $(this).closest('.tab-pane'), data.tabTitle)
|
||||
setPageTitle(data.tabTitle)
|
||||
}
|
||||
|
||||
var tabId = $('input[name=templateType]', this).val() + '-'
|
||||
+ $('input[name=theme]', this).val() + '-'
|
||||
|
|
@ -251,8 +261,9 @@
|
|||
},
|
||||
success: function(data) {
|
||||
this.success(data).done(function(){
|
||||
$('#cms-master-tabs').ocTab('addTab', data.title, data.tab, tabId, $form.data('type-icon') + ' new-template')
|
||||
$('#cms-master-tabs').ocTab('addTab', data.tabTitle, data.tab, tabId, $form.data('type-icon') + ' new-template')
|
||||
$('#layout-side-panel').trigger('close.oc.sidePanel')
|
||||
setPageTitle(data.tabTitle)
|
||||
}).always(function(){
|
||||
$.oc.stripeLoadIndicator.hide()
|
||||
})
|
||||
|
|
@ -446,7 +457,7 @@
|
|||
success: function(data) {
|
||||
this.success(data).done(function(){
|
||||
$.oc.stripeLoadIndicator.hide()
|
||||
$('#cms-master-tabs').ocTab('updateTab', tab, data.title, data.tab)
|
||||
$('#cms-master-tabs').ocTab('updateTab', tab, data.tabTitle, data.tab)
|
||||
$('#cms-master-tabs').ocTab('unmodifyTab', tab)
|
||||
updateModifiedCounter()
|
||||
}).always(function(){
|
||||
|
|
@ -460,6 +471,13 @@
|
|||
})
|
||||
}
|
||||
|
||||
function setPageTitle(title) {
|
||||
if (title.length)
|
||||
$.oc.layout.setPageTitle(title + ' | ')
|
||||
else
|
||||
$.oc.layout.setPageTitle(title)
|
||||
}
|
||||
|
||||
/*
|
||||
* Listen for the click event on the components' remove link
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ class Index extends Controller
|
|||
|
||||
$this->bodyClass = 'compact-container side-panel-not-fixed';
|
||||
$this->pageTitle = Lang::get('cms::lang.cms.menu_label');
|
||||
$this->pageTitleTemplate = '%s CMS | October';
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -116,7 +117,7 @@ class Index extends Controller
|
|||
}
|
||||
|
||||
return [
|
||||
'title' => $this->getTabTitle($type, $template),
|
||||
'tabTitle' => $this->getTabTitle($type, $template),
|
||||
'tab' => $this->makePartial('form_page', [
|
||||
'form' => $widget,
|
||||
'templateType' => $type,
|
||||
|
|
@ -162,7 +163,7 @@ class Index extends Controller
|
|||
$result = [
|
||||
'templatePath' => $template->fileName,
|
||||
'templateMtime' => $template->mtime,
|
||||
'title' => $this->getTabTitle($type, $template)
|
||||
'tabTitle' => $this->getTabTitle($type, $template)
|
||||
];
|
||||
|
||||
if ($type == 'page') {
|
||||
|
|
@ -192,7 +193,7 @@ class Index extends Controller
|
|||
$this->vars['templatePath'] = '';
|
||||
|
||||
return [
|
||||
'title' => $this->getTabTitle($type, $template),
|
||||
'tabTitle' => $this->getTabTitle($type, $template),
|
||||
'tab' => $this->makePartial('form_page', [
|
||||
'form' => $widget,
|
||||
'templateType' => $type,
|
||||
|
|
|
|||
Loading…
Reference in New Issue