Upgrades jquery and bootstrap

This commit is contained in:
mabashian
2018-09-12 13:22:32 -04:00
parent 2b5210842d
commit 9c20e1b494
130 changed files with 1301 additions and 1282 deletions
+41 -96
View File
@@ -141,10 +141,10 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
.factory('GenerateForm', ['$rootScope', '$compile', 'generateList',
'Attr', 'Icon', 'Column',
'NavigationLink', 'HelpCollapse', 'Empty', 'SelectIcon',
'NavigationLink', 'Empty', 'SelectIcon',
'ActionButton', 'MessageBar', '$log', 'i18n',
function ($rootScope, $compile, GenerateList,
Attr, Icon, Column, NavigationLink, HelpCollapse,
Attr, Icon, Column, NavigationLink,
Empty, SelectIcon, ActionButton, MessageBar, $log, i18n) {
return {
@@ -163,7 +163,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
},
// Not a very good way to do this
// Form sub-states expect to target ui-views related@stateName & modal@stateName
// Also wraps mess of generated HTML in a .Panel
// Also wraps mess of generated HTML in a .card and at-Panel
wrapPanel(html, ignorePanel){
if(ignorePanel) {
return `
@@ -176,7 +176,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
else {
return `
${MessageBar(this.form)}
<div class="Panel">
<div class="card at-Panel">
${html}
<div ui-view="related"></div>
<div ui-view="modal"></div>
@@ -508,22 +508,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
navigationLink: NavigationLink,
buildHelpCollapse: function (collapse_array) {
var html = '',
params = {}, i;
for (i = 0; i < collapse_array.length; i++) {
params.hdr = collapse_array[i].hdr;
params.content = collapse_array[i].content;
params.idx = this.accordion_count++;
params.show = (collapse_array[i].show) ? collapse_array[i].show : null;
params.ngHide = (collapse_array[i].ngHide) ? collapse_array[i].ngHide : null;
params.bind = (collapse_array[i].ngBind) ? collapse_array[i].ngBind : null;
html += HelpCollapse(params);
}
return html;
},
buildHeaderField: function(key, field, options, form){
var html = '';
// extend these blocks to include elements similarly buildField()
@@ -594,43 +578,30 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
return html;
}
function buildCheckbox(form, field, fld, idx, includeLabel) {
var html = '',
label = (includeLabel !== undefined && includeLabel === false) ? false : true;
if (label) {
html += "<span class=\"Form-checkboxRow\">";
html += "<label class=\"";
html += (field.inline === undefined || field.inline === true) ? "checkbox-inline" : "";
html += (field.labelClass) ? " " + field.labelClass : "";
html += "\"";
html += (field.ngShow) ? " ng-show=\"" +field.ngShow + "\" " : "";
html += ">";
}
function buildCheckbox(form, field, fld, idx) {
var html = '';
html += "<div class=\"form-check\" ";
html += (field.ngShow) ? " ng-show=\"" +field.ngShow + "\" " : "";
html += ">";
html += "<label class=\"form-check-label\">";
html += "<input type=\"checkbox\" ";
html += Attr(field, 'type');
html += "ng-model=\"" + fld + '" ';
html += "name=\"" + fld + '" ';
html += (field.ngChange) ? Attr(field, 'ngChange') : "";
html += "id=\"" + form.name + "_" + fld + "_chbox\" ";
html += "id=\"" + form.name + "_" + fld + "_chbox";
html += (idx !== undefined) ? "_" + idx : "";
html += "class=\"";
html += "\"";
html += "\" class=\"form-check-input\"";
html += (field.trueValue !== undefined) ? Attr(field, 'trueValue') : "";
html += (field.falseValue !== undefined) ? Attr(field, 'falseValue') : "";
html += (field.checked) ? "checked " : "";
html += (field.readonly) ? "disabled " : "";
html += (field.ngChange) ? "ng-change=\"" +field.ngChange + "\" " : "";
html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : "";
html += " > ";
if (label) {
html += field.label + " ";
html += (field.awPopOver) ? Attr(field, 'awPopOver', fld) : "";
html += "</label>\n";
html += "</span>";
}
html += `><span class="Form-inputLabel">${field.label}</span></label>`;
html += (field.awPopOver) ? Attr(field, 'awPopOver', fld) : "";
html += `</div>`;
return html;
}
@@ -843,7 +814,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
}
if (field.genHash) {
html += "<span class=\"input-group-btn\"><button type=\"button\" class=\"btn Form-lookupButton\" ng-click=\"genHash('" + fld + "')\" " +
html += "<span class=\"input-group-btn input-group-prepend\"><button type=\"button\" class=\"btn Form-lookupButton\" ng-click=\"genHash('" + fld + "')\" " +
"aw-tool-tip=\"Generate " + field.label + "\" data-placement=\"top\" id=\"" + this.form.name + "_" + fld + "_gen_btn\">" +
"<i class=\"fa fa-magic\"></i></button></span>\n</div>\n";
}
@@ -872,9 +843,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" + fld + "_api_error\"></div>\n";
// Add help panel(s)
html += (field.helpCollapse) ? this.buildHelpCollapse(field.helpCollapse) : '';
html += "</div>\n";
}
@@ -890,7 +858,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += (horizontal) ? " " + getFieldWidth() : "";
html += "'>\n";
// TODO: make it so that the button won't show up if the mode is edit, hasShowInputButton !== true, and there are no contents in the field.
html += "<span class='input-group-btn'>\n";
html += "<span class='input-group-btn input-group-prepend'>\n";
html += "<button aw-password-toggle type='button' class='btn btn-default show_input_button Form-passwordButton' ";
html += buildId(field, fld + "_show_input_button", this.form);
html += `aw-tool-tip='${tooltip}'} aw-tip-placement='top'`;
@@ -966,9 +934,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
}
html += "<div class='error api-error' id='" + this.form.name + "-" + fld + "-api-error' ng-bind='" + fld + "_api_error'>\n</div>\n";
// Add help panel(s)
html += (field.helpCollapse) ? this.buildHelpCollapse(field.helpCollapse) : '';
}
//textarea fields
@@ -1104,10 +1069,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += `<div class="error" id="${field.onError.id}" ng-show="${field.onError.ngShow}">${field.onError.text}</div>`;
}
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" + fld + "_api_error\"></div>\n";
// Add help panel(s)
html += (field.helpCollapse) ? this.buildHelpCollapse(field.helpCollapse) : '';
html += "</div>\n";
}
@@ -1228,17 +1190,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
}
html += "<div class=\"checkbox\">\n";
html += "<label>";
html += buildCheckbox(this.form, field, fld, undefined, false);
html += (field.icon) ? Icon(field.icon) : "";
if (field.labelBind) {
html += "\t\t<span class=\"Form-inputLabel\" ng-bind=\"" + field.labelBind + "\" translate>\n\t\t</span>";
} else {
html += "<span class=\"Form-inputLabel\" translate>" + field.label + "</span>";
}
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
html += "</label>\n";
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" +
fld + "_api_error\"></div>\n";
html += "</div><!-- checkbox -->\n";
@@ -1246,8 +1199,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
if (horizontal) {
html += "</div>\n";
}
html += (field.helpCollapse) ? this.buildHelpCollapse(field.helpCollapse) : '';
}
//radio group
@@ -1261,7 +1212,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += ">\n";
for (i = 0; i < field.options.length; i++) {
html += "<label class=\"radio-inline ";
html += "<label class=\"";
html += (field.options[i].labelClass) ? ` ${field.options[i].labelClass} "` : "\"";
html += (field.options[i].ngShow) ? this.attr(field.options[i], 'ngShow') : "";
html += ">";
@@ -1292,9 +1243,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" +
fld + "_api_error\"></div>\n";
// Add help panel(s)
html += (field.helpCollapse) ? this.buildHelpCollapse(field.helpCollapse) : '';
html += "</div>\n";
}
@@ -1354,7 +1302,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += ">\n";
html += `<div class="input-group Form-mixedInputGroup">`;
html += "<span class=\"input-group-btn\">\n";
html += "<span class=\"input-group-btn input-group-prepend\">\n";
html += `<button type="button" class="Form-lookupButton btn" ng-click="${field.ngClick || defaultLookupNgClick}"
${field.readonly || field.showonly}
${this.attr(field, "ngDisabled")}
@@ -1917,13 +1865,11 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += `
<div class="list-wrapper"
ng-show="${collection.iterator}s.length > 0 && !is_superuser">
<table id="${itm}_table" class="${collection.iterator} List-table">
<thead>
<tr class="List-tableHeaderRow">
<div id="${itm}_table" class="${collection.iterator} List-table">
<div class="d-flex List-tableHeaderRow">
`;
html += (collection.index === undefined || collection.index !== false) ? "<th class=\"col-xs-1\">#</th>\n" : "";
for (fld in collection.fields) {
html += `<th class="List-tableHeader list-header ${collection.fields[fld].columnClass}"
html += `<div class="List-tableHeader list-header ${collection.fields[fld].columnClass}"
id="${collection.iterator}-${fld}-header"
base-path="${collection.basePath}"
collection="${collection.name}"
@@ -1934,22 +1880,20 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
column-no-sort="${collection.fields[fld].nosort}"
column-label="${collection.fields[fld].label}">
${collection.fields[fld].label}
</th>`;
</div>`;
}
if (collection.fieldActions) {
html += "<th class=\"List-tableHeader List-tableHeader--actions\">Actions</th>\n";
html += `<div class="List-tableHeader List-tableHeader--actions ${collection.fieldActions.columnClass}">Actions</div>`;
}
html += "</tr>\n";
html += "</thead>";
html += "<tbody>\n";
html += "</div>";
html += "<tr class=\"List-tableRow\" ng-repeat=\"" + collection.iterator + " in " + itm + "\" ";
html += "<div class=\"d-flex List-tableRow\" ng-repeat=\"" + collection.iterator + " in " + itm + "\" ";
html += "id=\"{{ " + collection.iterator + ".id }}\">\n";
if (collection.index === undefined || collection.index !== false) {
html += "<td class=\"List-tableCell";
html += "<div class=\"List-tableCell";
html += (collection.fields[fld].class) ? collection.fields[fld].class : "";
html += "\">{{ $index + ((" + collection.iterator + "_page - 1) * " +
collection.iterator + "_page_size) + 1 }}.</td>\n";
collection.iterator + "_page_size) + 1 }}.</div>\n";
}
cnt = 1;
base = (collection.base) ? collection.base : itm;
@@ -1968,7 +1912,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
// Row level actions
if (collection.fieldActions) {
html += "<td class=\"List-actionsContainer\"><div class=\"List-tableCell List-actionButtonCell actions\">";
html += `<div class="List-actionsContainer ${collection.fieldActions.columnClass}"><div class="List-tableCell List-actionButtonCell actions">`;
for (act in collection.fieldActions) {
if (act !== 'columnClass') {
fAction = collection.fieldActions[act];
@@ -1996,18 +1940,17 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "</button>";
}
}
html += "</div></td>";
html += "</tr>\n";
html += "</div></div>";
html += "</div>\n";
}
// Message for loading
html += "<tr ng-show=\"" + collection.iterator + "Loading == true\">\n";
html += "<td colspan=\"" + cnt + "\"><div class=\"loading-info\">" + i18n._("Loading...") + "</div></td>\n";
html += "</tr>\n";
html += "<div ng-show=\"" + collection.iterator + "Loading == true\">\n";
html += "<div colspan=\"" + cnt + "\"><div class=\"loading-info\">" + i18n._("Loading...") + "</div></div>\n";
html += "</div>\n";
// End List
html += "</tbody>\n";
html += "</table>\n";
html += "</div>\n";
//html += "</div>\n"; // close well
html += "</div>\n"; // close list-wrapper div
@@ -2029,10 +1972,12 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
let ngShow = options.ngShow ? `ng-show="${options.ngShow}"` : '';
return `
<label class="checkbox-inline Form-checkbox Form-checkbox--subCheckbox" ${ngShow}>
<input type="checkbox" id="${options.id}" ${ngModel} ${ngChange} ${ngDisabled} />
${options.text}
</label> `;
<div class="form-check Form-checkbox Form-checkbox--subCheckbox">
<label class="form-check-label" ${ngShow}>
<input class="form-check-input" type="checkbox" id="${options.id}" ${ngModel} ${ngChange} ${ngDisabled} />
${options.text}
</label>
</div>`;
}
}