Sidebox calendar - remove borders, header background, month button

This commit is contained in:
Nathan Gray 2016-01-22 00:58:12 +00:00
parent ac4bef3c47
commit edd827b221
5 changed files with 44 additions and 41 deletions

View File

@ -3101,36 +3101,15 @@ app.classes.calendar = AppJS.extend(
{
var datepicker = date_widget.input_date.datepicker("option", {
showButtonPanel: false,
onChangeMonthYear: function(year, month, inst)
{
// Update month button label
var month_button = date_widget.getRoot().getWidgetById('header_month');
if(month_button)
{
var temp_date = new Date(year, month-1, 1,0,0,0);
//temp_date.setUTCMinutes(temp_date.getUTCMinutes() + temp_date.getTimezoneOffset());
month_button.set_label(egw.lang(date('F',temp_date)));
// Store current _displayed_ date in date button for clicking
temp_date.setUTCMinutes(temp_date.getUTCMinutes() - temp_date.getTimezoneOffset());
month_button.btn.attr('data-date', temp_date.toJSON());
}
},
// Mark holidays
beforeShowDay: function (date)
{
var tempDate = new Date();
var today = new Date(tempDate.getFullYear(), tempDate.getUTCMonth(), tempDate.getUTCDate());
var holidays = et2_calendar_view.get_holidays({day_class_holiday: function() {}}, date.getFullYear());
var day_holidays = holidays[''+date.getFullYear() +
sprintf("%02d",date.getMonth()+1) +
sprintf("%02d",date.getDate())];
var css_class = '';
var tooltip = '';
if(date.getTime() == today.getTime())
{
css_class += 'calendar_calToday ';
}
if(typeof day_holidays !== 'undefined' && day_holidays.length)
{
for(var i = 0; i < day_holidays.length; i++)
@ -3190,24 +3169,10 @@ app.classes.calendar = AppJS.extend(
app.calendar.update_state({date: date});
}
});
// Set month button label
var month_button = date_widget.getRoot().getWidgetById('header_month');
if(month_button)
{
var temp_date = new Date(date_widget.get_value());
temp_date.setUTCDate(1);
temp_date.setUTCMinutes(temp_date.getUTCMinutes() + temp_date.getTimezoneOffset());
month_button.set_label(egw.lang(date('F',temp_date)));
// Store current _displayed_ date in date button for clicking
temp_date.setUTCMinutes(temp_date.getUTCMinutes() - temp_date.getTimezoneOffset());
month_button.btn.attr('data-date', temp_date.toJSON());
}
// Dynamic resize to fill sidebox
var preferred_width = $j('#calendar-sidebox_date .ui-datepicker-inline').outerWidth();
var font_ratio = parseFloat(month_button.btn.css('font-size')) / parseFloat($j('#calendar-sidebox_date .ui-datepicker-inline').css('font-size'));
var font_ratio = parseFloat($j(this.sidebox_et2.getDOMNode()).css('font-size')) / parseFloat($j('#calendar-sidebox_date .ui-datepicker-inline').css('font-size'));
$j(window).on('resize.calendar'+date.dom_id, function() {
var percent = 1+(($j(date_widget.getDOMNode()).width() - preferred_width) / preferred_width);

View File

@ -426,6 +426,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
// Set today class - note +1 when dealing with today, as months in JS are 0-11
var today = new Date();
today.setUTCMinutes(today.getUTCMinutes() - today.getTimezoneOffset());
this.title.toggleClass("calendar_calToday", this.options.date === ''+today.getUTCFullYear()+
sprintf("%02d",today.getUTCMonth()+1)+

View File

@ -15,15 +15,12 @@ Egroupware
<template id="calendar.sidebox">
<vbox parent_node="calendar-et2_target">
<textbox id="keywords" class="et2_fullWidth" blur="Search" onchange="app.calendar.update_state({view: 'listview',keywords: widget.getValue()});return false;"/>
<hbox id="date_header" class="et2_fullWidth">
<buttononly id="header_today" label="Today" onclick="
<buttononly id="header_today" label="Today" onclick="
var tempDate = new Date();
var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),0,-tempDate.getTimezoneOffset(),0);
var change = {date: today.toJSON()};
if(app.calendar.state.view == 'planner') { change.planner_days = Math.ceil((new Date(app.calendar.state.last) - new Date(app.calendar.state.first)) / (24*3600000));}
app.calendar.update_state(change);return false;"/>
<buttononly id="header_month" label="Month" onclick="var change = {date: widget.btn.attr('data-date')}; if(app.calendar.state.view == 'planner') { change.planner_days = 0;change.first=change.date;var d = new Date(change.date);d = new Date(d.getFullYear(),d.getUTCMonth() + 1, 0);change.last=d.toJSON();} else if ( app.calendar.state.view == 'listview') {change.filter='month';} else {change.view = 'month';}app.calendar.update_state(change);" />
</hbox>
<date id="date" class="et2_fullWidth" inline="true" onchange="var view_change = app.calendar.sidebox_changes_views.indexOf(app.calendar.state.view);
var update = {date:widget.getValue()};
if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_change ? view_change - 1 : view_change];} else if (app.calendar.state.view == 'listview') {update.filter = 'after';} else if (app.calendar.state.view =='planner') { update.planner_days = 1; } app.calendar.update_state(update);"/>

View File

@ -1302,6 +1302,26 @@ div#calendar-container div.calendar table tbody tr.daysrow:hover {
div#calendar-container div.calendar table tbody tr.rowhilite td {
background-color: #ffc200;
}
/* Sidebox calendar */
#calendar-sidebox_date .ui-widget-header {
background: transparent;
}
#calendar-sidebox_date .ui-widget-content,
#calendar-sidebox_date .ui-state-default,
#calendar-sidebox_date #calendar-sidebox_date .ui-state-hover {
border: none;
padding: 2px;
text-align: center;
}
#calendar-sidebox_date .ui-datepicker td {
padding: 0px;
}
#calendar-sidebox_date .ui-datepicker-today {
background-color: #ffc200;
}
#calendar-sidebox_date .ui-widget-content .ui-state-hover {
background-color: rgba(103, 159, 210, 0.2);
}
#calendar_cat_id,
#calendar_filter,
#uical_select_owner,

View File

@ -1337,7 +1337,27 @@ div#calendar-container {
}
/* Sidebox calendar */
#calendar-sidebox_date {
.ui-widget-header {
background: transparent;
}
.ui-widget-content, .ui-state-default, #calendar-sidebox_date .ui-state-hover {
border: none;
padding: 2px;
text-align: center;
}
.ui-datepicker td {
padding: 0px
}
.ui-datepicker-today {
background-color: @egw_color_1;
}
.ui-widget-content .ui-state-hover {
background-color: @color_hover_row;
}
}
// Select Fields in Sidemenu
#calendar_cat_id,
#calendar_filter,