Initial commit: CloudOps infrastructure platform
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"submission":{"id":13,"ipAddress":{},"form":{"id":4,"name":"lead points","alias":"leadpoints","category":null},"lead":{"id":26,"points":10,"color":null,"fields":{"core":{"title":{"id":"1","label":"Title","alias":"title","type":"lookup","group":"core","value":null},"firstname":{"id":"2","label":"First Name","alias":"firstname","type":"text","group":"core","value":null},"lastname":{"id":"3","label":"Last Name","alias":"lastname","type":"text","group":"core","value":null},"company":{"id":"4","label":"Company","alias":"company","type":"lookup","group":"core","value":null},"position":{"id":"5","label":"Position","alias":"position","type":"text","group":"core","value":null},"email":{"id":"6","label":"Email","alias":"email","type":"email","group":"core","value":"email@formsubmit.com"},"phone":{"id":"7","label":"Phone","alias":"phone","type":"tel","group":"core","value":null},"mobile":{"id":"8","label":"Mobile","alias":"mobile","type":"tel","group":"core","value":null},"fax":{"id":"9","label":"Fax","alias":"fax","type":"text","group":"core","value":null},"address1":{"id":"10","label":"Address Line 1","alias":"address1","type":"text","group":"core","value":null},"address2":{"id":"11","label":"Address Line 2","alias":"address2","type":"text","group":"core","value":null},"city":{"id":"12","label":"City","alias":"city","type":"lookup","group":"core","value":null},"state":{"id":"13","label":"State","alias":"state","type":"region","group":"core","value":null},"zipcode":{"id":"14","label":"Zipcode","alias":"zipcode","type":"lookup","group":"core","value":null},"country":{"id":"15","label":"Country","alias":"country","type":"country","group":"core","value":null},"website":{"id":"16","label":"Website","alias":"website","type":"text","group":"core","value":null}},"social":{"twitter":{"id":"17","label":"Twitter","alias":"twitter","type":"text","group":"social","value":null},"facebook":{"id":"18","label":"Facebook","alias":"facebook","type":"text","group":"social","value":null},"skype":{"id":"20","label":"Skype","alias":"skype","type":"text","group":"social","value":null},"instagram":{"id":"21","label":"Instagram","alias":"instagram","type":"text","group":"social","value":null},"foursquare":{"id":"22","label":"Foursquare","alias":"foursquare","type":"text","group":"social","value":null}},"personal":[],"professional":[]}},"trackingId":"dd4adafdabe75184bc206037a15d9f840adb5ec0","dateSubmitted":"2015-08-26T01:30:34+00:00","referer":"http:\/\/mautic-gh.com\/s\/forms\/preview\/4","page":null,"results":{"email":"email@formsubmit.com"}}}
|
||||
@@ -0,0 +1,250 @@
|
||||
/* FormBundle */
|
||||
|
||||
/* Panel Styles */
|
||||
.panel2 {
|
||||
--layout-density-padding-inline-local: 3px 6px;
|
||||
-webkit-box-shadow: 0px 1px 1px #00000012;
|
||||
box-shadow: 0px 1px 1px #00000012;
|
||||
zoom: 0.9;
|
||||
}
|
||||
.panel2 label {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* Form Submit Action Group Header */
|
||||
.form-submitaction-group-header {
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Form Field Wrapper */
|
||||
.form-field-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.form-field-wrapper img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.form-field-wrapper:has(> .panel2) {
|
||||
margin: 0 25px 25px 25px;
|
||||
}
|
||||
|
||||
/* Field Width Classes */
|
||||
.mauticform-full-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mauticform-three-quarters-width {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.mauticform-two-thirds-width {
|
||||
width: 66.66%;
|
||||
}
|
||||
|
||||
.mauticform-half-width {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.mauticform-one-third-width {
|
||||
width: 33.33%;
|
||||
}
|
||||
|
||||
.mauticform-one-quarter-width {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
|
||||
/* Responsive adjustment for mobile */
|
||||
@media (max-width: 767px) {
|
||||
.mauticform-three-quarters-width,
|
||||
.mauticform-two-thirds-width,
|
||||
.mauticform-half-width,
|
||||
.mauticform-one-third-width,
|
||||
.mauticform-one-quarter-width {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mautic Forms Fields and Actions */
|
||||
#mauticforms_actions .mauticform-row .action-label {
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
}
|
||||
#mauticforms_actions .mauticform-row .action-descr {
|
||||
font-size: 0.9em;
|
||||
display: block;
|
||||
}
|
||||
@media (min-width: 768px) { .form-buttons { top: 8px; }}
|
||||
.form-buttons {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
bottom: 10px;
|
||||
z-index: 1;
|
||||
height: fit-content;
|
||||
}
|
||||
#mauticforms_fields .chosen-container-single .chosen-search input[type="text"] {
|
||||
width: 100%;
|
||||
}
|
||||
#mauticforms_fields .panel-footer {
|
||||
padding: 3px 15px;
|
||||
}
|
||||
#mauticforms_fields input[type="date"],
|
||||
#mauticforms_fields input[type="time"],
|
||||
#mauticforms_fields input[type="datetime-local"],
|
||||
#mauticforms_fields input[type="month"] {
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
/* Textarea Form HTML */
|
||||
textarea.form-html {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
/* Column Widths */
|
||||
.col-form-id, .col-formresult-id {
|
||||
width: 75px;
|
||||
}
|
||||
.col-form-submissions {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
/* Form Result List */
|
||||
.formresult-list th .input-group {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.formresult-list th:not(.col-formresult-id):not(.col-actions) {
|
||||
min-width: 125px;
|
||||
}
|
||||
.formresult-list th.col-formresult-id {
|
||||
min-width: 125px;
|
||||
}
|
||||
|
||||
/* Inline Spacer */
|
||||
.inline-spacer {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
/* Mautic Form Wrapper */
|
||||
.mauticform_wrapper {
|
||||
max-width: 600px;
|
||||
margin: 10px auto;
|
||||
}
|
||||
.mauticform-innerform {
|
||||
width: 100%;
|
||||
}
|
||||
.mauticform-post-success {
|
||||
text-align: center;
|
||||
}
|
||||
.mauticform-name {
|
||||
font-weight: bold;
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.mauticform-description {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.mauticform-error {
|
||||
margin-bottom: 10px;
|
||||
color: red;
|
||||
}
|
||||
.mauticform-message {
|
||||
margin-bottom: 10px;
|
||||
color: green;
|
||||
}
|
||||
.mauticform-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
position: relative;
|
||||
min-height: 60px;
|
||||
padding: 10px;
|
||||
}
|
||||
.mauticform-label {
|
||||
font-size: 1.1em;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.mauticform-row.mauticform-required .mauticform-label:after {
|
||||
color: #e32;
|
||||
content: " *";
|
||||
display: inline;
|
||||
}
|
||||
.mauticform-helpmessage {
|
||||
display: block;
|
||||
font-size: 0.9em;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.mauticform-errormsg {
|
||||
display: block;
|
||||
color: red;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.mauticform-selectbox,
|
||||
.mauticform-input,
|
||||
.mauticform-textarea {
|
||||
width: 75%;
|
||||
max-width: 500px;
|
||||
padding: 0.5em 0.5em;
|
||||
border: 1px solid #CCC;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.mauticform-checkboxgrp-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.mauticform-checkboxgrp-row input[type="radio"],
|
||||
.mauticform-checkboxgrp-row input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
.mauticform-checkboxgrp-label {
|
||||
font-weight: normal;
|
||||
line-height: 1em;
|
||||
}
|
||||
/* Checkbox group styling */
|
||||
.mauticform-checkboxgrp-checkbox {
|
||||
margin-right: 5px;
|
||||
}
|
||||
/* Radio group row styling */
|
||||
.mauticform-radiogrp-row {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.mauticform-radiogrp-label {
|
||||
font-weight: normal;
|
||||
}
|
||||
input[type="radio"].mauticform-radiogrp-radio {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: -3px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
/* Mautic Form Button Styles */
|
||||
.mauticform-button-wrapper .mauticform-button,
|
||||
.mauticform-pagebreak-wrapper .mauticform-pagebreak {
|
||||
margin-bottom: 0;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
font-size: 13px;
|
||||
line-height: 1.3856;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.mauticform-button-wrapper .mauticform-button.btn-ghost[disabled],
|
||||
.mauticform-pagebreak-wrapper .mauticform-pagebreak.btn-ghost[disabled] {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.mauticform-pagebreak-wrapper .mauticform-button-wrapper {
|
||||
display: inline;
|
||||
}
|
||||
@@ -0,0 +1,410 @@
|
||||
//FormBundle
|
||||
Mautic.formOnLoad = function (container) {
|
||||
|
||||
if (mQuery(container + ' #list-search').length) {
|
||||
Mautic.activateSearchAutocomplete('list-search', 'form.form');
|
||||
}
|
||||
|
||||
Mautic.toggleThemeSelectorVisibility();
|
||||
mQuery('#mauticform_renderStyle_0, #mauticform_renderStyle_1').on('change', Mautic.toggleThemeSelectorVisibility);
|
||||
|
||||
Mautic.formBuilderNewComponentInit();
|
||||
Mautic.iniNewConditionalField();
|
||||
|
||||
var bodyOverflow = {};
|
||||
|
||||
if (mQuery('#mauticforms_fields')) {
|
||||
//make the fields sortable
|
||||
mQuery('#mauticforms_fields').sortable({
|
||||
items: '.form-field-wrapper',
|
||||
cancel: '',
|
||||
helper: function(e, ui) {
|
||||
ui.children().each(function() {
|
||||
mQuery(this).width(mQuery(this).width());
|
||||
});
|
||||
|
||||
// Fix body overflow that messes sortable up
|
||||
bodyOverflow.overflowX = mQuery('body').css('overflow-x');
|
||||
bodyOverflow.overflowY = mQuery('body').css('overflow-y');
|
||||
mQuery('body').css({
|
||||
overflowX: 'visible',
|
||||
overflowY: 'visible'
|
||||
});
|
||||
|
||||
return ui;
|
||||
},
|
||||
scroll: true,
|
||||
axis: 'y',
|
||||
containment: '#mauticforms_fields .drop-here',
|
||||
stop: function(e, ui) {
|
||||
// Restore original overflow
|
||||
mQuery('body').css(bodyOverflow);
|
||||
mQuery(ui.item).attr('style', '');
|
||||
|
||||
mQuery.ajax({
|
||||
type: "POST",
|
||||
url: mauticAjaxUrl + "?action=form:reorderFields",
|
||||
data: mQuery('#mauticforms_fields').sortable("serialize", {attribute: 'data-sortable-id'}) + "&formId=" + mQuery('#mauticform_sessionId').val()
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Mautic.initFormFieldButtons();
|
||||
}
|
||||
|
||||
if (mQuery('#mauticforms_actions')) {
|
||||
//make the fields sortable
|
||||
mQuery('#mauticforms_actions').sortable({
|
||||
items: '.panel',
|
||||
cancel: '',
|
||||
helper: function(e, ui) {
|
||||
ui.children().each(function() {
|
||||
mQuery(this).width(mQuery(this).width());
|
||||
});
|
||||
|
||||
// Fix body overflow that messes sortable up
|
||||
bodyOverflow.overflowX = mQuery('body').css('overflow-x');
|
||||
bodyOverflow.overflowY = mQuery('body').css('overflow-y');
|
||||
mQuery('body').css({
|
||||
overflowX: 'visible',
|
||||
overflowY: 'visible'
|
||||
});
|
||||
|
||||
return ui;
|
||||
},
|
||||
scroll: true,
|
||||
axis: 'y',
|
||||
containment: '#mauticforms_actions .drop-here',
|
||||
stop: function(e, ui) {
|
||||
// Restore original overflow
|
||||
mQuery('body').css(bodyOverflow);
|
||||
mQuery(ui.item).attr('style', '');
|
||||
|
||||
mQuery.ajax({
|
||||
type: "POST",
|
||||
url: mauticAjaxUrl + "?action=form:reorderActions",
|
||||
data: mQuery('#mauticforms_actions').sortable("serialize") + "&formId=" + mQuery('#mauticform_sessionId').val()
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
mQuery('#mauticforms_actions .mauticform-row').on('dblclick.mauticformactions', function(event) {
|
||||
event.preventDefault();
|
||||
mQuery(this).find('.btn-edit').first().click();
|
||||
});
|
||||
}
|
||||
|
||||
if (mQuery('#mauticform_formType').length && mQuery('#mauticform_formType').val() == '') {
|
||||
mQuery('body').addClass('noscroll');
|
||||
}
|
||||
|
||||
Mautic.initHideItemButton('#mauticforms_fields');
|
||||
Mautic.initHideItemButton('#mauticforms_actions');
|
||||
};
|
||||
|
||||
Mautic.formBuilderNewComponentInit = function () {
|
||||
mQuery('select.form-builder-new-component:not(.initialized)').change(function (e) {
|
||||
const select = mQuery(this);
|
||||
select.addClass('initialized');
|
||||
select.find('option:selected');
|
||||
Mautic.ajaxifyModal(select.find('option:selected'));
|
||||
// Reset the dropdown
|
||||
select.val('');
|
||||
select.chosen('destroy').chosen();
|
||||
});
|
||||
};
|
||||
|
||||
Mautic.changeSelectOptions = function(selectEl, options) {
|
||||
selectEl.empty();
|
||||
mQuery.each(options, function(key, field) {
|
||||
selectEl.append(
|
||||
mQuery('<option></option>')
|
||||
.attr('value', field.value)
|
||||
.attr('data-list-type', field.isListType ? 1 : 0)
|
||||
.text(field.label)
|
||||
);
|
||||
});
|
||||
selectEl.trigger('chosen:updated');
|
||||
};
|
||||
|
||||
Mautic.fetchFieldsOnObjectChange = function() {
|
||||
var fieldSelect = mQuery('select#formfield_mappedField');
|
||||
fieldSelect.attr('disable', true);
|
||||
mQuery.ajax({
|
||||
url: mauticAjaxUrl + "?action=form:getFieldsForObject",
|
||||
data: {
|
||||
mappedObject: mQuery('select#formfield_mappedObject').val(),
|
||||
mappedField: mQuery('input#formfield_originalMappedField').val(),
|
||||
formId: mQuery('input#mauticform_sessionId').val()
|
||||
},
|
||||
success: function (response) {
|
||||
Mautic.changeSelectOptions(fieldSelect, response.fields);
|
||||
},
|
||||
error: function (response, textStatus, errorThrown) {
|
||||
Mautic.processAjaxError(response, textStatus, errorThrown);
|
||||
},
|
||||
complete: function () {
|
||||
fieldSelect.removeAttr('disable');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Mautic.formResultBatchSubmit = function () {
|
||||
if (!mQuery('#lead_batch_ids').val()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mQuery('#lead_batch_add').val() || mQuery('#lead_batch_remove').val();
|
||||
};
|
||||
|
||||
Mautic.updateFormFields = function () {
|
||||
Mautic.activateLabelLoadingIndicator('campaignevent_properties_field');
|
||||
|
||||
var formId = mQuery('#campaignevent_properties_form').val();
|
||||
Mautic.ajaxActionRequest('form:updateFormFields', {'formId': formId}, function(response) {
|
||||
if (response.fields) {
|
||||
var select = mQuery('#campaignevent_properties_field');
|
||||
select.find('option').remove();
|
||||
var fieldOptions = {};
|
||||
mQuery.each(response.fields, function(key, field) {
|
||||
var option = mQuery('<option></option>')
|
||||
.attr('value', field.alias)
|
||||
.text(field.label);
|
||||
select.append(option);
|
||||
fieldOptions[field.alias] = field.options;
|
||||
});
|
||||
select.attr('data-field-options', JSON.stringify(fieldOptions));
|
||||
select.trigger('chosen:updated');
|
||||
Mautic.updateFormFieldValues(select);
|
||||
}
|
||||
Mautic.removeLabelLoadingIndicator();
|
||||
});
|
||||
};
|
||||
|
||||
Mautic.updateFormFieldValues = function (field) {
|
||||
field = mQuery(field);
|
||||
var fieldValue = field.val();
|
||||
var options = jQuery.parseJSON(field.attr('data-field-options'));
|
||||
var valueField = mQuery('#campaignevent_properties_value');
|
||||
var valueFieldAttrs = {
|
||||
'class': valueField.attr('class'),
|
||||
'id': valueField.attr('id'),
|
||||
'name': valueField.attr('name'),
|
||||
'autocomplete': valueField.attr('autocomplete'),
|
||||
'value': valueField.attr('value')
|
||||
};
|
||||
|
||||
if (typeof options[fieldValue] !== 'undefined' && !mQuery.isEmptyObject(options[fieldValue])) {
|
||||
var newValueField = mQuery('<select/>')
|
||||
.attr('class', valueFieldAttrs['class'])
|
||||
.attr('id', valueFieldAttrs['id'])
|
||||
.attr('name', valueFieldAttrs['name'])
|
||||
.attr('autocomplete', valueFieldAttrs['autocomplete'])
|
||||
.attr('value', valueFieldAttrs['value']);
|
||||
mQuery.each(options[fieldValue], function(key, optionVal) {
|
||||
var option = mQuery("<option></option>")
|
||||
.attr('value', key)
|
||||
.text(optionVal);
|
||||
newValueField.append(option);
|
||||
});
|
||||
valueField.replaceWith(newValueField);
|
||||
} else {
|
||||
var newValueField = mQuery('<input/>')
|
||||
.attr('type', 'text')
|
||||
.attr('class', valueFieldAttrs['class'])
|
||||
.attr('id', valueFieldAttrs['id'])
|
||||
.attr('name', valueFieldAttrs['name'])
|
||||
.attr('autocomplete', valueFieldAttrs['autocomplete'])
|
||||
.attr('value', valueFieldAttrs['value']);
|
||||
valueField.replaceWith(newValueField);
|
||||
}
|
||||
};
|
||||
|
||||
Mautic.formFieldOnLoad = function (container, response) {
|
||||
//new field created so append it to the form
|
||||
if (response.fieldHtml) {
|
||||
var newHtml = response.fieldHtml;
|
||||
var fieldId = '#mauticform_' + response.fieldId;
|
||||
var fieldContainer = mQuery(fieldId).closest('.form-field-wrapper');
|
||||
|
||||
if (mQuery(fieldId).length) {
|
||||
//replace content
|
||||
mQuery(fieldContainer).replaceWith(newHtml);
|
||||
var newField = false;
|
||||
} else {
|
||||
var parentContainer = mQuery('#mauticform_'+response.parent);
|
||||
if (parentContainer.length) {
|
||||
(parentContainer.parents('.panel:first')).append(newHtml);
|
||||
}else {
|
||||
//append content
|
||||
var panel = mQuery('#mauticforms_fields .mauticform-button-wrapper').closest('.form-field-wrapper');
|
||||
panel.before(newHtml);
|
||||
}
|
||||
var newField = true;
|
||||
}
|
||||
|
||||
// Get the updated element
|
||||
var fieldContainer = mQuery(fieldId).closest('.form-field-wrapper');
|
||||
|
||||
//activate new stuff
|
||||
mQuery(fieldContainer).find("[data-toggle='ajax']").click(function (event) {
|
||||
event.preventDefault();
|
||||
return Mautic.ajaxifyLink(this, event);
|
||||
});
|
||||
|
||||
//initialize tooltips
|
||||
mQuery(fieldContainer).find("*[data-toggle='tooltip']").tooltip({html: true});
|
||||
|
||||
//initialize ajax'd modals
|
||||
mQuery(fieldContainer).find("[data-toggle='ajaxmodal']").on('click.ajaxmodal', function (event) {
|
||||
event.preventDefault();
|
||||
Mautic.ajaxifyModal(this, event);
|
||||
});
|
||||
|
||||
Mautic.initFormFieldButtons(fieldContainer);
|
||||
Mautic.initHideItemButton(fieldContainer);
|
||||
|
||||
//show fields panel
|
||||
if (!mQuery('#fields-panel').hasClass('in')) {
|
||||
mQuery('a[href="#fields-panel"]').trigger('click');
|
||||
}
|
||||
|
||||
if (newField) {
|
||||
mQuery('.bundle-main-inner-wrapper').scrollTop(mQuery('.bundle-main-inner-wrapper').height());
|
||||
}
|
||||
|
||||
if (mQuery('#form-field-placeholder').length) {
|
||||
mQuery('#form-field-placeholder').remove();
|
||||
}
|
||||
|
||||
Mautic.activateChosenSelect(mQuery('.form-builder-new-component'));
|
||||
Mautic.formBuilderNewComponentInit();
|
||||
Mautic.iniNewConditionalField();
|
||||
}
|
||||
};
|
||||
|
||||
Mautic.iniNewConditionalField = function(){
|
||||
mQuery('.add-new-conditional-field').click(function (e) {
|
||||
e.preventDefault();
|
||||
mQuery(this).parent().next().show('normal');
|
||||
})
|
||||
mQuery('.add-new-conditional-field').parent().next().hide();
|
||||
|
||||
}
|
||||
|
||||
Mautic.initFormFieldButtons = function (container) {
|
||||
if (typeof container == 'undefined') {
|
||||
mQuery('#mauticforms_fields .mauticform-row').off(".mauticformfields");
|
||||
var container = '#mauticforms_fields';
|
||||
}
|
||||
|
||||
mQuery(container).find('.mauticform-row').on('dblclick.mauticformfields', function(event) {
|
||||
event.preventDefault();
|
||||
mQuery(this).closest('.form-field-wrapper').find('.btn-edit').first().click();
|
||||
});
|
||||
};
|
||||
|
||||
Mautic.formActionOnLoad = function (container, response) {
|
||||
//new action created so append it to the form
|
||||
if (response.actionHtml) {
|
||||
var newHtml = response.actionHtml;
|
||||
var actionId = '#mauticform_action_' + response.actionId;
|
||||
if (mQuery(actionId).length) {
|
||||
//replace content
|
||||
mQuery(actionId).replaceWith(newHtml);
|
||||
var newField = false;
|
||||
} else {
|
||||
//append content
|
||||
mQuery(newHtml).appendTo('#mauticforms_actions .drop-here');
|
||||
var newField = true;
|
||||
}
|
||||
//activate new stuff
|
||||
mQuery(actionId + " [data-toggle='ajax']").click(function (event) {
|
||||
event.preventDefault();
|
||||
return Mautic.ajaxifyLink(this, event);
|
||||
});
|
||||
//initialize tooltips
|
||||
mQuery(actionId + " *[data-toggle='tooltip']").tooltip({html: true});
|
||||
|
||||
//initialize ajax'd modals
|
||||
mQuery(actionId + " [data-toggle='ajaxmodal']").on('click.ajaxmodal', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
Mautic.ajaxifyModal(this, event);
|
||||
});
|
||||
|
||||
Mautic.initHideItemButton(actionId);
|
||||
|
||||
mQuery('#mauticforms_actions .mauticform-row').off(".mauticform");
|
||||
mQuery('#mauticforms_actions .mauticform-row').on('dblclick.mauticformactions', function(event) {
|
||||
event.preventDefault();
|
||||
mQuery(this).find('.btn-edit').first().click();
|
||||
});
|
||||
|
||||
//show actions panel
|
||||
if (!mQuery('#actions-panel').hasClass('in')) {
|
||||
mQuery('a[href="#actions-panel"]').trigger('click');
|
||||
}
|
||||
|
||||
if (newField) {
|
||||
mQuery('.bundle-main-inner-wrapper').scrollTop(mQuery('.bundle-main-inner-wrapper').height());
|
||||
}
|
||||
|
||||
if (mQuery('#form-action-placeholder').length) {
|
||||
mQuery('#form-action-placeholder').remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Mautic.initHideItemButton = function(container) {
|
||||
mQuery(container).find('[data-hide-panel]').click(function(e) {
|
||||
e.preventDefault();
|
||||
mQuery(this).closest('.form-field-wrapper, .mauticform-row').hide('fast');
|
||||
});
|
||||
}
|
||||
|
||||
Mautic.onPostSubmitActionChange = function(value) {
|
||||
if (value == 'return') {
|
||||
//remove required class
|
||||
mQuery('#mauticform_postActionProperty').prev().removeClass('required');
|
||||
} else {
|
||||
mQuery('#mauticform_postActionProperty').prev().addClass('required');
|
||||
}
|
||||
|
||||
mQuery('#mauticform_postActionProperty').next().html('');
|
||||
mQuery('#mauticform_postActionProperty').parent().removeClass('has-error');
|
||||
};
|
||||
|
||||
Mautic.selectFormType = function(formType) {
|
||||
if (formType == 'standalone') {
|
||||
mQuery('option.action-standalone-only').removeClass('hide');
|
||||
mQuery('.page-header h3').text(mauticLang.newStandaloneForm);
|
||||
} else {
|
||||
mQuery('option.action-standalone-only').addClass('hide');
|
||||
mQuery('.page-header h3').text(mauticLang.newCampaignForm);
|
||||
}
|
||||
|
||||
mQuery('.available-actions select').trigger('chosen:updated');
|
||||
|
||||
mQuery('#mauticform_formType').val(formType);
|
||||
|
||||
mQuery('body').removeClass('noscroll');
|
||||
|
||||
mQuery('.form-type-modal').remove();
|
||||
mQuery('.form-type-modal-backdrop').remove();
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles theme selection field visibility and manages theme selection
|
||||
*/
|
||||
Mautic.toggleThemeSelectorVisibility = function () {
|
||||
var selectField = mQuery('#mauticform_template');
|
||||
var chosenContainer = mQuery('#mauticform_template_chosen');
|
||||
|
||||
if (mQuery('#mauticform_renderStyle_0').prop('checked')) {
|
||||
selectField.val('').trigger('chosen:updated');
|
||||
chosenContainer.addClass('chosen-disabled');
|
||||
} else {
|
||||
chosenContainer.removeClass('chosen-disabled');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user