Skip to content
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

Avoid duplicated icon in the main.js of all themes #2698

Closed
YongBoLiu opened this issue May 22, 2019 · 0 comments
Closed

Avoid duplicated icon in the main.js of all themes #2698

YongBoLiu opened this issue May 22, 2019 · 0 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@YongBoLiu
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

When call html_header_sort() with the last parameter ($return_to) is set to un-main, the search icon will duplicate after click the table header to resort. Because the setupSortable() will call the applySkin() again, and we add the search icon without check it existance.

To Reproduce
Steps to reproduce the behavior:

  1. In a web page, which has a search filter and a data table, call html_header_sort() with the last parameter ($return_to) is set to un-main, to only update the table area.
  2. Click on the table header to resort.
  3. Check the search filter and the icon.

Expected behavior
A clear and concise description of what you expected to happen.
Check the search icon existance to avoid duplicated icon. add it only when no icon is there.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

--- rtm/cacti/include/themes/modern/main.js	2019-03-31 02:45:32.000000000 +0800
+++ rtm/cacti/include/themes/modern/main.js	2019-05-22 09:45:21.000000551 +0800
@@ -16,15 +16,15 @@
 	setMenuVisibility();
 
 	// Add nice search filter to filters
-	if ($('input[id="filter"]').length > 0) {
+	if ($('input[id="filter"]').length > 0 && $('input[id="filter"] + i[class="fa fa-search filter"]').length < 1) {
 		$('input[id="filter"]').after("<i class='fa fa-search filter'/>").attr('autocomplete', 'off').attr('placeholder', searchFilter).parent('td').css('white-space', 'nowrap');
 	}
 
-	if ($('input[id="filterd"]').length > 0) {
+	if ($('input[id="filterd"]').length > 0 && $('input[id="filterd"] + i[class="fa fa-search filter"]').length < 1) {
 		$('input[id="filterd"]').after("<i class='fa fa-search filter'/>").attr('autocomplete', 'off').attr('placeholder', searchFilter).parent('td').css('white-space', 'nowrap');
 	}
 
-	if ($('input[id="rfilter"]').length > 0) {
+	if ($('input[id="rfilter"]').length > 0 && $('input[id="rfilter"] + i[class="fa fa-search filter"]').length < 1) {
 		$('input[id="rfilter"]').after("<i class='fa fa-search filter'/>").attr('autocomplete', 'off').attr('placeholder', searchRFilter).parent('td').css('white-space', 'nowrap');
 	}
 
We need to add the check in all theme files below,
./include/themes/paw/main.js
./include/themes/modern/main.js
./include/themes/paper-plane/main.js
./include/themes/dark/main.js
./include/themes/classic/main.js
./include/themes/sunrise/main.js
@cigamit cigamit changed the title Need check the search icon existance to avoid duplicated icon in the main.js of all themes Avoid duplicated icon in the main.js of all themes May 22, 2019
cigamit added a commit that referenced this issue May 22, 2019
Avoid duplicated icon in the main.js of all themes
@cigamit cigamit added bug Undesired behaviour resolved A fixed issue labels May 22, 2019
@cigamit cigamit closed this as completed Jun 8, 2019
@netniV netniV added this to the v1.2.4 milestone Jun 8, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants