Skip to content

Commit 99d640f

Browse files
authored
Merge pull request #58 from HSG-Library/develop
- switch to new dynamic alert bar (always on top, message from SharePoint) - hide search result snippet
2 parents afa6c9c + f67d9af commit 99d640f

File tree

12 files changed

+84
-134
lines changed

12 files changed

+84
-134
lines changed

css/hsg-alert.css

Lines changed: 0 additions & 47 deletions
This file was deleted.

css/hsg-before-body-alert.css

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
/* body::before {
2-
content: "";
3-
display: inline-block;
1+
body::before {
2+
content: var(--alert-message, );
3+
display: block;
4+
overflow: hidden;
45
background: #ff9cdb;
6+
animation: slideInDown 0.2s ease-in-out forwards;
57
text-align: center;
6-
padding: 10px;
78
width: 100%;
89
font-weight: normal;
10+
line-height: 45px;
911
color: black;
12+
height: 0;
1013
}
1114

12-
*/
15+
@keyframes slideInDown {
16+
from {
17+
height: 0;
18+
}
19+
20+
to {
21+
height: 45px;
22+
}
23+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/****************************************/
2+
/****** hide search result snippet ******/
3+
/****************************************/
4+
5+
prm-snippet {
6+
display: none;
7+
}

html/homepage/homepage_de.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
<md-content ng-controller="hsgHomeController as $ctrl">
2-
<div class="ps_content md-padding" layout-gt-sm="row" layout-align="center start" flex="100">
3-
<div flex-gt-sm="80" flex="100" layout="column">
4-
<hsg-alert-message-component></hsg-alert-message-component>
5-
</div>
6-
</div>
7-
82
<div class="ps_content md-padding" layout-gt-sm="row" layout-align="center start" flex="100">
93
<!-- column 1-->
104
<div flex-gt-sm="40" flex="100" layout="column">

html/homepage/homepage_en.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
<md-content ng-controller="hsgHomeController as $ctrl">
2-
<div class="ps_content md-padding" layout-gt-sm="row" layout-align="center start" flex="100">
3-
<div flex-gt-sm="80" flex="100" layout="column">
4-
<hsg-alert-message-component></hsg-alert-message-component>
5-
</div>
6-
</div>
72

83
<div class="ps_content md-padding" layout-gt-sm="row" layout-align="center start" flex="100">
94
<!-- column 1-->

js/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
import { hsgHowovpAfterModule } from './modules/alma-howovp-after/hsg-howovp-after.module';
33
import { hsgHtgiSvcAfterModule } from './modules/alma-htgi-svc-after/hsg-htgi-svc-after.module';
4-
import { hsgAlertMessageModule } from './modules/hsg-alert-message/hsg-alert-message.module';
54
import { hsgExceptionHandlerModule } from './modules/hsg-exception-handler/hsg-exception-handler.module';
65
import { hsgHomeModule } from './modules/hsg-home/hsg-home.module';
76
import { hsgPickupAnywhereFormAfterModule } from './modules/pickup-anywhere-form-after/hsg-pickup-anywhere-form-after.module';
@@ -46,11 +45,11 @@ import { hsgUnionCatalogLoginAfterModule } from './modules/prm-union-catalog-log
4645
import { hsgUserAreaExpandableAfterModule } from './modules/prm-user-area-expandable-after/hsg-user-ara-expandable-after.module';
4746
import { slspHttpInterceptPickupInformation } from './modules/slsp-http-intercept-pickup-information/slsp-http-intercept-pickup-information.module';
4847
import { slspHttpInterceptRequestsModule } from './modules/slsp-http-intercept-requests/slsp-http-intercept-requests.module';
48+
import { hsgExploreMainAfterModule } from './modules/prm-explore-main/hsg-explore-main-after.module';
4949

5050
let app = angular.module('viewCustom', ['angularLoad']);
5151

5252
app.requires.push(hsgHomeModule.name);
53-
app.requires.push(hsgAlertMessageModule.name);
5453
app.requires.push(hsgExceptionHandlerModule.name);
5554
app.requires.push(hsgHowovpAfterModule.name);
5655
app.requires.push(hsgHtgiSvcAfterModule.name);
@@ -60,6 +59,7 @@ app.requires.push(hsgAlmaViewerAfterModule.name);
6059
app.requires.push(hsgAlmaViewitAfterModule.name);
6160
app.requires.push(hsgAlmaViewitItemsAfterModule.name);
6261
app.requires.push(hsgCitationAfterModule.name);
62+
app.requires.push(hsgExploreMainAfterModule.name);
6363
app.requires.push(hsgFinesAfterModule.name);
6464
app.requires.push(hsgFavoritesEditLabelsMenuAfterModule.name);
6565
app.requires.push(hsgFullViewAfterModule.name);

js/modules/hsg-alert-message/hsg-alert-message.controller.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

js/modules/hsg-alert-message/hsg-alert-message.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

js/modules/hsg-alert-message/hsg-alert-message.config.js renamed to js/modules/prm-explore-main/hsg-alert-message/hsg-alert-message.config.js

File renamed without changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
export class hsgAlertMessageController {
3+
4+
constructor($http, hsgTranslatorService, hsgAlertMessageConfig) {
5+
this.$http = $http;
6+
this.translator = hsgTranslatorService;
7+
this.config = hsgAlertMessageConfig;
8+
this.showMessage = false;
9+
this.message = '';
10+
this.fetchMessage();
11+
}
12+
13+
fetchMessage() {
14+
let url = this.config.messageUrl;
15+
let requestBody = {
16+
lang: this.translator.getLang()
17+
};
18+
let that = this;
19+
this.$http.post(
20+
url,
21+
requestBody
22+
).then(
23+
function (successResponse) {
24+
that.showMessage = false;
25+
that.message = successResponse.data;
26+
if (that.message && !/^\s+$/.test(that.message)) {
27+
that.showMessage = true;
28+
document.documentElement.style.setProperty('--alert-message', `"${that.message}"`);
29+
return;
30+
}
31+
that.showMessage = false;
32+
document.documentElement.style.setProperty('--alert-message', '');
33+
},
34+
function (errorResponse) {
35+
that.showMessage = false;
36+
let code = errorResponse.data.error.code;
37+
let errorMessage = errorResponse.data.error.message;
38+
throw new Error("Could not retrieve hsg alert message from '" + url + "'. Error: '" + code + "', '" + errorMessage + "'");
39+
}
40+
);
41+
}
42+
}
43+
44+
hsgAlertMessageController.$inject = ['$http', 'hsgTranslatorService', 'hsgAlertMessageConfig'];

0 commit comments

Comments
 (0)