From ccad24a925b2e610881fceba9fb550f91da24162 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 19 Jan 2012 21:00:19 +0100 Subject: [PATCH] [Calendar] Use class for active view button --- apps/calendar/css/style.css | 2 +- apps/calendar/js/calendar.js | 26 ++++++++++++++++---------- apps/calendar/templates/calendar.php | 14 -------------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/apps/calendar/css/style.css b/apps/calendar/css/style.css index 108bc647a7..cffaf35640 100644 --- a/apps/calendar/css/style.css +++ b/apps/calendar/css/style.css @@ -43,7 +43,7 @@ .popup {display: none; position: absolute; z-index: 1000; background: #eeeeee; color: #000000; border: 1px solid #1a1a1a; font-size: 90%;} .event_popup {width: 280px; height: 40px; padding: 10px;} -input[type="button"].active {color: #0098E4} +input[type="button"].active {color: #6193CF} #fromtime, #totime { color:#333; } diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 4d0ca3ba65..228ea97c2d 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -351,10 +351,21 @@ Calendar={ } }, - reseticonhighlight: function(){ - $('#oneweekview_radio').css('color', '#000000'); - $('#onemonthview_radio').css('color', '#000000'); - $('#listview_radio').css('color', '#000000'); + setViewActive: function(view){ + $('#view input[type="button"]').removeClass('active'); + var id; + switch (view) { + case 'agendaWeek': + id = 'oneweekview_radio'; + break; + case 'month': + id = 'onemonthview_radio'; + break; + case 'list': + id = 'listview_radio'; + break; + } + $('#'+id).addClass('active'); }, Calendar:{ overview:function(){ @@ -658,6 +669,7 @@ $(document).ready(function(){ viewDisplay: function(view) { $('#datecontrol_date').html(view.title); $.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name); + Calendar.UI.setViewActive(view.name); if (view.name == 'agendaWeek') { $('#calendar_holder').fullCalendar('option', 'aspectRatio', 0.1); } @@ -689,18 +701,12 @@ $(document).ready(function(){ }); $('#oneweekview_radio').click(function(){ $('#calendar_holder').fullCalendar('changeView', 'agendaWeek'); - Calendar.UI.reseticonhighlight(); - $('#oneweekview_radio').css('color', '#6193CF'); }); $('#onemonthview_radio').click(function(){ $('#calendar_holder').fullCalendar('changeView', 'month'); - Calendar.UI.reseticonhighlight(); - $('#onemonthview_radio').css('color', '#6193CF'); }); $('#listview_radio').click(function(){ $('#calendar_holder').fullCalendar('changeView', 'list'); - Calendar.UI.reseticonhighlight(); - $('#listview_radio').css('color', '#6193CF'); }); $('#today_input').click(function(){ $('#calendar_holder').fullCalendar('today'); diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 929f5b72f9..2d5cdea4d7 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -28,20 +28,6 @@ echo '$(\'#calendar_holder\').fullCalendar(\'gotoDate\', ' . $year . ', ' . --$month . ', ' . $day . ');'; echo '$(\'#dialog_holder\').load(OC.filePath(\'calendar\', \'ajax\', \'editeventform.php\') + \'?id=\' + ' . $_['showevent'] . ' , Calendar.UI.startEventDialog);'; } - - switch(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month')){ - case 'agendaWeek': - echo '$(\'#oneweekview_radio\').css(\'color\', \'#6193CF\');'; - break; - case 'month': - echo '$(\'#onemonthview_radio\').css(\'color\', \'#6193CF\');'; - break; - case 'list': - echo '$(\'#listview_radio\').css(\'color\', \'#6193CF\');'; - break; - default: - break; - } ?> });