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

Fix plurality of mementos and resources on main replay page. Closes #534 #535

Merged
merged 5 commits into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ipwb/assets/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,8 @@ function setShowURIsVisibility () {
}

function setPlurality () {
const urimCount = document.getElementById('memCountInt').innerHTML
const htmlFilesPlurality = document.getElementById('htmlPages').innerHTML

if (urimCount === '1') {
document.getElementById('plural').classList.add('hidden')
}
if (htmlFilesPlurality === '1') {
document.getElementById('htmlPagesPlurality').classList.add('hidden')
}
Expand Down
6 changes: 5 additions & 1 deletion ipwb/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,13 @@ def showAdmin():
def showLandingPage():
iFile = ipwbUtils.getIPWBReplayIndexPath()
(mCount, uniqueURIRs) = retrieveMemCount(iFile)
urimPlurality = 'memento' if mCount == 1 else 'mementos'
urirPlurality = 'resource' if uniqueURIRs == 1 else 'resources'
summary = {'indexPath': iFile,
'urimCount': mCount,
'urirCount': uniqueURIRs}
'urirCount': uniqueURIRs,
'urimPlurality': urimPlurality,
'urirPlurality': urirPlurality}
uris = getURIsAndDatetimesInCDXJ(iFile)
return render_template('index.html', summary=summary, uris=uris)

Expand Down
2 changes: 1 addition & 1 deletion ipwb/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h1><img src="/ipwbassets/logo.png" alt="ipwb" /></h1>
</footer>
<div id="uris" class="hidden">
<h3 id="urisHeader"><abbr title="Uniform Resource Identifiers">URIs</abbr> locally available</h3>
<h4 id="htmlCountHeader">{{ summary.urimCount }} mementos of {{ summary.urirCount }} resources with <span id="htmlPages">0</span>
<h4 id="htmlCountHeader">{{ summary.urimCount }} {{ summary.urimPlurality }} of {{ summary.urirCount }} {{ summary.urirPlurality }} with <span id="htmlPages">0</span>
HTML page<span id="htmlPagesPlurality">s</span> listed
<button id="showEmbeddedURI" data-defaultValue="Show All" data-activatedValue="Show Only HTML Pages">Show All</button></h4>
<ul id="uriList"></ul>
Expand Down