Skip to content

Commit

Permalink
refactoring/bugfixes to selectable code. new methods: select/unselect…
Browse files Browse the repository at this point in the history
…. new options: unselectAuto/unselectCancel
  • Loading branch information
arshaw committed May 23, 2010
1 parent 1b24a5f commit a469d8d
Show file tree
Hide file tree
Showing 18 changed files with 705 additions and 550 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ JS_SRC_FILES = \
${SRC_DIR}/grid.js \
${SRC_DIR}/agenda.js \
${SRC_DIR}/view.js \
${SRC_DIR}/selection_util.js \
${SRC_DIR}/util.js

CSS_SRC_FILES = \
Expand Down Expand Up @@ -37,9 +38,6 @@ zip:
@cat ${SRC_DIR}/gcal.js \
| ${VER_SED} | ${DATE_SED} \
> ${BUILD_DIR}/fullcalendar/gcal.js
@cat ${SRC_DIR}/selectable.js \
| ${VER_SED} | ${DATE_SED} \
> ${BUILD_DIR}/fullcalendar/selectable.js

@echo "compressing js..."
@java -jar ${BUILD_DIR}/compiler.jar --js ${BUILD_DIR}/fullcalendar/fullcalendar.js \
Expand Down
3 changes: 2 additions & 1 deletion examples/agenda-views.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/selection_util.js'></script>
<script type='text/javascript' src='../src/util.js'></script>
<!--</src>-->
<!--
Expand Down Expand Up @@ -111,4 +112,4 @@
<body>
<div id='calendar'></div>
</body>
</html>
</html>
3 changes: 2 additions & 1 deletion examples/basic-views.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/selection_util.js'></script>
<script type='text/javascript' src='../src/util.js'></script>
<!--</src>-->
<!--
Expand Down Expand Up @@ -111,4 +112,4 @@
<body>
<div id='calendar'></div>
</body>
</html>
</html>
3 changes: 2 additions & 1 deletion examples/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/selection_util.js'></script>
<script type='text/javascript' src='../src/util.js'></script>
<!--</src>-->
<!--
Expand Down Expand Up @@ -106,4 +107,4 @@
<body>
<div id='calendar'></div>
</body>
</html>
</html>
1 change: 1 addition & 0 deletions examples/gcal.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/util.js'></script>
<script type='text/javascript' src='../src/selection_util.js'></script>
<script type='text/javascript' src='../src/gcal.js'></script>
<!--</src>-->
<!--
Expand Down
1 change: 1 addition & 0 deletions examples/json.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/selection_util.js'></script>
<script type='text/javascript' src='../src/util.js'></script>
<!--</src>-->
<!--
Expand Down
46 changes: 18 additions & 28 deletions examples/selectable.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/selection_util.js'></script>
<script type='text/javascript' src='../src/util.js'></script>
<script type='text/javascript' src='../src/selectable.js'></script>
<!--</src>-->
<!--
<dist>
Expand All @@ -24,7 +24,6 @@
<script type='text/javascript' src='../jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../jquery/ui.resizable.js'></script>
<script type='text/javascript' src='../fullcalendar.min.js'></script>
<script type='text/javascript' src='../selectable.js'></script>
</dist>
-->
<script type='text/javascript'>
Expand All @@ -36,39 +35,30 @@
var m = date.getMonth();
var y = date.getFullYear();

$('#calendar').fullCalendar({
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,

/********** new selecting options **********/

selectable: true, // activate selecting!
unselectable: true, // automatically hide the selection when user clicks elsewhere? (defaults to true)
selectHelper: true, // use a "fake" event for selecting? (only works in agenda views right now)
select: function(start, end, allDay, view) {
console.log(
'---- selection ----\n' +
'start: ' + start + '\n' +
'end: ' + end + '\n' + // exclusive!!
'allDay: ' + allDay
);
/*
if (confirm("clear the selection?")) {
$('#calendar').fullCalendar('unselect'); // 'unselect' method to manually clear selection
// a 'select' method coming soon...
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
);
}
*/
},
unselect: function() {
console.log('unselected');
calendar.fullCalendar('unselect');
},

/******************************************/

editable: true,
events: [
{
title: 'All Day Event',
Expand Down
3 changes: 2 additions & 1 deletion examples/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/selection_util.js'></script>
<script type='text/javascript' src='../src/util.js'></script>
<!--</src>-->
<!--
Expand Down Expand Up @@ -113,4 +114,4 @@
<body>
<div id='calendar'></div>
</body>
</html>
</html>
Loading

0 comments on commit a469d8d

Please sign in to comment.