Merge pull request #8475 from sagorika1996/theme
Empty name not allowed in theming app
This commit is contained in:
commit
048ad0df1d
|
@ -175,13 +175,40 @@ $(document).ready(function () {
|
|||
$('#upload-login-background').click();
|
||||
});
|
||||
|
||||
function checkName () {
|
||||
var length = $('#theming-name').val().length;
|
||||
try {
|
||||
if (length > 0) {
|
||||
return true;
|
||||
} else {
|
||||
throw t('theming', 'Name cannot be empty');
|
||||
}
|
||||
} catch (error) {
|
||||
$('#theming-name').attr('title', error);
|
||||
$('#theming-name').tooltip({placement: 'top', trigger: 'manual'});
|
||||
$('#theming-name').tooltip('fixTitle');
|
||||
$('#theming-name').tooltip('show');
|
||||
$('#theming-name').addClass('error');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#theming-name').keyup(function() {
|
||||
if (checkName()) {
|
||||
$('#theming-name').tooltip('hide');
|
||||
$('#theming-name').removeClass('error');
|
||||
}
|
||||
});
|
||||
|
||||
$('#theming-name').change(function(e) {
|
||||
var el = $(this);
|
||||
$.when(el.focusout()).then(function() {
|
||||
setThemingValue('name', $(this).val());
|
||||
});
|
||||
if (e.keyCode == 13) {
|
||||
setThemingValue('name', $(this).val());
|
||||
if(checkName()){
|
||||
$.when(el.focusout()).then(function() {
|
||||
setThemingValue('name', $(this).val());
|
||||
});
|
||||
if (e.keyCode == 13) {
|
||||
setThemingValue('name', $(this).val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue