Skip to content

Instantly share code, notes, and snippets.

@eduardolundgren
Created August 17, 2012 20:05
Show Gist options
  • Save eduardolundgren/3382138 to your computer and use it in GitHub Desktop.
Save eduardolundgren/3382138 to your computer and use it in GitHub Desktop.
YUI Confirmation Panel Calendar
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script src="../../build/aui/aui.js" type="text/javascript"></script>
<link rel="stylesheet" href="../../build/aui-skin-classic/css/aui-skin-classic-all-min.css" type="text/css" media="screen" />
</head>
<body class="yui3-skin-sam">
<script type="text/javascript">
AUI().use('aui-base', 'panel', 'dd-plugin', 'resize-plugin', function(A) {
var confirmationPanel;
var openConfirmationPanel = function(actionName, onlyThisInstanceFn, allFollowingFn, allEventsInFn) {
var content = [];
if (actionName === 'delete') {
content.push('<h3>');
content.push('Delete recurring event');
content.push('</h3>');
content.push('Would you like to delete only this event, all events in the series, or this and all future events in the series?');
}
else {
content.push('<h3>');
content.push('Change recurring event');
content.push('</h3>');
content.push('Would you like to change only this event, all events in the series, or this and all future events in the series?');
}
if (!confirmationPanel) {
confirmationPanel = new A.Panel({
bodyContent: content.join(''),
buttons: [
{
value: 'Only this instance',
action: 'onlyThisInstanceFn'
},
{
value: 'All following',
action: 'allFollowingFn'
},
{
value: 'All events in the series',
action: 'allEventsInFn'
},
{
value: 'Cancel this change',
action: 'hide'
}
],
centered: true,
modal: true,
plugins: [A.Plugin.Drag],
visible: false,
width: 550,
zIndex: 1000
});
}
confirmationPanel.onlyThisInstanceFn = onlyThisInstanceFn;
confirmationPanel.allFollowingFn = allFollowingFn;
confirmationPanel.allEventsInFn = allEventsInFn;
confirmationPanel.render().show();
};
// Example
openConfirmationPanel(
'change',
function() {
alert('Only this instance');
},
function() {
alert('All following');
},
function() {
alert('Cancel this change');
}
);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment