Skip to content

Commit

Permalink
Fix plural/singular name in search. Remove duplicated plugin closes #83
Browse files Browse the repository at this point in the history
…, closes #84
  • Loading branch information
dbuzhorwp committed Apr 19, 2019
1 parent 441925e commit efe3ade
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/en/plugins_list.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion layouts/plugins/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<div class="row">
<div class="col-12">
<div class="plugins__quantity-wrapper" style="display: none">
<span class="plugins__quantity"></span>&nbsp;plugins displayed
<span class="plugins__quantity"></span>&nbsp;displayed
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/videos/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<div class="row">
<div class="col-12">
<div class="plugins__quantity-wrapper" style="display: none">
<span class="plugins__quantity"></span>&nbsp;videos displayed
<span class="plugins__quantity"></span>&nbsp;displayed
</div>
</div>
</div>
Expand Down
9 changes: 8 additions & 1 deletion themes/cdap/assets/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const showTeamButton = $('#showTeamBtn');
const heroDescription = $('#heroDescription');
const hero = $('#hero');
const heroTeam = $('#heroTeam');
let singularName;
let pluralName

$(document).ready(() => {
if (window.location.hash === "#premises") {
Expand Down Expand Up @@ -69,9 +71,10 @@ function displayQuantityInformation(items) {
if (searchResult !== null && quantityWrapper !== null) {
searchResult.style.display = items.length > 0 ? 'none' : '';
quantityWrapper.style.display = items.length > 0 ? '' : 'none';
const entityName = items.length > 1 ? pluralName : singularName;

if (items.length !== 0) {
quantity.innerHTML = items.length;
quantity.innerHTML = items.length + ' ' + entityName;
}
}
}
Expand Down Expand Up @@ -241,9 +244,13 @@ function searchVideos() {
}

if (window.location.href.match('plugins')) {
singularName = 'plugin';
pluralName = 'plugins';
displayQuantityInformation(plugins);
}

if (window.location.href.match('videos')) {
singularName = 'video';
pluralName = 'videos';
displayQuantityInformation(videosByDisplayShow);
}

0 comments on commit efe3ade

Please sign in to comment.