Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Trying to extend event_calendar with minor change, adding rollover popup/tool tip to hasEvent class


Go to End


19 Posts   2944 Views

Avatar
TF-35Lightning

Community Member, 137 Posts

14 August 2010 at 5:20pm

Unclescheese the $Event.Title loads correctly here.

<% control Days %>
<td class="$Today $OutOfMonth $CurrentDay $HasEvent">
<a href="$ShowDayLink">$Number<% if Events %><% control Events %><li><span>$Event.Title</span></li></a><% end_control %><% end_if %>
</td>
<% end_control %>

But now I have another field called Rollovertext that I am adding back in CalendarEvent.php

class CalendarEvent extends Page
{

static $db = array (

'Rollovertext' => 'Text'
);

Is there anyway I can call this "Rollovertext" in that control block you showed me??? Or is that not possible? eg.

<% control Days %>
<td class="$Today $OutOfMonth $CurrentDay $HasEvent">
<a href="$ShowDayLink">$Number<% if Events %><% control Events %><li><span>$Event.Rollovertext</span></li></a><% end_control %><% end_if %>
</td>
<% end_control %>

As when I try that I get blank/nothing.

Avatar
TF-35Lightning

Community Member, 137 Posts

7 October 2010 at 4:51pm

Edited: 07/10/2010 5:05pm

Uncleecheese,

Ok I got my livecalendarwidget rollover popups/tooltips on hasevent class via jquery working a treat for the first month it displays.

I have:

//jquery sitting inside ss template

<script type="text/javascript">
jQuery(document).ready(function(){
$("#live-calendar-widget .calendar tbody td.hasEvent").hover(
function(){

$(this).find("span").css('display', 'block');
$(this).find("span").animate({opacity: 1, top: "-60"}, {queue:false, duration:400});
},

function(){
$(this).find("span").animate({opacity: 0, top: "-50"}, {queue:false, complete:
function(){ $(this).hide();

}
}
);
});
});

</script>

//css

live-calendar-widget .calendar tbody td.hasEvent span {

background: url(../images/blerbbg.png) no-repeat;
width: 152px;
height: 58px;
position: absolute;
top: -30px;
left: -20px;
text-align: center;
padding: 5px;
display: none;
line-height:110%;
color:#000000;
cursor:pointer;
font:Arial, Helvetica, sans-serif;
font-size: 10px;
}

// call the $LiveCalendarWidget

Now when I click the Next Arrow next to the Jump to Month drop down list that button has a link of something like
/LiveCalendarWidget_Controller/show/201011/20101007/20101007/Calendar/79/0

and that months calendar now loads up, but my jquery rollover popups don't load for the new month.

Here is the code difference

//on the first month has event with working tooltip
<td class=" hasEvent">
<a href="Calendar2010>30<ul><li><span style="opacity: 0; top: -50px; display: none; ">here is the content of my tooltip</span></li></ul></a>
</td>

//after I have changed month here is what a hasevent looks like and obviously tooltip does not load
<td class=" hasEvent">
<a href="Calendar2010">07<ul><li><span>here is the content of my tooltip</span></li></ul></a>
</td>

Any idea on what I need to do to get the new months you select to also load there own popups etc as you click through????

Avatar
TF-35Lightning

Community Member, 137 Posts

7 October 2010 at 8:46pm

final jquery code that now works using the live() object. Only issue I have now is that for some reason the dates that are displayed on the calendar that belong to the previous month (eg at the start and end of the month) they are still displaying any on rollover events if they are attached to that date, I have to try and work out how to stop that.

$("#live-calendar-widget .calendar tbody td.hasEvent").live('mouseenter',

function(){

jQuery(this).find("span").css('display', 'block');
jQuery(this).find("span").animate({opacity: 1, top: "-60"}, {queue:false, duration:400});
});

$("#live-calendar-widget .calendar tbody td.hasEvent").live('mouseleave',function(){

$(this).find("span").animate({opacity: 0, top: "-50"}, {queue:false, complete:
function(){ $(this).hide();

}
}

);

});

})(jQuery);

Go to Top