commit 95ce6d5: [Minor] Use class for hiding WebUI elements

moisseev moiseev at mezonplus.ru
Sat Jul 11 22:21:08 UTC 2020


Author: moisseev
Date: 2020-07-11 18:57:53 +0300
URL: https://github.com/rspamd/rspamd/commit/95ce6d5616ab2eb3c8983f2cb2756273a2af0c9a (refs/pull/3432/head)

[Minor] Use class for hiding WebUI elements

---
 interface/index.html       | 10 +++++-----
 interface/js/app/rspamd.js |  8 --------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/interface/index.html b/interface/index.html
index d70c557e5..312a1956e 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -40,8 +40,8 @@
 
 		<li role="presentation" class="nav-item"><a id="configuration_nav" aria-controls="configuration" role="tab" href="#configuration" data-toggle="tab" class="nav-link">Configuration</a></li>
 		<li role="presentation" class="nav-item"><a id="symbols_nav" aria-controls="symbols" role="tab" href="#symbols" data-toggle="tab" class="nav-link">Symbols</a></li>
-		<li role="presentation" class="nav-item"><a id="scan_nav" aria-controls="scan" role="tab" href="#scan" data-toggle="tab" class="nav-link">Scan<span class="learn" style="display: none;">/Learn</span></a></li>
-		<li role="presentation" class="nav-item"><a id="selectors_nav" aria-controls="selectors" role="tab" href="#selectors" data-toggle="tab" class="nav-link" style="display: none;">Test selectors</a></li>
+		<li role="presentation" class="nav-item"><a id="scan_nav" aria-controls="scan" role="tab" href="#scan" data-toggle="tab" class="nav-link">Scan<span class="ro-hide" style="display: none;">/Learn</span></a></li>
+		<li role="presentation" class="nav-item"><a id="selectors_nav" aria-controls="selectors" role="tab" href="#selectors" data-toggle="tab" class="nav-link ro-hide" style="display: none;">Test selectors</a></li>
 		<li role="presentation" class="nav-item"><a id="history_nav" aria-controls="history" role="tab" href="#history" data-toggle="tab" class="nav-link">History</a></li>
 	</ul>
 	<form class="form-inline ml-auto" id="navbar-btn-form" style="display: none;">
@@ -264,7 +264,7 @@
 						</div>
 					</div>
 				</div>
-				<div class="card learn" style="display: none;">
+				<div class="card ro-hide" style="display: none;">
 					<div class="card-header text-secondary py-2">
 						<span class="icon mr-3"><i class="fas fa-graduation-cap"></i></span>
 						<span class="h6 font-weight-bolder my-2">Learn Rspamd</span>
@@ -426,7 +426,7 @@
 							</select>
 							<label for="history_page_size" class="ml-2">Rows per page:</label>
 							<input id="history_page_size" class="form-control ml-1" value="25" min="1" type="number">
-							<button class="btn btn-danger btn-sm ml-2" id="resetHistory">
+							<button class="btn btn-danger btn-sm ml-2 ro-hide" id="resetHistory">
 								<i class="fas fa-times-circle"></i> Reset
 							</button>
 							<button class="btn btn-info btn-sm ml-2" id="updateHistory">
@@ -440,7 +440,7 @@
 						</div>
 					</div>
 				</div>
-				<div class="card bg-light shadow my-3" id="errors-history">
+				<div class="card bg-light shadow my-3 ro-hide" id="errors-history">
 					<div class="card-header text-secondary py-1 d-flex">
 						<span class="icon mr-3"><i class="fas fa-exclamation-triangle"></i></span>
 						<span class="h6 font-weight-bolder my-2 ml-0">Errors</span>
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index f08363c62..cfc366a5c 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -278,17 +278,9 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_
         if (ui.read_only) {
             $(".ro-disable").attr("disabled", true);
             $(".ro-hide").hide();
-            $(".learn").hide();
-            $("#resetHistory").attr("disabled", true);
-            $("#errors-history").hide();
-            $("#selectors_nav").hide();
         } else {
             $(".ro-disable").removeAttr("disabled", true);
             $(".ro-hide").show();
-            $(".learn").show();
-            $("#resetHistory").removeAttr("disabled", true);
-            $("#errors-history").show();
-            $("#selectors_nav").show();
         }
 
         var buttons = $("#navbar-btn-form");


More information about the Commits mailing list