Просмотр исходного кода

fix: add toastr notifications for empty user search field in ldap_config.html

Manuel 7 месяцев назад
Родитель
Сommit
cb4f65dec6
2 измененных файлов с 10 добавлено и 1 удалено
  1. 4 0
      templates/admin/base.html
  2. 6 1
      templates/admin/ldap_config.html

+ 4 - 0
templates/admin/base.html

@@ -9,6 +9,7 @@
     <script src="{{ url_for('static', filename='src/tailwind.min.js') }}"></script>
     <script src="{{ url_for('static', filename='src/alpine.min.js') }}" defer></script>
     <link rel="stylesheet" href="{{ url_for('static', filename='all.min.css') }}">
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/toastr.min.css') }}">
 </head>
 <body class="bg-gray-50 min-h-screen" x-data="{ sidebarOpen: false }">
     <!-- Navigation -->
@@ -191,6 +192,9 @@
     <!-- Custom Confirm Modal -->
     {% include 'components/confirm_modal.html' %}
 
+    <script src="{{ url_for('static', filename='js/jquery-4.0.0.min.js') }}"></script>
+    <script src="{{ url_for('static', filename='js/toastr.min.js') }}"></script>
+    <script src="{{ url_for('static', filename='js/toastr-config.js') }}"></script>
     <script src="{{ url_for('static', filename='js/confirm_modal.js') }}"></script>
     <script>
         // Get CSRF token from meta tag

+ 6 - 1
templates/admin/ldap_config.html

@@ -476,7 +476,12 @@ function ldapApp() {
         },
 
         async searchUsers() {
-            if (!this.userQuery.trim()) return;
+            if (!this.userQuery.trim()) {
+                if (typeof showNotification === 'function') {
+                    showNotification('{{ _('El campo de búsqueda de usuario no puede estar vacío.') }}', 'error');
+                }
+                return;
+            }
             this.searchingUsers = true;
             this.userSearched  = false;
             this.userResults   = [];