-
-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XWIKI-22830: CreateWiki: Next step button remains disabled if one fills the wiki identifier before the pretty name #3852
Open
Sereza7
wants to merge
1
commit into
xwiki:master
Choose a base branch
from
Sereza7:XWIKI-22830
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -804,6 +804,7 @@ $xwiki.getURL('XWiki.XWikiPreferences', 'admin', "editor=globaladmin&section | |
var isWikiNameSet = false; | ||
var isAliasSet = false; | ||
var lastWikiName; | ||
var lastPrettyName; | ||
|
||
## Error messages | ||
#set ($MSG_ERROR_WIKIALREADYEXISTS = "$services.localization.render('platform.wiki.create.error.wikiname.wikialreadyexists')") | ||
|
@@ -857,6 +858,7 @@ $xwiki.getURL('XWiki.XWikiPreferences', 'admin', "editor=globaladmin&section | |
if(prettyName.value.blank()){ | ||
$('wikiprettynamevalidation').innerHTML = "$MSG_ERROR_WIKIPRETTYNAMEEMPTY"; | ||
prettyName.addClassName('xErrorField'); | ||
$('wizard-next').disabled = true; | ||
}else{ | ||
$('wikiprettynamevalidation').innerHTML = ''; | ||
prettyName.removeClassName('xErrorField'); | ||
|
@@ -866,6 +868,11 @@ $xwiki.getURL('XWiki.XWikiPreferences', 'admin', "editor=globaladmin&section | |
wikiName.value = prettyName.value.replace(/[^a-zA-Z0-9]/g,'_').toLowerCase(); | ||
validateWikiName(); | ||
} | ||
// No matter the path, at this point, the wikiName has been already validated. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not true, because the wiki name validation is asynchronous. We can have this case:
|
||
// If it's valid and the pretty name is not blank, we make sure that the user can continue to the next step. | ||
if ($('wikinamevalidation').innerHTML=='') { | ||
$('wizard-next').disabled = false; | ||
} | ||
if(!isAliasSet){ | ||
var wikiAlias = $('wikialias'); | ||
if (wikiAlias) { | ||
|
@@ -900,10 +907,12 @@ $xwiki.getURL('XWiki.XWikiPreferences', 'admin', "editor=globaladmin&section | |
wikiNameElement.value = filteredWikiName; | ||
wikiname = filteredWikiName; | ||
} | ||
if (lastWikiName == wikiname){ | ||
var prettyName = $('prettyname').value | ||
if (lastWikiName === wikiname && lastPrettyName === prettyName){ | ||
return; | ||
} | ||
lastWikiName = wikiname; | ||
lastPrettyName = prettyName; | ||
if (wikiname && !wikiname.blank()) { | ||
var surl = "$ISWIKINAMEAVAILABLE" + "?xpage=plain&outputSyntax=plain&ajax=1&wikiname=" + escape(wikiname); | ||
surl += "&form_token=$!{services.csrf.getToken()}"; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wiki name validation is asynchronous, which means we can have this case: