Skip to content

Commit

Permalink
adding guidelines for alt text to specific sir trevor blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
hudajkhan committed Oct 15, 2024
1 parent ea11740 commit 88e63e5
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 5 deletions.
28 changes: 27 additions & 1 deletion app/assets/javascripts/spotlight/spotlight.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/assets/javascripts/spotlight/spotlight.esm.js.map

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion app/assets/javascripts/spotlight/spotlight.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/assets/javascripts/spotlight/spotlight.js.map

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion app/javascript/spotlight/admin/blocks/resources_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ Core.Block.Resources = (function(){

title: function() { return i18n.t("blocks:" + this.type + ":title"); },
description: function() { return i18n.t("blocks:" + this.type + ":description"); },

alt_text_guidelines: function() {
if (this.show_alt_text) {
return i18n.t("blocks:alt_text_guidelines:intro");
}
return "";
},
alt_text_guidelines_link: function() {
if (this.show_alt_text) {
var link_url = i18n.t("blocks:alt_text_guidelines:link_url");
var link_label = i18n.t("blocks:alt_text_guidelines:link_label");
return '<a target="_blank" href="' + link_url + '">' + link_label + '</a>';
}
return "";
},
icon_name: "resources",
blockGroup: function() { return i18n.t("blocks:group:items") },

Expand Down Expand Up @@ -138,6 +151,8 @@ Core.Block.Resources = (function(){
return `<div class="form resources-admin clearfix">
<div class="widget-header">
${this.description()}
${this.alt_text_guidelines()}
${this.alt_text_guidelines_link()}
</div>
${this.content()}
</div>`
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/spotlight/admin/blocks/uploaded_items_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ SirTrevor.Blocks.UploadedItems = (function(){
return `<div class="form oembed-text-admin clearfix">
<div class="widget-header">
${this.description()}
${this.alt_text_guidelines()}
${this.alt_text_guidelines_link()}
</div>
<div class="row">
<div class="form-group mb-3 col-md-8">
Expand Down
6 changes: 6 additions & 0 deletions app/javascript/spotlight/admin/sir-trevor/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,11 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
group: {
undefined: "Standard widgets",
items: "Exhibit item widgets"
},

alt_text_guidelines: {
intro: 'For each item, please enter alternative text or appropriately check the decorative box. ',
link_label: 'Guidelines for writing alt text.',
link_url: 'https://www.w3.org/WAI/tutorials/images/'
}
});

0 comments on commit 88e63e5

Please sign in to comment.