EXPO-11 frontend part

remotes/origin/1203
pavel 11 years ago
parent e0ae0e7893
commit 0abdd3f59a
  1. 8
      templates/client/includes/accounts/calendar_table.html
  2. 11
      templates/client/static_client/css/main.css
  3. 2
      templates/client/static_client/css_min/main.min.css
  4. 17
      templates/client/static_client/js/_modules/block.common.js
  5. 57
      templates/client/static_client/js/_modules/page.profile.calendar.js
  6. 2
      templates/client/static_client/js_min/_modules/block.common.min.js
  7. 2
      templates/client/static_client/js_min/_modules/page.profile.calendar.min.js

@ -9,9 +9,9 @@
<div class="ep-sect-body calenadar-body">
<header>
<div class="pc-month-wrap">
<a class="pcm-prev" href="/profile/calendar/?year={{ days.15|add_month:'-1'|date:'Y' }}&month={{ days.0|add_month:'-1'|date:'m' }}">&lt;</a>
<div class="pc-month">{{ days.15|date:"F"}}’{{ days.15|date:"y"}}</div>
<a class="pcm-next" href="/profile/calendar/?year={{ days.15|add_month:'1'|date:'Y' }}&month={{ days.15|add_month:'1'|date:'m' }}">&gt;</a>
<a class="pcm-prev" href="/profile/calendar/?year={{ days.0|add_month:'-1'|date:'Y' }}&month={{ days.0|add_month:'-1'|date:'m' }}">&lt;</a>
<div class="pc-month">{{ days.0|date:"F"}}’{{ days.0|date:"y"}}</div>
<a class="pcm-next" href="/profile/calendar/?year={{ days.0|add_month:'1'|date:'Y' }}&month={{ days.0|add_month:'1'|date:'m' }}">&gt;</a>
</div>
</header>
<div class="cal-wrap">
@ -53,7 +53,7 @@
{# здесь ячейка с днями без событий #}
<td class="c-cur no-events" colspan="{{ day_colspan|get_item:day|get_item:'counter' }}">
<div class="c-event">
<div class="ce-wrap">{% trans "Нет отмеченых событий" %}</div>
<div class="ce-wrap"><div class="message">{% trans "Нет отмеченых событий" %}</div></div>
</div>
</td>

@ -12741,6 +12741,10 @@ hr + .rq-note {
.calenadar-body{
overflow: hidden;
}
.calenadar-body .mCSB_scrollTools_horizontal{
opacity: 0!important;
}
.no-events .c-event{
background-color: #CACACA;
}
@ -12753,10 +12757,17 @@ hr + .rq-note {
font-size: 20px;
/*line-height: 44px;*/
color: #464646;
overflow: hidden;
font-family: 'dindisplay_pro';
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
.no-events .c-event .ce-wrap .message{
text-align: center;
transition: all 0.8s ease-In;
}
.no-events .c-event .ce-wrap.small{
font-size: 14px;
padding-top: 14px;

File diff suppressed because one or more lines are too long

@ -216,7 +216,22 @@ if (EXPO.common){
});
/**
* very simple (probably in much need of improvement) Jquery plugin I've thrown together that will get you the value of an inline style property
*/
(function ($) {
$.fn.inlineStyle = function (prop) {
var styles = this.attr("style"),
value;
styles && styles.split(";").forEach(function (e) {
var style = e.split(":");
if ($.trim(style[0]) === prop) {
value = style[1];
}
});
return value;
};
}(jQuery));
/**
* current module general initialization
* @param {Object} options - options recieved from web page view

@ -36,6 +36,11 @@ if (EXPO.profile.calendar) {
$calendarToggle = $('.' + this.opt.calendarToggleClass),
scrollStep = this.opt.cellWidth * this.opt.cellsToScroll,
index = 0,
/**
*offset to curent week ( week in which today is)
* @returns {number} - offset in pixels
*/
//
currentWeekOffset = function () {
var offset = 0,
result = 0,
@ -47,8 +52,10 @@ if (EXPO.profile.calendar) {
stepsCount = allDays / onestep,
currenCount = allDays / currentDay;
result = stepsCount - currenCount;
self.stepWidth = onestep*width;
self.calendarWidth = width* allDays;
if (result) {
result = Math.round(result);
result = Math.floor(result);
offset = onestep * result * width;
} else {
@ -59,11 +66,22 @@ if (EXPO.profile.calendar) {
return offset;
};
this.currentOffset = currentWeekOffset();
//$(document).ready(function () {
//
//});
this.$messages = []
$(function () {
$noEventsField.each(function () {
if (!$(this).attr('colspan') || $(this).attr('colspan') == 1) {
$(this).find('.' + self.opt.eventWrapClass).addClass('small');
}else if($(this).width() > self.stepWidth){
self.$messages.push(
$('.message',$(this))
.width(self.stepWidth)
.css({marginLeft:self.currentOffset+'px'})
);
}
});
$('.' + self.opt.eventsClass).each(function () {
@ -82,19 +100,50 @@ if (EXPO.profile.calendar) {
$scrollBox.mCustomScrollbar({
axis: 'y',
horizontalScroll: true,
setLeft:'-'+EXPO.profile.calendar.currentOffset+'px',
mouseWheel:{enable:false},
scrollButtons:{enable:false},
contentTouchScroll:false,
scrollInertia:1000,
timeout:0,
advanced: { // Advanced options
autoScrollOnFocus: false,
updateOnContentResize: false, // Scrollbar will be updated on content resize
updateOnBrowserResize: false // Scrollbar will be updated on browser resize
},
keyboard:{
enable:false
}
});
$scrollBox.mCustomScrollbar("scrollTo", currentWeekOffset());
//$('.mCSB_scrollTools_horizontal',$scrollBox).hide();
//$('.mCSB_scrollTools_horizontal',$scrollBox).css({'opacity':0});
//$scrollBox.mCustomScrollbar("scrollTo", currentWeekOffset());
});
$leftScroll.on('click', function () {
$scrollBox.mCustomScrollbar("scrollTo", '+=' + scrollStep);
if(self.currentOffset >= self.stepWidth){
self.currentOffset -= scrollStep;
$scrollBox.mCustomScrollbar("scrollTo", '+=' + scrollStep);
for (var i =0; i< self.$messages.length; i++){
var marginLeft = parseInt(self.$messages[i].inlineStyle("margin-left"));
if(marginLeft> 0){
self.$messages[i].css({marginLeft:self.currentOffset+'px'});
}
}
}
});
$rightScroll.on('click', function () {
$scrollBox.mCustomScrollbar("scrollTo", '-=' + scrollStep);
if((self.currentOffset + self.stepWidth) < self.calendarWidth){
self.currentOffset+= scrollStep;
$scrollBox.mCustomScrollbar("scrollTo", '-=' + scrollStep);
for (var i =0; i< self.$messages.length; i++){
var marginLeft = parseInt(self.$messages[i].inlineStyle("margin-left"));
if((marginLeft +self.$messages[i].width())< self.calendarWidth){
self.$messages[i].css({marginLeft:self.currentOffset+'px'});
}
}
}
});
$calendarToggle.on('click', function () {
var $switch = $(this);

File diff suppressed because one or more lines are too long

@ -1 +1 @@
var EXPO=EXPO||{};EXPO.profile=EXPO.profile||{},EXPO.profile.calendar?console.warn("WARNING: EXPO.profile.calendar is already defined!"):EXPO.profile.calendar=function(){var o=(EXPO.common,{});return o.opt={},$(function(){}),o.init=function(o){$.extend(this.opt,o);var t=this,s=$("#"+this.opt.scrollBoxId),l=$("#"+this.opt.calenadrId),n=(l.find("td."+this.opt.currentDayClass).index()*this.opt.cellWidth,$("#"+this.opt.scrollLeftId)),e=$("#"+this.opt.scrollRightId),a=$("."+this.opt.noEventsClass),i=$("."+this.opt.calendarToggleClass),c=this.opt.cellWidth*this.opt.cellsToScroll,r=0,d=function(){var o=0,s=0,l=t.opt.cellWidth,n=$("#"+t.opt.calenadrId),e=n.find("td."+t.opt.currentDayClass).index()+1,a=t.opt.cellsToScroll,i=n.find("."+t.opt.daysClass+" td").length,c=i/a,r=i/e;return s=c-r,s?(s=Math.round(s),o=a*s*l):o=0,o};$(function(){a.each(function(){$(this).attr("colspan")&&1!=$(this).attr("colspan")||$(this).find("."+t.opt.eventWrapClass).addClass("small")}),$("."+t.opt.eventsClass).each(function(){r++,3==r&&$(this).addClass("grey"),4==r&&($(this).addClass("grey"),r=0)})}),$(window).load(function(){s.mCustomScrollbar({axis:"y",horizontalScroll:!0,advanced:{autoScrollOnFocus:!1,updateOnContentResize:!1,updateOnBrowserResize:!1}}),s.mCustomScrollbar("scrollTo",d())}),n.on("click",function(){s.mCustomScrollbar("scrollTo","+="+c)}),e.on("click",function(){s.mCustomScrollbar("scrollTo","-="+c)}),i.on("click",function(){var o=$(this),t=o.closest(".ep-sect"),s=t.children("div.ep-sect-body");return t.hasClass("eps-opened")?(e.hide(),n.hide(),s.stop().animate({opacity:0},300,function(){t.removeClass("eps-opened")})):(e.show(),n.show(),s.stop().animate({opacity:1},300,function(){t.addClass("eps-opened")})),!1})},o}();
var EXPO=EXPO||{};EXPO.profile=EXPO.profile||{},EXPO.profile.calendar?console.warn("WARNING: EXPO.profile.calendar is already defined!"):EXPO.profile.calendar=function(){var t=(EXPO.common,{});return t.opt={},$(function(){}),t.init=function(t){$.extend(this.opt,t);var e=this,s=$("#"+this.opt.scrollBoxId),n=$("#"+this.opt.calenadrId),o=(n.find("td."+this.opt.currentDayClass).index()*this.opt.cellWidth,$("#"+this.opt.scrollLeftId)),a=$("#"+this.opt.scrollRightId),l=$("."+this.opt.noEventsClass),i=$("."+this.opt.calendarToggleClass),r=this.opt.cellWidth*this.opt.cellsToScroll,c=0,d=function(){var t=0,s=0,n=e.opt.cellWidth,o=$("#"+e.opt.calenadrId),a=o.find("td."+e.opt.currentDayClass).index()+1,l=e.opt.cellsToScroll,i=o.find("."+e.opt.daysClass+" td").length,r=i/l,c=i/a;return s=r-c,e.stepWidth=l*n,e.calendarWidth=n*i,s?(s=Math.floor(s),t=l*s*n):t=0,t};this.currentOffset=d(),this.$messages=[],$(function(){l.each(function(){$(this).attr("colspan")&&1!=$(this).attr("colspan")?$(this).width()>e.stepWidth&&e.$messages.push($(".message",$(this)).width(e.stepWidth).css({marginLeft:e.currentOffset+"px"})):$(this).find("."+e.opt.eventWrapClass).addClass("small")}),$("."+e.opt.eventsClass).each(function(){c++,3==c&&$(this).addClass("grey"),4==c&&($(this).addClass("grey"),c=0)})}),$(window).load(function(){s.mCustomScrollbar({axis:"y",horizontalScroll:!0,setLeft:"-"+EXPO.profile.calendar.currentOffset+"px",mouseWheel:{enable:!1},scrollButtons:{enable:!1},contentTouchScroll:!1,scrollInertia:1e3,timeout:0,advanced:{autoScrollOnFocus:!1,updateOnContentResize:!1,updateOnBrowserResize:!1},keyboard:{enable:!1}})}),o.on("click",function(){if(e.currentOffset>=e.stepWidth){e.currentOffset-=r,s.mCustomScrollbar("scrollTo","+="+r);for(var t=0;t<e.$messages.length;t++){var n=parseInt(e.$messages[t].inlineStyle("margin-left"));n>0&&e.$messages[t].css({marginLeft:e.currentOffset+"px"})}}}),a.on("click",function(){if(e.currentOffset+e.stepWidth<e.calendarWidth){e.currentOffset+=r,s.mCustomScrollbar("scrollTo","-="+r);for(var t=0;t<e.$messages.length;t++){var n=parseInt(e.$messages[t].inlineStyle("margin-left"));n+e.$messages[t].width()<e.calendarWidth&&e.$messages[t].css({marginLeft:e.currentOffset+"px"})}}}),i.on("click",function(){var t=$(this),e=t.closest(".ep-sect"),s=e.children("div.ep-sect-body");return e.hasClass("eps-opened")?(a.hide(),o.hide(),s.stop().animate({opacity:0},300,function(){e.removeClass("eps-opened")})):(a.show(),o.show(),s.stop().animate({opacity:1},300,function(){e.addClass("eps-opened")})),!1})},t}();
Loading…
Cancel
Save