Skip to content

Commit

Permalink
Configuration to display an application banner (#8416)
Browse files Browse the repository at this point in the history
* Add configuration to display an application banner

* Add configuration to display an application banner - use translations for the message

* Application banner - update style
  • Loading branch information
josegar74 authored Nov 4, 2024
1 parent c93b5b1 commit cd50ded
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 1 deletion.
3 changes: 3 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,9 @@
"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. To configure the message, go to <a href='#/settings/languages' target='_blank'>Language and translations</a> and configure a translation with the key <strong>application-banner</strong>",
"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
9 changes: 9 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,15 @@
}
}

.application-banner {
background-color: #fff8c5;
border: 1px solid #d4a72c66;
margin: 15px;
padding: 15px;
border-radius: 4px;
color: #000;
}

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,6 @@ <h3>{{section2.name | translate}}</h3>
>
{{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,25 @@
}
]);

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"];
});
}
};
}
]);

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 data-translate="">application-banner</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,9 @@ 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');


-- 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,5 @@ UPDATE Settings SET value='4.4.6' WHERE name='system/platform/version';
UPDATE Settings SET value='0' 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');

0 comments on commit cd50ded

Please sign in to comment.