From edb24fc9eeceaba7dcb98ece5930b01f8e3fd0a7 Mon Sep 17 00:00:00 2001 From: pavel Date: Wed, 25 Mar 2015 19:30:12 +0000 Subject: [PATCH] EXPO-97-2 --- .../includes/accounts/calendar_table.html | 2 +- templates/client/static_client/css/main.css | 1 - .../js/_modules/page.profile.calendar.js | 38 ++++++++----------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/templates/client/includes/accounts/calendar_table.html b/templates/client/includes/accounts/calendar_table.html index 3a81bb28..1262fc14 100644 --- a/templates/client/includes/accounts/calendar_table.html +++ b/templates/client/includes/accounts/calendar_table.html @@ -23,7 +23,7 @@ {% for day in days %} {% ifnotequal day current_day %} -
{{ day|date:"d" }}/{% if LANGUAGE_CODE == 'ru' %}{{ day|get_rus_day }}{% else %}{{ day|date:"D" }}{% endif %}
+
{{ day|date:"d" }}/{% if LANGUAGE_CODE == 'ru' %}{{ day|get_rus_day }}{% else %}{{ day|date:"D" }}{% endif %}
{% else %}
diff --git a/templates/client/static_client/css/main.css b/templates/client/static_client/css/main.css index c0880ca9..6b3aa217 100644 --- a/templates/client/static_client/css/main.css +++ b/templates/client/static_client/css/main.css @@ -9329,7 +9329,6 @@ a.order-button:hover .ob-text, width: 136px; } .calendar-container table td { - width: 115px; border-left: 1px dotted #cccccc; text-align: center; padding: 0; diff --git a/templates/client/static_client/js/_modules/page.profile.calendar.js b/templates/client/static_client/js/_modules/page.profile.calendar.js index 3efe34cd..b9ade3f2 100644 --- a/templates/client/static_client/js/_modules/page.profile.calendar.js +++ b/templates/client/static_client/js/_modules/page.profile.calendar.js @@ -78,19 +78,18 @@ if (EXPO.profile.calendar) { allDays = $calendar.find('.'+self.opt.daysClass+' td').length, stepsCount, currenCount; - self.stepWidth = onestep*width; - self.calendarWidth = width* allDays; + if(currentDay > 0){ currentDay++; stepsCount = allDays / onestep; currenCount = allDays / currentDay; - result = stepsCount - currenCount; + result = stepsCount - Math.floor(currenCount); self.currentDay =currentDay; if (result) { - result = Math.floor(result-1); + result--; offset = onestep * result * width; } else { @@ -108,11 +107,10 @@ if (EXPO.profile.calendar) { this.$leftScroll = $leftScroll; this.$rightScroll = $rightScroll; this.currentOffset = currentWeekOffset(); + //this.currentOffset = 0; + this.scrollStep = scrollStep; this.$scrollBox = $scrollBox; - //$(document).ready(function () { - // - //}); this.$messages = []; $(function () { @@ -140,10 +138,12 @@ if (EXPO.profile.calendar) { }); $(window).load(function () { + self.stepWidth = self.opt.cellsToScroll*self.opt.cellWidth; + self.calendarWidth = self.opt.cellWidth* $calendar.find('.'+self.opt.daysClass+' td').length; $scrollBox.mCustomScrollbar({ axis: 'y', horizontalScroll: true, - setLeft:'-'+EXPO.profile.calendar.currentOffset+'px', + setLeft:'-'+self.currentOffset+'px', mouseWheel:{enable:false}, scrollButtons:{enable:false}, contentTouchScroll:false, @@ -170,14 +170,15 @@ if (EXPO.profile.calendar) { } } }); + $leftScroll.one('click', function () { + self.scrollLeft(self); + }); + $rightScroll.one('click', function () { + self.scrollRight(self); + }); }); - $leftScroll.one('click', function () { - self.scrollLeft(self); - }); - $rightScroll.one('click', function () { - self.scrollRight(self); - }); + $calendarToggle.on('click', function () { var $switch = $(this); @@ -214,7 +215,6 @@ if (EXPO.profile.calendar) { if(!self){ self = this; } - self.$rightScroll.off('click'); if((self.currentOffset + self.stepWidth) < self.calendarWidth){ self.currentOffset+= self.scrollStep; @@ -231,7 +231,6 @@ if (EXPO.profile.calendar) { if(!self){ self = this; } - self.$leftScroll.off('click'); if(self.currentOffset >= self.stepWidth){ self.currentOffset -= self.scrollStep; console.log("!!! left scroll fired!"); @@ -252,12 +251,7 @@ if (EXPO.profile.calendar) { } for (var i =0; i< self.$messages.length; i++){ var marginLeft = parseInt(self.$messages[i].inlineStyle("margin-left")); - if(marginLeft>= 0){ - self.$messages[i].addClass("hidden"); - self.$messages[i].css({marginLeft:self.currentOffset+'px'}); - self.$messages[i].removeClass("hidden"); - - } + self.offsetMessages(self); } }; return that;