Skip to content

Commit

Permalink
Fixed bug with displayHTMLMesage when receiving a Text node. Changed …
Browse files Browse the repository at this point in the history
…contact link to be capitalized, use correct URL and open in a new tab (#2585)
  • Loading branch information
joshuastegmaier authored Nov 7, 2024
1 parent dca4d3f commit 9235257
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions concordia/static/js/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ function displayHtmlMessage(level, message, uniqueId) {
If provided, uniqueId will be used to remove any existing elements which
have that ID, allowing old messages to be replaced automatically.
*/
var $messages = $('#messages');
let $messages = $('#messages');
$messages.removeAttr('hidden');

var $newMessage = $messages
let $newMessage = $messages
.find('#message-template .alert')
.clone()
.removeAttr('hidden')
Expand All @@ -76,6 +76,11 @@ function displayHtmlMessage(level, message, uniqueId) {

// Add a span to the message to ensure justified
// styles don't end up splitting the text
// message might be a Text node, so we need to get
// the actual text if so
if (message instanceof Text) {
message = message.textContent;
}
$newMessage.prepend('<span>' + message + '</span>');

$messages.append($newMessage);
Expand Down
2 changes: 1 addition & 1 deletion concordia/static/js/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ seadragonViewer.addHandler('open-failed', function () {
let contactUs =
'<strong><a class="alert-link" href="' +
viewerData.contactUrl +
'">contact us</a></strong>';
'" target="_blank">Contact us</a></strong>';
displayHtmlMessage(
'error',
'Unable to display image - ' + contactUs,
Expand Down
2 changes: 1 addition & 1 deletion concordia/templates/transcriptions/asset_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<script id="viewer-data"
data-prefix-url="{% static 'openseadragon/build/openseadragon/images/' %}"
data-tile-source-url="{% asset_media_url asset %}?canvas"
data-contact-url="{% url 'contact' %}"
data-contact-url="https://ask.loc.gov/crowd"
></script>

<script type="importmap">
Expand Down

0 comments on commit 9235257

Please sign in to comment.