Skip to content

Commit

Permalink
Add configuration to display an application banner
Browse files Browse the repository at this point in the history
  • Loading branch information
josegar74 committed Oct 9, 2024
1 parent f65ae30 commit 832a023
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 1 deletion.
5 changes: 5 additions & 0 deletions web-ui/src/main/resources/catalog/locales/en-admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,11 @@
"system/xlinkResolver/localXlinkEnable-help": "Local XLinks are using local://<lang>/<service> URL to make references to related sections instead of HTTP URL. Local XLinks are usually faster than HTTP XLinks.",
"system/xlinkResolver/ignore": "Elements to ignore by XLink resolution",
"system/xlinkResolver/ignore-help": "Comma separated list of elements to ignore by XLink resolution",
"system/banner": "Application banner",
"system/banner/enable": "Enable",
"system/banner/enable-help": "If set, an application banner is displayed with the message configured",
"system/banner/message": "Message",
"system/banner/message-help": "Text message to display in the application banner",
"metadata/workflow": "Metadata workflow",
"metadata/workflow/automaticUnpublishInvalidMd": "Automatic unpublication of invalid metadata",
"metadata/workflow/automaticUnpublishInvalidMd-help": " Automatically unpublishes metadata that is edited that becomes not valid according to xsd or schematron rules.",
Expand Down
12 changes: 12 additions & 0 deletions web-ui/src/main/resources/catalog/style/gn_search.less
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,18 @@
}
}

.application-banner {
display: flex;
justify-content: center;
align-items: center;
background-color: #eeaa44;
span {
padding: 10px 50px 10px 50px;
font-weight: bolder;
font-color: #000000;
}
}

button:focus [role="tooltip"],
button:hover [role="tooltip"] {
clip: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,16 @@ <h3>{{section2.name | translate}}</h3>
>
{{s.value}}</textarea
>

<textarea
data-gn-autogrow=""
data-ng-switch-when="system/banner/message"
type="text"
class="form-control"
id="{{s['name']}}"
name="{{s.name}}"
>
{{s.value}}</textarea
>
<select
data-ng-switch-when="system/server/protocol"
class="form-control"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,26 @@
}
]);

module.directive("gnApplicationBanner", [
"gnConfig",
"gnConfigService",
function (gnConfig, gnConfigService) {
return {
restrict: "E",
replace: true,
scope: true,
templateUrl:
"../../catalog/views/default/directives/partials/applicationBanner.html",
link: function linkFn(scope) {
gnConfigService.load().then(function (c) {
scope.isBannerEnabled = gnConfig["system.banner.enable"];
scope.bannerMessage = gnConfig["system.banner.message"];
});
}
};
}
]);

module.directive("gnLinksBtn", [
"gnTplResultlistLinksbtn",
"gnMetadataActions",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div data-ng-if="isBannerEnabled" class="application-banner">
<span> {{bannerMessage}} </span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
xmlns="http://www.w3.org/1999/html"
></nav>

<gn-application-banner></gn-application-banner>

<main class="gn-search-page" id="main-content" data-ng-controller="GnSearchController">
<cookiewarning></cookiewarning>
<div class="" data-ng-controller="gnsDefault">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,10 @@ INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/security/passwordEnforcement/usePattern', 'true', 2, 12002, 'n');
INSERT INTO Settings (name, value, datatype, position, internal, editable) VALUES ('system/security/passwordEnforcement/pattern', '^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*(_|[^\w])).*)$', 0, 12003, 'n', 'n');

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/banner/enable', 'false', 2, 1920, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/banner/message', '', 0, 1921, 'n');


-- WARNING: Security / Add this settings only if you need to allow admin
-- users to be able to reset user password. If you have mail server configured
-- user can reset password directly. If not, then you may want to add that settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ UPDATE Settings SET value='4.4.6' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/userSelfRegistration/domainsAllowed', '', 0, 1911, 'y');

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/banner/enable', 'false', 2, 1920, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/banner/message', '', 0, 1921, 'n');

0 comments on commit 832a023

Please sign in to comment.