diff --git a/geonode_mapstore_client/client/README.md b/geonode_mapstore_client/client/README.md index 48dc85a0d8..8ee18951aa 100644 --- a/geonode_mapstore_client/client/README.md +++ b/geonode_mapstore_client/client/README.md @@ -1,29 +1,14 @@ # GeoNode MapStore Client Project This directory is the root folder where to initialize all the npm scripts. See the main [README.md](../../README.md) for more information about this directory. +## Configuration -This project contains following applications: - -- [MapStore js API](#mapStore-js-api) -- [GeoStory](#geostory) -- [Homepage](#homepage) - -## MapStore js API -Api used inside django templates to show map and layer viewers - -## GeoStory -This application allow to show and edit stories with map and geospatial data -## Homepage - -This single application is an alternative homepage that interact with the GeoNode API v2 and shows available resources. You can enable this app by replacing the content of the index.html of a GeoNode project with the [home.html](home.html) template. - -The homepage configuration file is located in [localConfig.json](static/mapstore/configs/localConfig.json) and it exposes specific properties to customize the homepage theme and structure: +The configuration file is located in [localConfig.json](static/mapstore/configs/localConfig.json) and it exposes specific properties to customize: ### localConfig.json | property | type | description | | | --- | --- | --- | --- | -| `geoNodeApi` | {object} | | | | `supportedLocales` | {object} | | | | `geoNodeConfiguration` | {object} | contains all the configuration needed to change the theme, filters and navbar structures | [see available properties](#geonode-configuration) | @@ -33,7 +18,6 @@ The homepage configuration file is located in [localConfig.json](static/mapstore | property | type | description | | | --- | --- | --- | --- | -| `theme` | {object} | general theme configuration variables | [see available properties](#theme-configuration) | | `filters` | {object} | configuration of filter | | | `filters.order` | {object} | configuration of order dropdown | | | `filters.order.defaultLabelId` | {string} | label id to use for the order dropdown button | | @@ -41,44 +25,12 @@ The homepage configuration file is located in [localConfig.json](static/mapstore | `filters.extent` | {object} | configuration of extent filter | | | `filters.extent.layers` | {array} | a list of MapStore layers object used as extent background | | | `filters.extent.style` | {object} | a MapStore vector style object | | -| `navbar` | {object} | configuration of the brand navbar (top) | | -| `navbar.logo` | {array} | list of logo items | [logo item entry](#logo-item) | -| `navbar.items` | {array} | list of menu item objects, right placement | [menu item object entry](#menu-item-object) | -| `menu` | {object} | configuration of the main menu | | -| `menu.items` | {array} | list of menu item objects, left placement | [menu item object entry](#menu-item-object) | -| `menu.rightItems` | {array} | list of menu item objects, right placement | [menu item object entry](#menu-item-object) | -| `menu.cfg.rightContents.style.width` | {number} | value to fix width in right side of action navbar | [menu item object entry](#menu-item-object) | -| `footer` | {object} | configuration of the footer | | -| `footer.items` | {array} | list of menu item objects, left placement | [menu item object entry](#menu-item-object) | | `cardsMenu` | {object} | configuration of the menu of resource cards | | | `cardsMenu.items` | {array} | list of menu item objects, right placement | [menu item object entry](#menu-item-object) | | `cardOptions` | {object} | configuration of the resource cards dropdown | | | `cardOptions.items` | {array} | list of menu item objects, dropdown placement | [menu item object entry](#menu-item-object) | | `filtersForm` | {object} | configuration of the resource cards dropdown | | | `filtersForm.items` | {array} | list of filter objects, panel placement | [filter object](#filter-object) | -### Theme configuration - -[geoNodeConfiguration](#geonode-configuration).theme - -| property | type | description | -| --- | --- | --- | -| `variant` | {string} | "light" or "dark" | -| `color` | {string} | main theme color | -| `navbar` | {object} | navbar theme properties | -| `navbar.style` | {object} | a css style object to apply on the navbar container node | -| `hero` | {object} | hero image theme properties | -| `hero.style` | {object} | a css style object to apply on the hero image container node, use backgroundImage css property to apply a background image | -| `jumbotron` | {object} | jumbotron text content theme properties | -| `jumbotron.style` | {object} | a css style object to apply on the jumbotron container node | -| `languageSelector` | {object} | language selector theme properties | -| `languageSelector.inline` | {boolean} | shows languages as inline text if true, default false shows a dropdown | -| `footer` | {object} | footer theme properties | -| `footer.color` | {string} | footer text color (css variable --gn-footer-color) | -| `footer.bg` | {string} | footer background color (css variable --gn-footer-bg) | -| `footer.link` | {object} | theme for footer link | -| `footer.link.color` | {string} | footer link text color (css variable --gn-footer-link-color) | -| `footer.link.hoverColor` | {string} | footer link text color on hover (css variable --gn-footer-link-hover-color) | -| `footer.style` | {string} | a css style object to apply on the footer container node | ### Order Object @@ -90,31 +42,6 @@ Order object contains properties for an entry of the order dropdown. Configurati "value": "title" // value used in the sort filter } ``` -### Logo Item - -Logo item contains properties for an image rendered in the top navbar. Configuration: - -```js -{ - "src": "path/to/image.png", // image source - "href": "#/", // logo href - "style": { // default css style object - "minHeight": 80 - }, - "sm": { // page size key small screen - "style": { // small screen css style object - "minHeight": 40 - } - }, - "md": { // page size key medium screen - "style": {} // medium screen css style object - }, - "lg": { // page size key large screen - "style": {} // large screen css style object - } -} -``` - ### Menu Item Object Menu item object contains properties for a list item rendered in a menu. Configuration: @@ -214,4 +141,4 @@ Filter object contains properties for a select input rendered inside the filter ] } ``` -Filter items supports also the following types from [menu object configuration](#menu-item-object): filter, divider and link. \ No newline at end of file +Filter items supports also the following types from [menu object configuration](#menu-item-object): filter, divider and link. diff --git a/geonode_mapstore_client/client/js/actions/gnresource.js b/geonode_mapstore_client/client/js/actions/gnresource.js index 8f6112db09..2e6fe590cb 100644 --- a/geonode_mapstore_client/client/js/actions/gnresource.js +++ b/geonode_mapstore_client/client/js/actions/gnresource.js @@ -82,11 +82,11 @@ export function editAbstractResource(abstract) { * @param {string} image resource */ -export function editThumbnailResource(thumbnail_url) { +export function editThumbnailResource(thumbnailUrl) { return { type: EDIT_THUMBNAIL_RESOURCE, - thumbnail_url + thumbnailUrl }; } diff --git a/geonode_mapstore_client/client/js/actions/gnsearch.js b/geonode_mapstore_client/client/js/actions/gnsearch.js index 64001a4ae0..0ef84dadea 100644 --- a/geonode_mapstore_client/client/js/actions/gnsearch.js +++ b/geonode_mapstore_client/client/js/actions/gnsearch.js @@ -6,9 +6,6 @@ * LICENSE file in the root directory of this source tree. */ -export const FETCH_SUGGESTIONS = 'GEONODE_SEARCH:FETCH_SUGGESTIONS'; -export const UPDATE_SUGGESTIONS = 'GEONODE_SEARCH:UPDATE_SUGGESTIONS'; -export const LOADING_SUGGESTIONS = 'GEONODE_SEARCH:LOADING_SUGGESTIONS'; export const SEARCH_RESOURCES = 'GEONODE_SEARCH:SEARCH_RESOURCES'; export const UPDATE_RESOURCES = 'GEONODE_SEARCH:UPDATE_RESOURCES'; export const LOADING_RESOURCES = 'GEONODE_SEARCH:LOADING_RESOURCES'; @@ -18,27 +15,6 @@ export const UPDATE_RESOURCES_METADATA = 'GEONODE_SEARCH:UPDATE_RESOURCES_METADA export const SET_FEATURED_RESOURCES = 'GEONODE:SET_FEATURED_RESOURCES'; export const UPDATE_FEATURED_RESOURCES = 'GEONODE_SEARCH:UPDATE_FEATURED_RESOURCES'; -export function fetchSuggestions(text) { - return { - type: FETCH_SUGGESTIONS, - text - }; -} - -export function updateSuggestions(suggestions) { - return { - type: UPDATE_SUGGESTIONS, - suggestions - }; -} - -export function loadingSuggestions(loading) { - return { - type: LOADING_SUGGESTIONS, - loading - }; -} - export function searchResources(params, pathname) { return { type: SEARCH_RESOURCES, @@ -106,12 +82,6 @@ export function loadFeaturedResources(action, pageSize = 4) { } export default { - FETCH_SUGGESTIONS, - fetchSuggestions, - UPDATE_SUGGESTIONS, - updateSuggestions, - LOADING_SUGGESTIONS, - loadingSuggestions, SEARCH_RESOURCES, searchResources, UPDATE_RESOURCES, diff --git a/geonode_mapstore_client/client/js/api/geonode.js b/geonode_mapstore_client/client/js/api/geonode.js deleted file mode 100644 index ed199fb880..0000000000 --- a/geonode_mapstore_client/client/js/api/geonode.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2018, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import Rx from 'rxjs'; -import axios from '@mapstore/framework/libs/ajax'; -import { getConfigProp } from "@mapstore/framework/utils/ConfigUtils"; - -const getLayerEditPerimissions = (name) => { - const baseUrl = getConfigProp("geonodeUrl") || "./"; - return axios.get(`${baseUrl}gs/${name}/edit-check`); -}; -const getStyleEditPerimissions = (name) => { - const baseUrl = getConfigProp("geonodeUrl") || "./"; - return axios.get(`${baseUrl}gs/${name}/style-check`); -}; - -/** - * Retrieve layer's edit permission from local gs otherwise are false - */ -export const layerEditPermissions = (layer) => - Rx.Observable.defer(() => getLayerEditPerimissions(layer.name)) - .pluck("data") - .map(({ authorized }) => ({ canEdit: authorized })); -export const styleEditPermissions = (layer) => - Rx.Observable.defer(() => getStyleEditPerimissions(layer.name)) - .pluck("data") - .map(({ authorized }) => ({ canEdit: authorized })); - -export default { - layerEditPermissions, - styleEditPermissions -}; diff --git a/geonode_mapstore_client/client/js/api/geonode/user/index.js b/geonode_mapstore_client/client/js/api/geonode/user/index.js new file mode 100644 index 0000000000..41847526c3 --- /dev/null +++ b/geonode_mapstore_client/client/js/api/geonode/user/index.js @@ -0,0 +1,21 @@ +/* + * Copyright 2020, GeoSolutions Sas. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +import axios from '@mapstore/framework/libs/ajax'; +import { getConfigProp } from '@mapstore/framework/utils/ConfigUtils'; + +/** +* Api for GeoNode user +* @name api.geonode.user +*/ + +export const getUserInfo = () => { + const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {}; + return axios.get(`${endpointV1}/o/v4/userinfo`) + .then(({ data }) => data); +}; diff --git a/geonode_mapstore_client/client/js/api/geonode/v1/__tests__/index-test.js b/geonode_mapstore_client/client/js/api/geonode/v1/__tests__/index-test.js deleted file mode 100644 index 7728a5da5f..0000000000 --- a/geonode_mapstore_client/client/js/api/geonode/v1/__tests__/index-test.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import expect from 'expect'; -import MockAdapter from 'axios-mock-adapter'; -import axios from '@mapstore/framework/libs/ajax'; -import { - getResourceByPk -} from '@js/api/geonode/v1'; - -let mockAxios; - -describe('GeoNode v1 api', () => { - beforeEach(done => { - global.__DEVTOOLS__ = true; - mockAxios = new MockAdapter(axios); - setTimeout(done); - }); - - afterEach(done => { - delete global.__DEVTOOLS__; - mockAxios.restore(); - setTimeout(done); - }); - - it('should request a resource by primary key (getResourceByPk)', (done) => { - const pk = 1; - const resource = { - 'id': pk, - 'title': 'Map', - 'abstract': 'Description', - 'thumbnail_url': 'thumbnail.jpeg' - }; - mockAxios.onGet(new RegExp(`/base/${pk}`)) - .reply(() => { - return [ 200, resource]; - }); - getResourceByPk(pk) - .then((response) => { - expect(response).toEqual({ ...resource, pk }); - done(); - }); - }); -}); diff --git a/geonode_mapstore_client/client/js/api/geonode/v1/index.js b/geonode_mapstore_client/client/js/api/geonode/v1/index.js deleted file mode 100644 index 50850edc41..0000000000 --- a/geonode_mapstore_client/client/js/api/geonode/v1/index.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2020, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import axios from '@mapstore/framework/libs/ajax'; -import { getConfigProp } from '@mapstore/framework/utils/ConfigUtils'; -import cookies from 'js-cookie'; - -/** -* Api for GeoNode v1 -* @name api.geonode.v1 -*/ - -/** -* Get resource by primary key -* @memberof api.geonode.v1 -* @param {number|string} pk primary key -* @return {promise} it returns an object with requested resource -*/ -export const getResourceByPk = (pk) => { - const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {}; - return axios.get(`${endpointV1}/base/${pk}`) - // add pk as alias to id - // used in save and save as for map - .then(({ data }) => ({ pk: data.id, ...data })); -}; - -export const autocomplete = (params) => { - const { endpointAutocomplete = '/base/autocomplete_response' } = getConfigProp('geoNodeApi') || {}; - return axios.get(endpointAutocomplete, { params }) - .then(({ data }) => { - return { - suggestions: (data?.results || []) - .map(({ id, text }) => { - return { - id, - label: text, - value: text - }; - }) - }; - }); -}; - -export const getUserInfo = () => { - const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {}; - return axios.get(`${endpointV1}/o/v4/userinfo`) - .then(({ data }) => data); -}; - - -export const setLanguage = (languageCode) => { - const csrfMiddlewareToken = cookies.get('csrftoken'); - return axios.post('/i18n/setlang/', `csrfmiddlewaretoken=${csrfMiddlewareToken}&language=${languageCode}`, { - params: { - next: '/static/mapstore/configs/placeholder.json' - } - }); -}; - -export default { - getResourceByPk, - setLanguage -}; diff --git a/geonode_mapstore_client/client/js/api/geonode/v2/index.js b/geonode_mapstore_client/client/js/api/geonode/v2/index.js index 3a10acd02f..7edf26f285 100644 --- a/geonode_mapstore_client/client/js/api/geonode/v2/index.js +++ b/geonode_mapstore_client/client/js/api/geonode/v2/index.js @@ -19,7 +19,7 @@ import isString from 'lodash/isString'; import isObject from 'lodash/isObject'; import castArray from 'lodash/castArray'; import get from 'lodash/get'; -import { getUserInfo } from '@js/api/geonode/v1'; +import { getUserInfo } from '@js/api/geonode/user'; import { setFilterById } from '@js/utils/GNSearchUtils'; let endpoints = { diff --git a/geonode_mapstore_client/client/js/apps/gn-catalogue.js b/geonode_mapstore_client/client/js/apps/gn-catalogue.js index 81e40befae..ea691549aa 100644 --- a/geonode_mapstore_client/client/js/apps/gn-catalogue.js +++ b/geonode_mapstore_client/client/js/apps/gn-catalogue.js @@ -67,7 +67,6 @@ import { } from '@js/epics'; import gnviewerEpics from '@js/epics/gnviewer'; import gnsearchEpics from '@js/epics/gnsearch'; -import gnlocaleEpics from '@js/epics/gnlocale'; import maplayout from '@mapstore/framework/reducers/maplayout'; import pluginsDefinition from '@js/plugins/index'; @@ -235,8 +234,7 @@ Promise.all([ gnSetLayersPermissions, ...pluginsDefinition.epics, ...gnviewerEpics, - ...gnsearchEpics, - ...gnlocaleEpics + ...gnsearchEpics }, geoNodeConfiguration, initialActions: [ diff --git a/geonode_mapstore_client/client/js/apps/gn-home.jsx b/geonode_mapstore_client/client/js/apps/gn-home.jsx index c16cc2e2ac..712088cdbe 100644 --- a/geonode_mapstore_client/client/js/apps/gn-home.jsx +++ b/geonode_mapstore_client/client/js/apps/gn-home.jsx @@ -19,7 +19,6 @@ import Home from '@js/routes/Home'; import gnsearch from '@js/reducers/gnsearch'; import gnresource from '@js/reducers/gnresource'; import gnsearchEpics from '@js/epics/gnsearch'; -import gnlocaleEpics from '@js/epics/gnlocale'; import gnsaveEpics from '@js/epics/gnsave'; import { @@ -84,7 +83,6 @@ Promise.all([ }, appEpics: { ...gnsearchEpics, - ...gnlocaleEpics, ...gnsaveEpics }, geoNodeConfiguration diff --git a/geonode_mapstore_client/client/js/components/ResourceCard/ResourceCard.jsx b/geonode_mapstore_client/client/js/components/ResourceCard/ResourceCard.jsx index 43403aa28a..cdd53d577a 100644 --- a/geonode_mapstore_client/client/js/components/ResourceCard/ResourceCard.jsx +++ b/geonode_mapstore_client/client/js/components/ResourceCard/ResourceCard.jsx @@ -9,7 +9,6 @@ import React, { forwardRef } from 'react'; import Message from '@mapstore/framework/components/I18N/Message'; import FaIcon from '@js/components/FaIcon'; -import Tag from '@js/components/Tag'; import Dropdown from '@js/components/Dropdown'; import { getUserName, @@ -49,14 +48,14 @@ const ResourceCard = forwardRef(({
{icon && <> - - + } variables[key]) - .map((key) => `\t${key}: ${variables[key]};`).join('\n') + - '\n}'; -} - -function buttonTheme(style, name) { - const prefix = name ? '-' + name : ''; - const bg = style.bg; - const color = style.color || tinycolor.mostReadable(bg, ['#ffffff', '#000000'], { - includeFallbackColors: true - }).toHexString(); - - const borderColor = style.borderColor || bg; - const focusColor = style.focusColor || color; - const focusBg = style.focusBg || tinycolor(bg).darken(10).toString(); - const focusBorderColor = style.focusBorderColor || tinycolor(bg).darken(25).toString(); - const hoverColor = style.hoverColor || color; - const hoverBg = style.hoverBg || tinycolor(bg).darken(10).toString(); - const hoverBorderColor = style.hoverBorderColor || tinycolor(bg).darken(12).toString(); - const activeColor = style.activeColor || color; - const activeBg = style.activeBg || tinycolor(bg).darken(10).toString(); - const activeBorderColor = style.activeBorderColor || tinycolor(bg).darken(12).toString(); - const activeHoverColor = style.activeHoverColor || color; - const activeHoverBg = style.activeHoverBg || tinycolor(bg).darken(17).toString(); - const activeHoverBorderColor = style.activeHoverBorderColor || tinycolor(bg).darken(25).toString(); - const disableColor = style.disableColor || color; - const disabledBg = style.disabledBg || tinycolor(tinycolor(bg).desaturate(30).toString()).lighten(20).toString(); - const disabledBorderColor = style.disabledBorderColor || tinycolor(tinycolor(bg).desaturate(30).toString()).lighten(20).toString(); - const badgeColor = style.badgeColor || bg; - const badgeBg = style.badgeBg || color; - return { - [`--gn-button${prefix}-color`]: color, - [`--gn-button${prefix}-bg`]: bg, - [`--gn-button${prefix}-border-color`]: borderColor, - [`--gn-button${prefix}-focus-color`]: focusColor, - [`--gn-button${prefix}-focus-bg`]: focusBg, - [`--gn-button${prefix}-focus-border-color`]: focusBorderColor, - [`--gn-button${prefix}-hover-color`]: hoverColor, - [`--gn-button${prefix}-hover-bg`]: hoverBg, - [`--gn-button${prefix}-hover-border-color`]: hoverBorderColor, - [`--gn-button${prefix}-active-color`]: activeColor, - [`--gn-button${prefix}-active-bg`]: activeBg, - [`--gn-button${prefix}-active-border-color`]: activeBorderColor, - [`--gn-button${prefix}-active-hover-color`]: activeHoverColor, - [`--gn-button${prefix}-active-hover-bg`]: activeHoverBg, - [`--gn-button${prefix}-active-hover-border-color`]: activeHoverBorderColor, - [`--gn-button${prefix}-disabled-color`]: disableColor, - [`--gn-button${prefix}-disabled-bg`]: disabledBg, - [`--gn-button${prefix}-disabled-border-color`]: disabledBorderColor, - [`--gn-button${prefix}-badge-color`]: badgeColor, - [`--gn-button${prefix}-badge-bg`]: badgeBg - }; -} - -function RootStyle({ - targetId, - theme -}) { - - const variables = useMemo(() => { - if (theme) { - const { - color: themeColor, - body, - bodyShade, - placeholder, - disabled, - info, - success, - warning, - danger, - primary, - link, - image, - jumbotron, - focus, - tag, - badge, - footer, - buttonDefault, - buttonPrimary, - buttonInfo, - buttonSuccess, - buttonWarning, - buttonDanger - } = theme; - - const bg = primary?.value || themeColor; - const color = primary?.contrast || bg && tinycolor.mostReadable(bg, ['#ffffff', '#000000'], { - includeFallbackColors: true - }).toHexString(); - - const btnPrimary = (bg || buttonPrimary) && { - ...(bg && { bg }), - ...(color && { color }), - ...buttonPrimary - }; - - return { - ...(bg && { - '--gn-primary-contrast': color, - '--gn-primary': bg, - '--gn-loader-primary-color': bg, - '--gn-loader-primary-fade-color': tinycolor(bg).setAlpha(0.2).toString(), - '--gn-loader-primary-contrast-color': color, - '--gn-loader-primary-contrast-fade-color': tinycolor(color).setAlpha(0.2).toString() - }), - ...(body && { - ' --gn-main-color': body.color || '#000000', - '--gn-main-bg': body.bg || '#ffffff', - '--gn-main-border-color': body.borderColor || '#dddddd', - '--gn-loader-color': '', - '--gn-loader-fade-color': '' - }), - ...(bodyShade && { - '--gn-main-variant-color': bodyShade.color || '#000000', - '--gn-main-variant-bg': bodyShade.bg || '#f2f0f0' - }), - ...(placeholder && { - '--gn-placeholder-color': placeholder.color || '#aaaaaa', - '--gn-placeholder-bg': placeholder.bg || '#dddddd' - }), - ...(disabled && { - '--gn-disabled-color': disabled.color || '#acacac', - '--gn-disabled-bg': disabled.bg || '#fcfcfc' - }), - ...(primary && { - '--gn-primary-contrast': primary.contrast || '#ffffff', - '--gn-primary': primary.value || '#397AAB' - }), - ...(info && { - '--gn-info-contrast': info.contrast || '#ffffff', - '--gn-info': info.value || '#639fcc' - }), - ...(success && { - '--gn-success-contrast': success.contrast || '#ffffff', - '--gn-success': success.value || '#58cf80' - }), - ...(warning && { - '--gn-warning-contrast': warning.contrast || '#ffffff', - '--gn-warning': warning.value || '#ebbc35' - }), - ...(danger && { - '--gn-danger-contrast': danger.contrast || '#ffffff', - '--gn-danger': danger.value || '#bb4940' - }), - ...(link && { - '--gn-link-color': link.color || '#397AAB', - '--gn-link-hover-color': link.hoverColor || '#1b4d74' - }), - ...(image && { - '--gn-image-color': image.color || '#ffffff', - '--gn-image-bg': image.bg || '#333333' - }), - ...(jumbotron && { - '--gn-jumbotron-color': jumbotron.color || '#ffffff', - '--gn-jumbotron-bg': jumbotron.bg || '#333333' - }), - ...(focus && { - '--gn-focus-color': focus.color || 'rgba(#397AAB, 0.4)' - }), - ...(tag && { - '--gn-tag-color': tag.color || '#000000', - '--gn-tag-hover-color': tag.hoverColor || '#ffffff', - '--gn-tag-hover-bg': tag.hoverBg || 'rgba(#397AAB, 0.75)', - '--gn-tag-active-color': tag.activeColor || '#ffffff', - '--gn-tag-active-bg': tag.activeBg || '#397AAB' - }), - ...(tag && { - '--gn-badge-color': badge.color || '#f2f2f2', - '--gn-badge-bg': badge.bg || '#777777' - }), - ...(footer && { - '--gn-footer-color': footer.color || '#000000', - '--gn-footer-bg': footer.bg || '#ffffff', - ...(footer?.link && { - '--gn-footer-link-color': footer.link.color || '#397AAB', - '--gn-footer-link-hover-color': footer.link.hoverColor || '#1b4d74' - }) - }), - ...(buttonDefault?.bg && buttonTheme(buttonDefault)), - ...(buttonInfo?.bg && buttonTheme(buttonInfo, 'info')), - ...(buttonSuccess?.bg && buttonTheme(buttonSuccess, 'success')), - ...(buttonWarning?.bg && buttonTheme(buttonWarning, 'warning')), - ...(buttonDanger?.bg && buttonTheme(buttonDanger, 'danger')), - ...(btnPrimary?.bg && buttonTheme(btnPrimary, 'primary')) - }; - } - return {}; - }, [theme]); - return ( - {% block map_content %} -{% include './_geonode_config.html' with plugins_config_key=plugins_config_key|default:'map_edit' is_new_resource=is_new|default:'false' %} +{% include '../_geonode_config.html' with plugins_config_key=plugins_config_key|default:'map_edit' is_new_resource=is_new|default:'false' %}
diff --git a/geonode_mapstore_client/templates/geonode-mapstore-client/map_new.html b/geonode_mapstore_client/templates/geonode-mapstore-client/legacy/map_new.html similarity index 100% rename from geonode_mapstore_client/templates/geonode-mapstore-client/map_new.html rename to geonode_mapstore_client/templates/geonode-mapstore-client/legacy/map_new.html diff --git a/geonode_mapstore_client/templates/geonode-mapstore-client/map_view.html b/geonode_mapstore_client/templates/geonode-mapstore-client/legacy/map_view.html similarity index 100% rename from geonode_mapstore_client/templates/geonode-mapstore-client/map_view.html rename to geonode_mapstore_client/templates/geonode-mapstore-client/legacy/map_view.html diff --git a/geonode_mapstore_client/templates/geonode-mapstore-client/snippets/custom_theme.html b/geonode_mapstore_client/templates/geonode-mapstore-client/snippets/custom_theme.html new file mode 100644 index 0000000000..9c9559703c --- /dev/null +++ b/geonode_mapstore_client/templates/geonode-mapstore-client/snippets/custom_theme.html @@ -0,0 +1,207 @@ +{% block content %} + {% comment %} + + + {% endcomment %} +{% endblock %} diff --git a/geonode_mapstore_client/templates/index.html b/geonode_mapstore_client/templates/index.html index 13e795709d..c7af93818d 100644 --- a/geonode_mapstore_client/templates/index.html +++ b/geonode_mapstore_client/templates/index.html @@ -11,6 +11,11 @@ {{ SITE_NAME }} {% include './geonode-mapstore-client/snippets/loader_style.html' %} + + {% block custom_theme %} + {% include './geonode-mapstore-client/snippets/custom_theme.html' %} + {% endblock %} + {% block extra_style %} {% endblock %}