Vlad Kurkin (b_vladi) wrote in changelog,
Vlad Kurkin
b_vladi
changelog

[ljcom] r11279: LJSUP-10756: Minimalism style. Links at ...

Committer: vkurkin
LJSUP-10756: Minimalism style. Links at the calendar does not work
U   trunk/htdocs/js/jquery/jquery.lj.inlineCalendar.js
Modified: trunk/htdocs/js/jquery/jquery.lj.inlineCalendar.js
===================================================================
--- trunk/htdocs/js/jquery/jquery.lj.inlineCalendar.js	2011-12-20 09:47:51 UTC (rev 11278)
+++ trunk/htdocs/js/jquery/jquery.lj.inlineCalendar.js	2011-12-20 14:58:38 UTC (rev 11279)
@@ -127,8 +127,8 @@
 
 	function View(nodes, styles, o)
 	{
-		this.initialize = function () {
-			this.tbody = this.catchTableStructure();
+		this.initialize = function (date) {
+			this.tbody = this.catchTableStructure(date);
 		};
 
 		this.modelChanged = function (monthDate, events, switcherStates)
@@ -155,7 +155,7 @@
 			this.tbody.appendTo( nodes.table );
 		};
 
-		this.catchTableStructure = function() {
+		this.catchTableStructure = function(date) {
 			var tbody = nodes.tbody[0];
 			nodes.daysCells = [];
 			nodes.daysSpans = [];
@@ -174,13 +174,23 @@
 			}
 			rowsCount = 6;
 			nodes.lastRow = jQuery( tbody.rows[ tbody.rows.length - 1 ] );
+			date = new Date(date);
 
 			for( row = 0; row < rowsCount; ++row ) {
 				for( cell = 0, cellsCount = tbody.rows[ row ].cells.length; cell < cellsCount; ++cell ) {
 					// take into account span inside td
-					var node = jQuery( tbody.rows[ row ].cells[ cell ] );
-					nodes.daysCells.push( node );
-					nodes.daysSpans.push( node.children() );
+					var node = jQuery( tbody.rows[ row ].cells[ cell ] ),
+						children = node.children(),
+						day = children.text().trim();
+
+					if(day) {
+						date.setDate(day);
+						node.data('isActive', true);
+						node.data('day', date);
+					}
+
+					nodes.daysCells.push(node);
+					nodes.daysSpans.push(children);
 				}
 			}
 
@@ -310,7 +320,7 @@
 			this.options.startMonth.setDate( 1 );
 
 			this._view = new (this._getView())( this._nodes, this.options.classNames, this.options );
-			this._view.initialize();
+			this._view.initialize(this.options.currentDate);
 
 			if( this._nodes.table.hasClass( "monday" ) ) {
 				this._setOption( "startAtSunday", false );

Tags: b_vladi, js, ljcom, vkurkin
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments