r252827 - in Products.rendezvous/trunk: Products/rendezvous/browser docs

"Thomas Desvenain" <svn-changes-z4DKO/[email protected]> Wed, 3 Sep 2014 14:00:06 +0000 (UTC)
Newsgroups gmane.comp.web.zope.plone.collective.cvs
Message-ID <[email protected]>
Author: thomasdesvenain
Date: Wed Sep  3 14:00:05 2014
New Revision: 252827

Modified:
   Products.rendezvous/trunk/Products/rendezvous/browser/rendezvous.js
   Products.rendezvous/trunk/docs/HISTORY.txt
Log:
Fix monthes navigation.

Modified: Products.rendezvous/trunk/Products/rendezvous/browser/rendezvous.js
==============================================================================
--- Products.rendezvous/trunk/Products/rendezvous/browser/rendezvous.js	(original)
+++ Products.rendezvous/trunk/Products/rendezvous/browser/rendezvous.js	Wed Sep  3 14:00:05 2014
@@ -2,26 +2,49 @@
 
 
 rendezvous.init = function(){
-	jq('.template-edit_dates').each(rendezvous.initchoicesselection);
-	jq('.template-rendezvous_view').each(rendezvous.inituserchoice);
-	jq('#rendezvous-choose-date').click(rendezvous.startdatechoice);
+    jq('.template-edit_dates').each(rendezvous.initchoicesselection);
+    jq('.template-rendezvous_view').each(rendezvous.inituserchoice);
+    jq('#rendezvous-choose-date').click(rendezvous.startdatechoice);
 };
 
 rendezvous.initchoicesselection = function(){
-	jq('#rendezvous-dates-select a.calendar-date').click(function(){
-		/* first submit the form in case it has been modified */
-	    var datelink = jq(this);
-		var formData = jq('form#rendezvous-edit').serialize();
-		var formAction = jq('form#rendezvous-edit').attr('action');
-		jq.post(formAction, formData, function(){
-	        jq.get(datelink.attr('href') + '&ajax_load=1', function(html){
-	            jq('#rendezvous-edit').html(jq(html).find('#rendezvous-edit').html());
-	            rendezvous.initchoicesselection();
-	        });
-		});
-		return false;
-	});
-	jq('#rendezvous-hours-select input[name="extend"]').click(function(){
+    bind_dates = function (){
+        jq('#rendezvous-dates-select a.calendar-date').click(function(){
+            /* first submit the form in case it has been modified */
+            var datelink = jq(this);
+            var formData = jq('form#rendezvous-edit').serialize();
+            var formAction = jq('form#rendezvous-edit').attr('action');
+            jq.post(formAction, formData, function(){
+                jq.get(datelink.attr('href') + '&ajax_load=1', function(html){
+                    jq('#rendezvous-edit').html(jq(html).find('#rendezvous-edit').html());
+                    rendezvous.initchoicesselection();
+                });
+            });
+            return false;
+        });
+    };
+    bind_dates();
+
+    bind_next_month = function (){
+        jq('#rendezvous-dates-select .calendarHeader a').unbind('click').click(function(){
+            /* update calendar when click on next */
+            var url = jq('base').attr('href') + '/' + jq(this).attr('href');
+            update_calendar_month(url);
+            return false;
+        });
+    };
+    bind_next_month();
+
+    function update_calendar_month(href){
+        jq.get(href, function(html){
+            var new_month = $(html).find('#rendezvous-dates-select .portletCalendar .portletItem');
+            $('#rendezvous-dates-select .portletCalendar .portletItem').replaceWith(new_month);
+            bind_dates();
+            bind_next_month();
+        });
+    }
+
+    jq('#rendezvous-hours-select input[name="extend"]').click(function(){
         var formData = jq('form#rendezvous-edit').serialize();
         var formAction = jq('form#rendezvous-edit').attr('action') + '?extend=1';
         jq.post(formAction, formData, function(html){
@@ -29,50 +52,50 @@
             rendezvous.initchoicesselection();
         });
         return false;
-	});
+    });
 };
 
 rendezvous.inituserchoice = function(){
-	jq('td.selectable').click(rendezvous.toggleuserchoice);
+    jq('td.selectable').click(rendezvous.toggleuserchoice);
 };
 
 rendezvous.toggleuserchoice = function(){
-	var cell = jq(this);
-	var input = cell.children('input');
-	var span = cell.children('span');
-	if(input.attr('value') === ''){
-		/* select value */
-		cell.removeClass('unavailable');
-		cell.removeClass('unknown');
-		cell.addClass('available');
-		input.attr('value', input.attr('id'));
-		span.html('OK');
-	}
-	else{
-		/* unselect value */
-		cell.removeClass('available');
-		cell.addClass('unavailable');
-		input.attr('value', '');
-		span.html('');
-	}
+    var cell = jq(this);
+    var input = cell.children('input');
+    var span = cell.children('span');
+    if(input.attr('value') === ''){
+        /* select value */
+        cell.removeClass('unavailable');
+        cell.removeClass('unknown');
+        cell.addClass('available');
+        input.attr('value', input.attr('id'));
+        span.html('OK');
+    }
+    else{
+        /* unselect value */
+        cell.removeClass('available');
+        cell.addClass('unavailable');
+        input.attr('value', '');
+        span.html('');
+    }
 };
 
 rendezvous.startdatechoice = function(){
-	jq('body').css('cursor', 'pointer');
-	jq('.rendezvous-datechoice').css('color', 'blue');
-	jq('#rendezvous').click(rendezvous.enddatechoice);
-	jq('.rendezvous-datechoice').click(rendezvous.selectdatechoice);
+    jq('body').css('cursor', 'pointer');
+    jq('.rendezvous-datechoice').css('color', 'blue');
+    jq('#rendezvous').click(rendezvous.enddatechoice);
+    jq('.rendezvous-datechoice').click(rendezvous.selectdatechoice);
 };
 
 rendezvous.enddatechoice = function(){
-	jq('body').css('cursor', 'default');
-	jq('#rendezvous').unbind('click');
-	jq('.rendezvous-datechoice').removeAttr('style');
+    jq('body').css('cursor', 'default');
+    jq('#rendezvous').unbind('click');
+    jq('.rendezvous-datechoice').removeAttr('style');
 };
 
 rendezvous.selectdatechoice = function(){
-	var base_url = jq('base').attr('href');
-	var date = jq(this).attr('class').split(' ')[1];
-	window.location.href = base_url + '@@rendezvous_create_event?date=' + date;
+    var base_url = jq('base').attr('href');
+    var date = jq(this).attr('class').split(' ')[1];
+    window.location.href = base_url + '@@rendezvous_create_event?date=' + date;
 };
 jq(document).ready(rendezvous.init);

Modified: Products.rendezvous/trunk/docs/HISTORY.txt
==============================================================================
--- Products.rendezvous/trunk/docs/HISTORY.txt	(original)
+++ Products.rendezvous/trunk/docs/HISTORY.txt	Wed Sep  3 14:00:05 2014
@@ -4,6 +4,9 @@
 1.4.2 (unreleased)
 ------------------
 
+- Fix monthes navigation.
+  [thomasdesvenain]
+
 - On edit view, ajax behavior on date selection and on columns adding.
   [thomasdesvenain]
 

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/