mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Updated cms javascript to new concrete API around namespaces and properties
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92608 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d973510fef
commit
d5ec175cfb
@ -1,25 +1,30 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
$('body.CMSMain').concrete({ss:{cmsMain:{
|
$('body.CMSMain').concrete('ss.leftAndMain', {
|
||||||
mainLayout: null,
|
MainLayout: null,
|
||||||
|
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
var $this = $(this);
|
var self = this;
|
||||||
this.mainLayout = this.ss().cmsMain()._setupLayout();
|
|
||||||
|
this.concrete("ss.leftAndMain").setMainLayout(this.concrete("ss.leftAndMain")._setupLayout());
|
||||||
|
|
||||||
// artificially delay the resize event 200ms
|
// artificially delay the resize event 200ms
|
||||||
// to avoid overlapping height changes in different onresize() methods
|
// to avoid overlapping height changes in different onresize() methods
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
var timerID = "timerCMSMainResize";
|
var timerID = "timerCMSMainResize";
|
||||||
if (window[timerID]) clearTimeout(window[timerID]);
|
if (window[timerID]) clearTimeout(window[timerID]);
|
||||||
window[timerID] = setTimeout(function() {$this.ss().cmsMain()._resizeChildren();}, 200);
|
window[timerID] = setTimeout(function() {self.concrete("ss.leftAndMain")._resizeChildren();}, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ss().cmsMain()._resizeChildren();
|
this.concrete("ss.leftAndMain")._resizeChildren();
|
||||||
|
|
||||||
|
this._super();
|
||||||
},
|
},
|
||||||
|
|
||||||
_resizeChildren: function() {
|
_resizeChildren: function() {
|
||||||
$("#treepanes").accordion("resize");
|
$("#treepanes").accordion("resize");
|
||||||
$('#sitetree_and_tools').fitHeightToParent();
|
$('#sitetree_and_tools').fitHeightToParent();
|
||||||
|
|
||||||
|
this._super();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,7 +36,8 @@
|
|||||||
* - south: "Page view", "profile" and "logout" links
|
* - south: "Page view", "profile" and "logout" links
|
||||||
*/
|
*/
|
||||||
_setupLayout: function() {
|
_setupLayout: function() {
|
||||||
var $this = this;
|
var self = this;
|
||||||
|
|
||||||
// layout containing the tree, CMS menu, the main form etc.
|
// layout containing the tree, CMS menu, the main form etc.
|
||||||
var layout = $('body').layout({
|
var layout = $('body').layout({
|
||||||
defaults: {
|
defaults: {
|
||||||
@ -53,14 +59,14 @@
|
|||||||
size: 20,
|
size: 20,
|
||||||
togglerLength_open: 0
|
togglerLength_open: 0
|
||||||
},
|
},
|
||||||
east: {
|
|
||||||
initClosed: true,
|
|
||||||
fxName: "none"
|
|
||||||
},
|
|
||||||
west: {
|
west: {
|
||||||
size: 250,
|
size: 250,
|
||||||
onresize: function() {$this.ss().cmsMain()._resizeChildren();},
|
onresize: function() {self.concrete()._resizeChildren();},
|
||||||
onopen: function() {$this.ss().cmsMain()._resizeChildren();},
|
onopen: function() {self.concrete()._resizeChildren();},
|
||||||
|
fxName: "none"
|
||||||
|
},
|
||||||
|
east: {
|
||||||
|
initClosed: true,
|
||||||
fxName: "none"
|
fxName: "none"
|
||||||
},
|
},
|
||||||
center: {}
|
center: {}
|
||||||
@ -75,7 +81,7 @@
|
|||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
}}});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CMS-specific form behaviour
|
* CMS-specific form behaviour
|
||||||
|
@ -10,19 +10,21 @@
|
|||||||
* - beforeValidate
|
* - beforeValidate
|
||||||
* - afterValidate
|
* - afterValidate
|
||||||
*/
|
*/
|
||||||
$('.LeftAndMain').concrete({ss:{leftAndMain:{
|
$('.LeftAndMain').concrete('ss.leftAndMain', {
|
||||||
|
PingIntervalSeconds: 5*60,
|
||||||
|
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
this.ss().leftAndMain()._setupPinging();
|
this.concrete("ss.leftAndMain")._setupPinging();
|
||||||
this.ss().leftAndMain()._setupButtons();
|
this.concrete("ss.leftAndMain")._setupButtons();
|
||||||
|
|
||||||
|
this._super();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupPinging: function() {
|
_setupPinging: function() {
|
||||||
var pingIntervalSeconds = 5*60;
|
|
||||||
|
|
||||||
// setup pinging for login expiry
|
// setup pinging for login expiry
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
$.get("Security/ping");
|
$.get("Security/ping");
|
||||||
}, pingIntervalSeconds * 1000);
|
}, this.PingIntervalSeconds() * 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,29 +53,30 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}}});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base edit form, provides ajaxified saving
|
* Base edit form, provides ajaxified saving
|
||||||
* and reloading itself through the ajax return values.
|
* and reloading itself through the ajax return values.
|
||||||
* Takes care of resizing tabsets within the layout container.
|
* Takes care of resizing tabsets within the layout container.
|
||||||
*/
|
*/
|
||||||
$('#Form_EditForm').concrete({ss:{
|
$('#Form_EditForm').concrete('ss.editForm',{
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
var $this = this;
|
var self = this;
|
||||||
|
|
||||||
// artificially delay the resize event 200ms
|
// artificially delay the resize event 200ms
|
||||||
// to avoid overlapping height changes in different onresize() methods
|
// to avoid overlapping height changes in different onresize() methods
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
var timerID = "timerLeftAndMainResize";
|
var timerID = "timerLeftAndMainResize";
|
||||||
if (window[timerID]) clearTimeout(window[timerID]);
|
if (window[timerID]) clearTimeout(window[timerID]);
|
||||||
window[timerID] = setTimeout(function() {$this.ss()._resizeChildren();}, 200);
|
window[timerID] = setTimeout(function() {self.concrete('ss.editForm')._resizeChildren();}, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ss()._resizeChildren();
|
this.concrete('ss.editForm')._resizeChildren();
|
||||||
|
|
||||||
// trigger resize whenever new tabs are shown
|
// trigger resize whenever new tabs are shown
|
||||||
// @todo This is called multiple times when tabs are loaded
|
// @todo This is called multiple times when tabs are loaded
|
||||||
this.find('.ss-tabset').bind('tabsshow', function() {$this.ss()._resizeChildren();});
|
this.find('.ss-tabset').bind('tabsshow', function() {self.concrete('ss.editForm')._resizeChildren();});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +104,7 @@
|
|||||||
if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
|
if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
|
||||||
|
|
||||||
// validate if required
|
// validate if required
|
||||||
if(!this.ss().validate()) {
|
if(!this.validate()) {
|
||||||
this.trigger('validationError', [button]);
|
this.trigger('validationError', [button]);
|
||||||
|
|
||||||
// TODO Automatically switch to the tab/position of the first error
|
// TODO Automatically switch to the tab/position of the first error
|
||||||
@ -124,7 +127,7 @@
|
|||||||
|
|
||||||
$form.trigger('afterSubmit', [result]);
|
$form.trigger('afterSubmit', [result]);
|
||||||
|
|
||||||
$form.ss().loadNewPage();
|
$form.loadNewPage();
|
||||||
},
|
},
|
||||||
// @todo Currently all responses are assumed to be evaluated
|
// @todo Currently all responses are assumed to be evaluated
|
||||||
'script'
|
'script'
|
||||||
@ -194,7 +197,7 @@
|
|||||||
$('fieldset > .ss-tabset > .tab > .ss-tabset', this).fitHeightToParent();
|
$('fieldset > .ss-tabset > .tab > .ss-tabset', this).fitHeightToParent();
|
||||||
$('fieldset > .ss-tabset > .tab > .ss-tabset > .tab', this).fitHeightToParent();
|
$('fieldset > .ss-tabset > .tab > .ss-tabset > .tab', this).fitHeightToParent();
|
||||||
}
|
}
|
||||||
}});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All buttons in the right CMS form go through here by default.
|
* All buttons in the right CMS form go through here by default.
|
||||||
@ -203,7 +206,7 @@
|
|||||||
*/
|
*/
|
||||||
$('#Form_EditForm .Actions :submit').concrete({
|
$('#Form_EditForm .Actions :submit').concrete({
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
$(this[0].form).ss().ajaxSubmit(this);
|
$(this[0].form).ajaxSubmit(this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -229,6 +232,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user