Skip to content

Commit

Permalink
calendar MDL-23443 Attemped fix of calendar rendering problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Jul 29, 2010
1 parent 002f53a commit 0c42353
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions calendar/yui/eventmanager/eventmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,44 @@ YUI.add('moodle-calendar-eventmanager', function(Y) {
EVENT.superclass.constructor.apply(this, arguments);
}
Y.extend(EVENT, Y.Base, {
initpanelcalled : false,
initializer : function(config){
var id = this.get(EVENTID), node = this.get(EVENTNODE);
if (!node) {
return false;
}
var td = node.ancestor('td'), constraint = td.ancestor('div'), panel;
var td = node.ancestor('td');
this.publish('showevent');
this.publish('hideevent');
panel = new Y.Overlay({
constrain : constraint,
align : {
node : td,
points:[Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BC]
},
headerContent : Y.Node.create('<h2 class="eventtitle">'+this.get(EVENTTITLE)+'</h2>'),
bodyContent : Y.Node.create('<div class="eventcontent">'+this.get(EVENTCONTENT)+'</div>'),
visible : false,
id : this.get(EVENTID)+'_panel',
width : Math.floor(constraint.get('offsetWidth')*0.9)+"px"
});
panel.get('boundingBox').addClass('calendar-event-panel')
panel.render(td);
this.on('showevent', panel.show, panel);
this.on('hideevent', panel.hide, panel);
td.on('mouseenter', this.startShow, this);
td.on('mouseleave', this.startHide, this);
return true;
},
initPanel : function() {
if (!this.initpanelcalled) {
this.initpanelcalled = true;
var node = this.get(EVENTNODE),
td = node.ancestor('td'),
constraint = td.ancestor('div'),
panel;
panel = new Y.Overlay({
constrain : constraint,
align : {
node : td,
points:[Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BC]
},
headerContent : Y.Node.create('<h2 class="eventtitle">'+this.get(EVENTTITLE)+'</h2>'),
bodyContent : Y.Node.create('<div class="eventcontent">'+this.get(EVENTCONTENT)+'</div>'),
visible : false,
id : this.get(EVENTID)+'_panel',
width : Math.floor(constraint.get('offsetWidth')*0.9)+"px"
});
panel.render(td);
panel.get('boundingBox').addClass('calendar-event-panel');
this.on('showevent', panel.show, panel);
this.on('hideevent', panel.hide, panel);
}
},
startShow : function() {
if (this.get(SHOWTIMEOUT) !== null) {
this.cancelShow();
Expand All @@ -52,6 +62,7 @@ YUI.add('moodle-calendar-eventmanager', function(Y) {
clearTimeout(this.get(SHOWTIMEOUT));
},
show : function() {
this.initPanel();
this.fire('showevent');
},
startHide : function() {
Expand Down

0 comments on commit 0c42353

Please sign in to comment.