Merge remote-tracking branch 'teambox/master'
This commit is contained in:
commit
f01997d4e9
4 changed files with 142 additions and 0 deletions
|
@ -46,6 +46,7 @@ js('date_util.js');
|
|||
js('util.js');
|
||||
|
||||
js('basic/MonthView.js');
|
||||
js('basic/FourWeeksView.js');
|
||||
js('basic/BasicWeekView.js');
|
||||
js('basic/BasicDayView.js');
|
||||
js('basic/BasicView.js');
|
||||
|
|
46
src/basic/FourWeeksView.js
Normal file
46
src/basic/FourWeeksView.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
fcViews.fourWeeks = FourWeeksView;
|
||||
|
||||
function FourWeeksView(element, calendar) {
|
||||
var t = this;
|
||||
|
||||
|
||||
// exports
|
||||
t.render = render;
|
||||
|
||||
|
||||
// imports
|
||||
BasicView.call(t, element, calendar, 'fourWeeks');
|
||||
var opt = t.opt;
|
||||
var renderBasic = t.renderBasic;
|
||||
var formatDates = calendar.formatDates;
|
||||
|
||||
|
||||
|
||||
function render(date, delta) {
|
||||
if (delta) {
|
||||
addDays(date, delta * 7);
|
||||
}
|
||||
var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
|
||||
var end = addDays(cloneDate(start), 7*4);
|
||||
var visStart = cloneDate(start);
|
||||
var visEnd = cloneDate(end);
|
||||
var weekends = opt('weekends');
|
||||
if (!weekends) {
|
||||
skipWeekend(visStart);
|
||||
skipWeekend(visEnd, -1, true);
|
||||
}
|
||||
t.title = formatDates(
|
||||
visStart,
|
||||
addDays(cloneDate(visEnd), -1),
|
||||
opt('titleFormat')
|
||||
);
|
||||
t.start = start;
|
||||
t.end = end;
|
||||
t.visStart = visStart;
|
||||
t.visEnd = visEnd;
|
||||
renderBasic(4, 4, weekends ? 7 : 5, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -29,11 +29,13 @@ var defaults = {
|
|||
// time formats
|
||||
titleFormat: {
|
||||
month: 'MMMM yyyy',
|
||||
fourWeeks: "MMM d[ yyyy]{ '—'[ MMM] d yyyy}",
|
||||
week: "MMM d[ yyyy]{ '—'[ MMM] d yyyy}",
|
||||
day: 'dddd, MMM d, yyyy'
|
||||
},
|
||||
columnFormat: {
|
||||
month: 'ddd',
|
||||
fourWeeks: "ddd",
|
||||
week: 'ddd M/d',
|
||||
day: 'dddd M/d'
|
||||
},
|
||||
|
@ -56,6 +58,7 @@ var defaults = {
|
|||
today: 'today',
|
||||
month: 'month',
|
||||
week: 'week',
|
||||
fourWeeks: "4 weeks",
|
||||
day: 'day'
|
||||
},
|
||||
|
||||
|
|
92
tests/four_weeks.html
Normal file
92
tests/four_weeks.html
Normal file
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<script type='text/javascript' src='../src/_loader.js?debug'></script>
|
||||
<script type='text/javascript'>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,fourWeeks,agendaWeek,basicWeek,agendaDay,basicDay'
|
||||
},
|
||||
//defaultView: 'fourWeeks',
|
||||
editable: true,
|
||||
events: [
|
||||
{
|
||||
title: 'All Day Event',
|
||||
start: new Date(y, m, 1)
|
||||
},
|
||||
{
|
||||
title: 'Long Event',
|
||||
start: new Date(y, m, d-5),
|
||||
end: new Date(y, m, d-2)
|
||||
},
|
||||
{
|
||||
id: 999,
|
||||
title: 'Repeating Event',
|
||||
start: new Date(y, m, d-3, 16, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
id: 999,
|
||||
title: 'Repeating Event',
|
||||
start: new Date(y, m, d+4, 16, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Meeting',
|
||||
start: new Date(y, m, d, 10, 30),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Lunch',
|
||||
start: new Date(y, m, d, 12, 5),
|
||||
end: new Date(y, m, d, 14, 43),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Birthday Party',
|
||||
start: new Date(y, m, d+1, 19, 0),
|
||||
end: new Date(y, m, d+1, 22, 30),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Click for Google',
|
||||
start: new Date(y, m, 28),
|
||||
end: new Date(y, m, 29),
|
||||
url: 'http://google.com/'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<style type='text/css'>
|
||||
|
||||
body {
|
||||
margin-top: 40px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
|
||||
}
|
||||
|
||||
#calendar {
|
||||
width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='calendar'></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue