From 321fbfdb059e39b921e13ba034855b019981fa44 Mon Sep 17 00:00:00 2001 From: Kevin Jardine Date: Tue, 29 May 2012 18:09:16 +0200 Subject: added click on calendar to preselect new event date --- views/default/event_calendar/css.php | 4 +++ .../default/event_calendar/full_calendar_view.php | 39 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'views/default') diff --git a/views/default/event_calendar/css.php b/views/default/event_calendar/css.php index 9461a7fe9..b1e17e4df 100644 --- a/views/default/event_calendar/css.php +++ b/views/default/event_calendar/css.php @@ -275,3 +275,7 @@ li.event-calendar-filter-menu-show-only { clear: both; margin-bottom: 5px; } + +.event-calendar-date-selected { + background-color: #DDDDFF; +} diff --git a/views/default/event_calendar/full_calendar_view.php b/views/default/event_calendar/full_calendar_view.php index d7b6d97a2..d86a3ac27 100644 --- a/views/default/event_calendar/full_calendar_view.php +++ b/views/default/event_calendar/full_calendar_view.php @@ -15,6 +15,28 @@ handleEventClick = function(event) { } }; +handleDayClick = function(date,allDay,jsEvent,view) { + var iso = getISODate(date); + var link = $('.elgg-menu-item-event-calendar-0add').find('a').attr('href'); + var ss = link.split('/'); + var link = $('.elgg-menu-item-event-calendar-0add').find('a').attr('href'); + var ss = link.split('/'); + var last_ss = ss[ss.length-1]; + var group_guid; + if (last_ss == 'add') { + group_guid = 0; + } else if (last_ss.split('-').length == 3) { + group_guid = ss[ss.length-2]; + } else { + group_guid = last_ss; + } + var url = elgg.get_site_url(); + $('.elgg-menu-item-event-calendar-0add').find('a').attr('href',url+'event_calendar/add/'+group_guid+'/'+iso); + $('.elgg-menu-item-event-calendar-1schedule').find('a').attr('href',url+'event_calendar/schedule/'+group_guid+'/'+iso); + $('.fc-widget-content').removeClass('event-calendar-date-selected'); + $(this).addClass('event-calendar-date-selected'); +} + handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) { if (!confirm("")) { @@ -54,6 +76,22 @@ handleGetEvents = function(start, end, callback) { callback(events); } }); + // reset date links and classes + $('.fc-widget-content').removeClass('event-calendar-date-selected'); + var link = $('.elgg-menu-item-event-calendar-0add').find('a').attr('href'); + var ss = link.split('/'); + var last_ss = ss[ss.length-1]; + var group_guid; + if (last_ss == 'add') { + group_guid = 0; + } else if (last_ss.split('-').length == 3) { + group_guid = ss[ss.length-2]; + } else { + group_guid = last_ss; + } + var url = elgg.get_site_url(); + $('.elgg-menu-item-event-calendar-0add').find('a').attr('href',url+'event_calendar/add/'+group_guid); + $('.elgg-menu-item-event-calendar-1schedule').find('a').attr('href',url+'event_calendar/schedule/'+group_guid); } $(document).ready(function() { @@ -69,6 +107,7 @@ $(document).ready(function() { slotMinutes: 15, eventDrop: handleEventDrop, eventClick: handleEventClick, + dayClick: handleDayClick, events: handleGetEvents }); }); -- cgit v1.2.3