Changeset View
Changeset View
Standalone View
Standalone View
src/resources/js/app.js
Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | methods: { | ||||
if (style) { | if (style) { | ||||
$(elem).css(style) | $(elem).css(style) | ||||
} else { | } else { | ||||
$(elem).css('position', 'relative') | $(elem).css('position', 'relative') | ||||
} | } | ||||
$(elem).append(small ? $(loader).addClass('small') : $(loader)) | $(elem).append(small ? $(loader).addClass('small') : $(loader)) | ||||
}, | }, | ||||
// Create an object copy with specified properties only | |||||
pick(obj, properties) { | |||||
let result = {} | |||||
properties.forEach(prop => { | |||||
if (prop in obj) { | |||||
result[prop] = obj[prop] | |||||
} | |||||
}) | |||||
return result | |||||
}, | |||||
// Remove loader element added in addLoader() | // Remove loader element added in addLoader() | ||||
removeLoader(elem) { | removeLoader(elem) { | ||||
$(elem).find('.app-loader').remove() | $(elem).find('.app-loader').remove() | ||||
}, | }, | ||||
startLoading, | startLoading, | ||||
stopLoading, | stopLoading, | ||||
isLoading() { | isLoading() { | ||||
return isLoading > 0 | return isLoading > 0 | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | methods: { | ||||
return false | return false | ||||
} | } | ||||
}) | }) | ||||
page = page.replace(/^\//, '') | page = page.replace(/^\//, '') | ||||
return page ? page : '404' | return page ? page : '404' | ||||
}, | }, | ||||
resourceStatusClass(resource) { | |||||
return this.userStatusClass(resource) | |||||
}, | |||||
resourceStatusText(resource) { | |||||
return this.userStatusText(resource) | |||||
}, | |||||
supportDialog(container) { | supportDialog(container) { | ||||
let dialog = $('#support-dialog')[0] | let dialog = $('#support-dialog')[0] | ||||
if (!dialog) { | if (!dialog) { | ||||
// FIXME: Find a nicer way of doing this | // FIXME: Find a nicer way of doing this | ||||
SupportForm.i18n = i18n | SupportForm.i18n = i18n | ||||
let form = new Vue(SupportForm) | let form = new Vue(SupportForm) | ||||
form.$mount($('<div>').appendTo(container)[0]) | form.$mount($('<div>').appendTo(container)[0]) | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | error => { | ||||
if (msg[index]) { | if (msg[index]) { | ||||
$(element).find('input').addClass('is-invalid') | $(element).find('input').addClass('is-invalid') | ||||
} | } | ||||
}) | }) | ||||
} | } | ||||
input.addClass('is-invalid').next('.invalid-feedback').remove() | input.addClass('is-invalid').next('.invalid-feedback').remove() | ||||
input.after(feedback) | input.after(feedback) | ||||
} else { | |||||
// a special case, e.g. the invitation policy widget | |||||
if (input.is('select') && input.parent().is('.input-group-select.selected')) { | |||||
input = input.next() | |||||
} | } | ||||
else { | |||||
// Standard form element | // Standard form element | ||||
input.addClass('is-invalid') | input.addClass('is-invalid') | ||||
input.parent().find('.invalid-feedback').remove() | input.parent().find('.invalid-feedback').remove() | ||||
input.parent().append(feedback) | input.parent().append(feedback) | ||||
} | } | ||||
} | } | ||||
}) | }) | ||||
Show All 16 Lines |