Rename selectable.html -> calendar.html
This commit is contained in:
parent
7ba91cd1c9
commit
5c6870d279
2 changed files with 80 additions and 123 deletions
80
megaproject/templates/views/calendar.html
Executable file
80
megaproject/templates/views/calendar.html
Executable file
|
|
@ -0,0 +1,80 @@
|
|||
<div id='calendar'></div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
|
||||
var calendar = $('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
selectable: true,
|
||||
selectHelper: true,
|
||||
select: function (start, end, allDay) {
|
||||
var title = prompt('Event Title:');
|
||||
if (title) {
|
||||
calendar.fullCalendar('renderEvent',
|
||||
{
|
||||
title: title,
|
||||
start: start,
|
||||
end: end,
|
||||
allDay: allDay
|
||||
},
|
||||
true // make the event "stick"
|
||||
);
|
||||
}
|
||||
calendar.fullCalendar('unselect');
|
||||
},
|
||||
editable: true,
|
||||
|
||||
eventClick: function (event) {
|
||||
// opens events in a popup window
|
||||
window.open(event.url, 'gcalevent', 'width=700,height=600');
|
||||
return false;
|
||||
},
|
||||
|
||||
loading: function (bool) {
|
||||
if (bool) {
|
||||
$('#loading').show();
|
||||
} else {
|
||||
$('#loading').hide();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
url: '/events',
|
||||
type: 'POST',
|
||||
data: {
|
||||
custom_param1: 'something',
|
||||
custom_param2: 'somethingelse'
|
||||
},
|
||||
error: function () {
|
||||
alert('there was an error while fetching events!');
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data)
|
||||
}
|
||||
//color: '#eee', // a non-ajax option
|
||||
//textColor: 'black' // a non-ajax option
|
||||
},
|
||||
|
||||
// any other sources...
|
||||
// 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link href='../../static/css/fullcalendar.css' rel='stylesheet'/>
|
||||
<link href='../../static/css/fullcalendar.print.css' rel='stylesheet' media='print'/>
|
||||
<script src='../../static/js/jquery-1.9.1.min.js'></script>
|
||||
<script src='../../static/js/jquery-ui-1.10.2.custom.min.js'></script>
|
||||
<script src='../../static/js/fullcalendar.min.js'></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
|
||||
var calendar = $('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
selectable: true,
|
||||
selectHelper: true,
|
||||
select: function (start, end, allDay) {
|
||||
var title = prompt('Event Title:');
|
||||
if (title) {
|
||||
calendar.fullCalendar('renderEvent',
|
||||
{
|
||||
title: title,
|
||||
start: start,
|
||||
end: end,
|
||||
allDay: allDay
|
||||
},
|
||||
true // make the event "stick"
|
||||
);
|
||||
}
|
||||
calendar.fullCalendar('unselect');
|
||||
},
|
||||
editable: true,
|
||||
events: 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic',
|
||||
|
||||
eventClick: function (event) {
|
||||
// opens events in a popup window
|
||||
window.open(event.url, 'gcalevent', 'width=700,height=600');
|
||||
return false;
|
||||
},
|
||||
|
||||
loading: function (bool) {
|
||||
if (bool) {
|
||||
$('#loading').show();
|
||||
} else {
|
||||
$('#loading').hide();
|
||||
}
|
||||
},
|
||||
|
||||
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, 0),
|
||||
end: new Date(y, m, d, 14, 0),
|
||||
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>
|
||||
|
||||
#calendar {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='calendar'></div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in a new issue