-
Notifications
You must be signed in to change notification settings - Fork 70
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
add Searchbar for projects list and sitemaps list #151
Conversation
The only request is to make the search bar longer, it will look visually better |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We already use this jquery plugin to search entries in browse data menu. See browseSitemapData method in Controller.js. See if you can reuse it for project/sitemap lists.
- It would be awesome if you manage to tweak with styles so table columns do not change their widths after search. I'd try to add
width: N%
(or bootstrap's col- classes) for columns, also maybeoverflow-wrap: anywhere
for cell contents. - Consider also allowing search by project ids and sitemap urls
src/scripts/Controller.js
Outdated
let AllRows = []; | ||
const inputText = event.target.value.toLowerCase(); | ||
AllRows = Array.from(document.querySelectorAll(rowSelector)).map( | ||
td => td.parentElement | ||
); | ||
AllRows.forEach(row => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AllRows could be const. Also, allRows
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/scripts/Controller.js
Outdated
const rowText = row.querySelector(rowSelector).innerText; | ||
if (rowText.toLowerCase().includes(inputText)) { | ||
row.style.display = 'table-row'; | ||
let regex = RegExp(inputText, 'gi'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If sitemap id or project name contain special regex characters like +, (), search will work, but highlight might be off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/scripts/Controller.js
Outdated
} | ||
|
||
initSearchbar(rowSelector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rowSelector seems to be a cell selector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
also don't forget to merge master and fix conflicts |
# Conflicts: # src/_locales/en/messages.json # src/_locales/ru/messages.json
jquery searcher has been added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
No description provided.