Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/theming/js/settings-admin.js37
1 files changed, 32 insertions, 5 deletions
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js
index 7df1bbf1125..1f416bb2940 100644
--- a/apps/theming/js/settings-admin.js
+++ b/apps/theming/js/settings-admin.js
@@ -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());
+ }
}
});