Valerii Vasin (valerii) wrote in changelog,
Valerii Vasin
valerii
changelog

[ljcom] r12893: LJSUP-14202: [Friends Feed] Future dates...

Committer: vvasin
LJSUP-14202: [Friends Feed] Future dates in calendar shouldn't be clickable. Add ability to use object ass allRefs option.
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	2012-11-13 16:08:15 UTC (rev 12892)
+++ trunk/htdocs/js/jquery/jquery.lj.inlineCalendar.js	2012-11-13 16:19:22 UTC (rev 12893)
@@ -4,7 +4,7 @@
  * Copyright 2011, dmitry.petrov@sup.com
  *
  * http://docs.jquery.com/UI
- * 
+ *
  * Depends:
  *	jquery.ui.core.js
  *	jquery.ui.widget.js
@@ -22,7 +22,8 @@
  * Options:
  *  - dayRef: Format of the url that will be attached to each day in the calendar.
  *  - allRefs: Wether to attach links to days in the calendar.
- *  and override currentDate on success.
+ *    and override currentDate on success.
+ *    Could be: true/false/Object {from: Date, to: Date} (all fields are not required)
  *  - activeFrom: Days before this will be inactive in calendar.
  *  - actoveUntil: Days after this willbe inactive incalendar.
  *  - startMonth: Widget will not allow to switch calendar pane to the month before this.
@@ -279,11 +280,29 @@
 				cell.addClass( styles.inactive );
 				span.html(d.getDate());
 			} else if( hasEvents || o.allRefs ) {
-				cell.removeClass( styles.inactive );
-				span.html( jQuery( '<a />', {
+
+				var _tmpAllRefs = true;
+				if (o.allRefs && typeof o.allRefs === 'object') {
+					if (o.allRefs.from && d < o.allRefs.from) {
+						_tmpAllRefs = false;
+					}
+
+					if (o.allRefs.to && d > o.allRefs.to) {
+						_tmpAllRefs = false;
+					}
+				}
+
+				if (_tmpAllRefs) {
+					cell.removeClass( styles.inactive );
+					span.html( $( '<a />', {
 						html: d.getDate(),
 						href: LJ.Util.Date.format( d, o.dayRef )
-					} ) );
+					}));
+				} else {
+					cell.removeClass(styles.inactive);
+					span.html(d.getDate());
+				}
+
 			} else {
 				cell.removeClass( styles.inactive );
 				span.html(d.getDate());
@@ -563,7 +582,7 @@
 		getElement: function( name ) {
 			if( name in this._nodes ) {
 				return this._nodes[ name ];
-			} else { 
+			} else {
 				return null;
 			}
 		}

Tags: invis89, js, ljcom, vvasin
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