Skip to content

Commit

Permalink
INTRANET-299 add message field to oclc alert display
Browse files Browse the repository at this point in the history
  • Loading branch information
bricas committed Jan 17, 2025
1 parent 8677f47 commit 8e9dbc8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,41 @@
* @type {object}
*
* @prop status
* @prop message
*/
defaults: {
status: false,
message: '',
},
url: '',
message: '',
alert: '',
options: '',

getStatus: function() {
return this.get('status');
},

getMessage: function() {
return this.get('message');
},

initialize: function(status, options) {
this.set('status', status);
this.message = options.message;
this.set('message', options.message);
this.url = options.url;

this.alert = $(OCLCStatusTemplate({message: this.message}));
this.alert = $(OCLCStatusTemplate({message: this.getMessage()}));
this.options = options;
$('#discovery-search').append(this.alert);

this.fetch({
success: function(model, response, options) {
success: function(model, response) {
model.set('status', response.status);
model.set('message', this.options.message);
if (response.message) {
model.set('message', response.message);
}
$('#oclc-service-alert-message').html(this.getMessage());
model.toggleView();
}
});
Expand All @@ -59,8 +71,13 @@
model = this;
setInterval(function() {
model.fetch({
success: function(model, response, options) {
success: function(model, response) {
model.set('status', response.status);
model.set('message', this.options.message);
if (response.message) {
model.set('message', response.message);
}
$('#oclc-service-alert-message').html(this.getMessage());
model.toggleView();
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
OCLCStatusTemplate = _.template(
'<div id="oclc-service-alert" class="col-12 my-0 collapse alert alert-warning"><i class="fa fa-lg fa-exclamation-triangle text-danger"></i> <strong><%= message %></strong> <a href="https://lib.unb.ca/help/status" class="btn btn-sm btn-dark">More Info<span class="sr-only"> about online resource issues</span></a></div>'
'<div id="oclc-service-alert" class="col-12 my-0 collapse alert alert-warning"><i class="fa fa-lg fa-exclamation-triangle text-danger"></i> <strong id="oclc-service-alert-message"><%= message %></strong> <a href="https://lib.unb.ca/help/status" class="btn btn-sm btn-dark">More Info<span class="sr-only"> about online resource issues</span></a></div>'
);

0 comments on commit 8e9dbc8

Please sign in to comment.