Änderungen von Dokument Anwendung erstellen
Zuletzt geändert von admin am 2024/12/14 19:08
Zusammenfassung
-
Objekte (0 geändert, 2 hinzugefügt, 0 gelöscht)
Details
- XWiki.JavaScriptExtension[0]
-
- Pufferstrategie
-
... ... @@ -1,0 +1,1 @@ 1 +long - Code
-
... ... @@ -1,0 +1,51 @@ 1 +require(['jquery', 'xwiki-form-validation-async'], function($) { 2 + var appNameInput = $('input[name="appName"]'); 3 + var appParentInput = $('input[name="appParentReference"]'); 4 + var preview = $('.appName-preview'); 5 + 6 + if (appNameInput.val() === '') { 7 + // We use a function instead of passing directly the promise because we want to avoid the "Uncaught (in promise)" 8 + // error. Basically, we want the rejected promise to be caught. 9 + appNameInput.validateAsync(() => Promise.reject(), 'awm'); 10 + } 11 + 12 + var errorMessage = appNameInput.closest('dd').prev('dt').find('.xErrorMsg'); 13 + if (!errorMessage.length) { 14 + errorMessage = $(document.createElement('span')).addClass('xErrorMsg').hide().appendTo(errorMessage.addBack()); 15 + } 16 + 17 + var toggleValidationError = function(message) { 18 + if (message) { 19 + appNameInput.addClass('xErrorField'); 20 + errorMessage.text(message).show(); 21 + return Promise.reject(); 22 + } else { 23 + appNameInput.removeClass('xErrorField'); 24 + errorMessage.hide(); 25 + } 26 + }; 27 + 28 + var updatePreview = function(content) { 29 + preview.removeClass('loading').html(content); 30 + var error = preview.find('.xErrorMsg'); 31 + return toggleValidationError(error.remove().text()); 32 + }; 33 + 34 + var fetchPreviewUpdate = function() { 35 + if (appNameInput.val() === '') { 36 + return updatePreview('<span class="xErrorMsg">$escapetool.javascript($services.localization.render("platform.appwithinminutes.appNameEmptyError"))</span>'); 37 + } else { 38 + preview.addClass('loading'); 39 + return $.get(XWiki.currentDocument.getURL('get'), appNameInput.closest('form').serialize()).then(updatePreview); 40 + } 41 + }; 42 + 43 + appNameInput.add(appParentInput).on('input', () => { 44 + appNameInput.validateAsync(fetchPreviewUpdate, 500, 'awm'); 45 + }).on('keyup', function(event) { 46 + // Show the error message if the user presses Enter before typing anything. 47 + if (event.which === 13 && appNameInput.val() === '' && !appNameInput.hasClass('xErrorField')) { 48 + appNameInput.validateAsync(fetchPreviewUpdate, 'awm').catch(() => appNameInput.focus()); 49 + } 50 + }); 51 +}); - Name
-
... ... @@ -1,0 +1,1 @@ 1 +Code - Inhalt parsen
-
... ... @@ -1,0 +1,1 @@ 1 +Ja - Benutze diese Erweiterung
-
... ... @@ -1,0 +1,1 @@ 1 +currentPage
- XWiki.StyleSheetExtension[0]
-
- Pufferstrategie
-
... ... @@ -1,0 +1,1 @@ 1 +long - Code
-
... ... @@ -1,0 +1,39 @@ 1 +#template('colorThemeInit.vm') 2 +.wizard-help { 3 + background-color: $theme.backgroundSecondaryColor; 4 + border-bottom: 1px solid $theme.borderColor; 5 + color: $theme.textSecondaryColor; 6 + float: right; 7 + font-size: 0.857em; 8 + margin: 0 0 2em 2em; 9 + padding: 1em; 10 + width: 17em; 11 +} 12 + 13 +.wizard-help strong { 14 + color: $theme.textColor; 15 +} 16 + 17 +.wizard-body { 18 + margin-right: 19em; 19 +} 20 + 21 +.appName-preview dl { 22 + color: $theme.textSecondaryColor; 23 + font-size: 0.8em; 24 + margin-bottom: 1em; 25 +} 26 + 27 +.appName-preview dt { 28 + font-weight: normal; 29 + margin-top: 1em; 30 +} 31 + 32 +.appName-preview dt:after { 33 + content: ":" 34 +} 35 + 36 +.appName-preview .breadcrumb { 37 + background-color: transparent; 38 + padding: 0; 39 +} - Content Type
-
... ... @@ -1,0 +1,1 @@ 1 +CSS - Name
-
... ... @@ -1,0 +1,1 @@ 1 +Style - Inhalt parsen
-
... ... @@ -1,0 +1,1 @@ 1 +Ja - Benutze diese Erweiterung
-
... ... @@ -1,0 +1,1 @@ 1 +currentPage