Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static page for record view menu #7802

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion domain/src/main/java/org/fao/geonet/domain/page/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public enum PageFormat {

// These are the sections where is shown the link to the Page object
public enum PageSection {
TOP, FOOTER, MENU, SUBMENU, CUSTOM_MENU1, CUSTOM_MENU2, CUSTOM_MENU3;
TOP, FOOTER, MENU, SUBMENU, RECORD_VIEW_MENU, CUSTOM_MENU1, CUSTOM_MENU2, CUSTOM_MENU3;
}

public enum PageExtension {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ <h2>{{('ui-mod-' + m) | translate}}</h2>
<!-- boolean -->
<div
class="row"
data-ng-switch-when="is3DModeAllowed|isVegaEnabled|isSaveMapInCatalogAllowed|isAccessible|isExportMapAsImageEnabled|useOSM|isUserRecordsOnly|isFilterTagsDisplayed|isFilterTagsDisplayedInSearch|autoFitOnLayer|showSocialBarInFooter|isSocialbarEnabled|isLogoInHeader|isHeaderFixed|fluidLayout|fluidHeaderLayout|fluidEditorLayout|showGNName|humanizeDates|sortKeywordsAlphabetically|showMosaic|showMaps|showApplicationInfoAndLinksInFooter|showBatchDropdown|moreLikeThisSameType|allowRemoteRecordLink|singleTileWMS"
data-ng-switch-when="is3DModeAllowed|isVegaEnabled|isSaveMapInCatalogAllowed|isAccessible|isExportMapAsImageEnabled|useOSM|isUserRecordsOnly|isFilterTagsDisplayed|isFilterTagsDisplayedInSearch|autoFitOnLayer|showSocialBarInFooter|isSocialbarEnabled|isLogoInHeader|isHeaderFixed|fluidLayout|fluidHeaderLayout|fluidEditorLayout|showGNName|humanizeDates|sortKeywordsAlphabetically|showMosaic|showMaps|showApplicationInfoAndLinksInFooter|showBatchDropdown|moreLikeThisSameType|allowRemoteRecordLink|singleTileWMS|showStaticPageMenu"
data-ng-switch-when-separator="|"
>
<div class="col-lg-5 gn-nopadding-left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,19 @@
link: function ($scope) {
$scope.pagesMenu = [];

var configKey = $scope.section === "footer" ? "footer" : "header";
$scope.pagesConfig =
gnGlobalSettings.gnCfg.mods[configKey][$scope.section + "CustomMenu"];

if ($scope.pagesConfig && $scope.pagesConfig.length === 0) {
if ($scope.section === "header" || $scope.section === "footer") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the reason for this change. Can you explain why the original code require to be updated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was hardcoded to either header or footer in the previous version. I am just trying to keep the old logic in place. But if you think we should get rid of it to simplify. Let me know

$scope.pagesConfig =
gnGlobalSettings.gnCfg.mods[$scope.section][$scope.section + "CustomMenu"];
if ($scope.pagesConfig && $scope.pagesConfig.length === 0) {
gnStaticPagesService
.loadPages($scope.language, $scope.section)
.then(function (response) {
$scope.pagesConfig = response.data.map(function (p) {
return p.pageId;
});
});
}
} else {
gnStaticPagesService
.loadPages($scope.language, $scope.section)
.then(function (response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@
$scope.showStatusTopBarFor =
gnGlobalSettings.gnCfg.mods.recordview.showStatusTopBarFor;

$scope.showStaticPageMenu =
Copy link
Member

@josegar74 josegar74 Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need an extra setting for this. I mean if the user creates entries with the new menu option, why not show them always instead of adding an extra UI option? What do you think @fxprunayre?

gnGlobalSettings.gnCfg.mods.recordview.showStaticPageMenu;

console.log("111 gnGlobalSettings.gnCfg.mods", gnGlobalSettings.gnCfg.mods);
console.log(
"111 gnGlobalSettings.gnCfg.mods.page.enabled",
gnGlobalSettings.gnCfg.mods.page.enabled
);
console.log("111 $scope.showStaticPageMenu", $scope.showStaticPageMenu);
wangf1122 marked this conversation as resolved.
Show resolved Hide resolved

gnConfigService.load().then(function (c) {
$scope.isRecordHistoryEnabled = gnConfig["system.metadata.history.enabled"];
$scope.isPreferGroupLogo = gnConfig["system.metadata.prefergrouplogo"];
Expand Down
1 change: 1 addition & 0 deletions web-ui/src/main/resources/catalog/js/CatController.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@
isSocialbarEnabled: true,
showStatusWatermarkFor: "",
showStatusTopBarFor: "",
showStaticPageMenu: false,
showCitation: {
enabled: false,
// if: {'documentStandard': ['iso19115-3.2018']}
Expand Down
2 changes: 2 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 @@ -1325,6 +1325,8 @@
"ui-isSocialbarEnabled-help": "Show the button bar with all the social buttons (facebook, twitter, etc.)",
"ui-showStatusWatermarkFor": "Show a watermark",
"ui-showStatusWatermarkFor-help": "List of codelist values (eg. completed,historicalArchive,obsolete,superseded) for which the record status as a watermark displayed through the text",
"ui-showStaticPageMenu": "Show Additional Links",
"ui-showStaticPageMenu-help": "List of Additional Links configured as Static Pages type Record View Page",
"ui-showStatusTopBarFor": "Show status bar",
"ui-showStatusTopBarFor-help": "List of codelist values (eg. completed,historicalArchive,obsolete,superseded) for which the record status as a bar at the top of the record",
"ui-isLogoInHeader": "Show the logo in header",
Expand Down
1 change: 1 addition & 0 deletions web-ui/src/main/resources/catalog/locales/en-search.json
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@
"addLayerPrefix": "Add layer",
"addLayerPostfix": "to the map",
"submit": "Submit",
"additionalLinks": "Additional Links",
"indexingErrorMsg-invalidBounds": "Warning / Field resourceTemporalDateRange / Lower and upper bounds empty or not valid dates. Date range not indexed.",
"indexingErrorMsg-invalidDateFormat": "Warning / Date {{dateType}} with value '{{date}}' was not a valid date format.",
"indexingErrorMsg-keywordNotFoundInThesaurus": "Warning / Keyword {{keyword}} not found in {{thesaurus}}.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,29 @@
</div>

<div class="pull-right">
<!--record view menu static pages-->
<div data-ng-show="showStaticPageMenu" class="btn-group pull-left" role="group">
<button
type="button"
class="btn btn-default dropdown-toggle"
data-toggle="dropdown"
aria-label="{{'additionalLinks' | translate}}"
aria-expanded="false"
>
<span class="fa fa-light fa-arrow-up-right-from-square"></span>
<span data-translate="" class="hidden-sm hidden-xs">additionalLinks</span>
<span class="caret"></span>
</button>

<ul
class="dropdown-menu"
role="menu"
gn-static-pages-list-viewer
data-section="record_view_menu"
data-language="{{lang}}"
></ul>
</div>

<!-- edit -->
<div class="btn-group pull-left" role="group">
<a
Expand Down