Skip to content

Commit

Permalink
Merge pull request #260 from st3phhays/release/0.1.4
Browse files Browse the repository at this point in the history
(#259) Add reusable function to truncate results
  • Loading branch information
st3phhays authored Oct 24, 2022
2 parents 49a00c6 + 4c138b3 commit 5d682c4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion getting-started/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"homepage": "https://github.com/chocolatey/chocolatey.org#readme",
"devDependencies": {
"choco-theme": "^0.1.3"
"choco-theme": "^0.1.4"
},
"resolutions": {
"glob-parent": "^6.0.1",
Expand Down
5 changes: 4 additions & 1 deletion js/chocolatey-packages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jQuery from 'jquery';
import EasyMDE from 'easymde';
import { Collapse, Modal } from 'bootstrap';
import { getCookie, setCookieExpirationNever } from './util/chocolatey-functions';
import { getCookie, setCookieExpirationNever, truncateResults } from './util/chocolatey-functions';

(() => {
// Community Disclaimer
Expand Down Expand Up @@ -373,4 +373,7 @@ import { getCookie, setCookieExpirationNever } from './util/chocolatey-functions
}
});
}

// Show or hide truncated version history table results on click
truncateResults(document.querySelector('#versionTableTruncateResults'));
})();
17 changes: 17 additions & 0 deletions js/util/chocolatey-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,20 @@ deploymentMethods.forEach(el => {
if (deploymentMethodHashArray.includes(deploymentMethodHash)) {
document.cookie = `deployment_method=${deploymentMethodHash}; path=/`;
}

// Show more or hide truncated results on click
export const truncateResults = btnId => {
if (btnId) {
btnId.addEventListener('click', () => {
const results = document.querySelectorAll('tr.truncate-results');

for (const i of results) {
if (i.classList.contains('d-none')) {
i.classList.remove('d-none');
} else {
i.classList.add('d-none');
}
}
});
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "choco-theme",
"version": "0.1.3",
"version": "0.1.4",
"description": "The global theme for Chocolatey Software.",
"repository": {
"type": "git",
Expand Down

0 comments on commit 5d682c4

Please sign in to comment.