Commit a35a86c9 authored by Project Open's avatar Project Open

- Moved HourWeeklyController to separate file, added standard ResizeController

parent d117ee8d
......@@ -26,12 +26,13 @@ Ext.require([
'Ext.grid.*',
'Ext.tree.*',
'PO.Utilities',
'PO.store.CategoryStore',
'PO.store.project.ProjectMainStore',
'PO.controller.ResizeController', // Handles "Maximize" button etc.
'PO.controller.StoreLoadCoordinator',
'PO.model.timesheet.TimesheetTask',
'PO.model.timesheet.Hour',
'PO.model.project.Project',
'PO.store.CategoryStore',
'PO.store.project.ProjectMainStore',
'PO.store.timesheet.HourStore',
'PO.store.timesheet.TaskTreeStore',
'PO.view.field.POComboTree'
......@@ -254,7 +255,25 @@ function launchTimesheetWeeklyLogging(){
});
hourController.init(this).onLaunch(this);
hourGrid.hourController = hourController; // Add reference to hourGrid
// Controller to handle size and resizing related events
var renderDiv = Ext.get("@task_editor_id@");
var resizeController = Ext.create('PO.controller.ResizeController', {
debug: getDebug('resizeController'),
redrawPanel: hourButtonPanel, // panel with redraw() function and needsRedraw variable
renderDiv: renderDiv, // container of outerContainer
outerContainer: hourButtonPanel // outermost panel with resize border
}).init();
resizeController.onLaunch(this);
resizeController.onResize(); // Set the size of the outer GanttButton Panel
// Testing events
hourButtonPanel.fireEvent('keypress');
......
......@@ -231,50 +231,6 @@ Ext.define('PO.tsweekly.HourWeeklyController', {
var keyCode = e.getKey();
var keyCtrl = e.ctrlKey;
console.log('GanttButtonController.onCellKeyDown: code='+keyCode+', ctrl='+keyCtrl);
},
/**
* The windows as a whole was resized
*/
onWindowsResize: function(width, height) {
console.log('GanttButtonController.onWindowResize');
var me = this;
var sideBar = Ext.get('sidebar'); // ]po[ left side bar component
var sideBarSize = sideBar.getSize();
me.onResize(sideBarSize.width);
},
/**
* The ]po[ left sideBar was resized
*/
onSideBarResize: function(event, el, config) {
console.log('GanttButtonController.onSideBarResize');
var me = this;
var sideBar = Ext.get('sidebar'); // ]po[ left side bar component
var sideBarSize = sideBar.getSize();
// We get the event _before_ the sideBar has changed it's size.
// So we actually need to the the oposite of the sidebar size:
if (sideBarSize.width > 100) {
sideBarSize.width = -5;
} else {
sideBarSize.width = 245;
}
me.onResize(sideBarSize.width);
},
/**
* Generic resizing function, called with the target width of the sideBar
*/
onResize: function(sideBarWidth) {
console.log('GanttButtonController.onResize: '+sideBarWidth);
var me = this;
var screenSize = Ext.getBody().getViewSize();
var height = me.hourButtonPanel.getSize().height;
var width = screenSize.width - sideBarWidth - 75;
me.hourButtonPanel.setSize(width, height);
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment