automizy-js
Version:
Automizy widget collection
144 lines (141 loc) • 6.83 kB
HTML
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" href="../external/requirejs/require.js">
<link rel="stylesheet" href="../external/multiselect/jquery.multiselect.css">
<link rel="stylesheet" href="../external/multiselect/jquery.multiselect.filter.css">
<link rel="stylesheet" href="../src/automizy.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script src="../external/requirejs/require.js"></script>
<script src="../external/multiselect/jquery.multiselect.min.js"></script>
<script src="../external/multiselect/jquery.multiselect.filter.js"></script>
<script>
var temp;
$(function () {
require([
"../src/automizy.js"
], function ($A) {
var selectSegmentInput = $A.newInput({
label: 'Add to segment',
help: 'Select the segments you want to add the uploaded subscribers to.',
type: 'select',
name: 'segments',
multiselect: $A.d.defines.input.setupSelectObj,
options: [
[0, '--- Nothing ---'],
[12, 'First Segment'],
[15, 'Second Segment']
],
create: function (module, widget) {
$A.newButton({
newRow: true,
text: 'Create new segment',
target: module.d.$widgetInputBox,
click: function () {
newSegmentDialog.draw();
}
});
}
});
var segmentNameInput = $A.newInput({
label: 'Segment name',
help: "Segment name...",
name: 'segment-name'
})
var newSegmentForm = $A.newForm({
inputs: [
segmentNameInput
]
});
var newSegmentDialog = $A.newDialog({
title: 'Add new segment',
hash:'AddNewSegment',
inputs: [
],
buttons: [
{
skin: 'nobox-green',
text: 'Cancel',
float: 'left',
click: function () {
newSegmentDialog.hide();
}
},
{
skin: 'simple-orange',
text: 'Add segment',
float: 'right',
click: function (module, widget) {
$.ajax({
method: 'POST',
url: 'api.example.com/segments',
data: newSegmentForm.json(),
dataType: 'json',
complete: function (data) {
selectSegmentInput.addOptionBefore(12, segmentNameInput.val());
newSegmentDialog.hide();
}
});
}
}
],
content: newSegmentForm
});
var form = $A.newForm({
method: "POST",
enctype: 'multipart/form-data',
inputs: [
{
label: 'Import file',
help: "Select a file to upload that contains contact data that you want to import.",
type: 'file',
name: 'import-subscribers',
accept: ['.csv', '.rar', '.zip', '.tar', '.gz']
},
selectSegmentInput,
{
label: 'Embed images',
help: "This will embed the images from the content inside the email. This may make the email significantly larger.",
name: 'overrideSubscribers',
type: 'checkbox'
}
]
});
var dialog = $A.newDialog({
title: 'Import contacts',
hash:'ImportContacts',
buttons: [
{
skin: 'nobox-green',
text: 'Cancel',
float: 'left',
click: function () {
alert('CANCEL');
dialog.hide();
}
},
{
skin: 'simple-orange',
text: 'Next',
float: 'right',
click: function (module, widget) {
alert('SAVE');
dialog.hide();
}
}
],
content: form,
create: function (module, widget) {
//alert("Now You can see the best dialog ever!");
}
}).draw();
});
});
</script>
</head>
<body></body>
</html>