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

Allow project administrators to conditionally show sidebar items #109

Open
1 task done
leolami opened this issue Oct 30, 2024 · 5 comments
Open
1 task done

Allow project administrators to conditionally show sidebar items #109

leolami opened this issue Oct 30, 2024 · 5 comments
Assignees
Labels
feature New feature or request

Comments

@leolami
Copy link
Member

leolami commented Oct 30, 2024

Checklist

  • I've searched through the current issues to make sure this feature hasn't been requested already.

Motivation

When publishing a project, a form option should make it optional to display the session Metadata in the client

Suggested solution

A simple check option in the form

Alternatives considered

No response

@leolami leolami added the feature New feature or request label Oct 30, 2024
@wlorenzetti wlorenzetti changed the title Optional metadata session Left-bar sections visibility management Oct 30, 2024
@wlorenzetti
Copy link
Member

@Raruto @volterra79 I suggest to implement it with more options, i.e.:

  • Left-bar open on close at client runtime
  • Set visibility of other sections: searches, bookmarks, print

How do you prefer this options inside the config ?

@volterra79
Copy link
Member

@wlorenzetti i think that a configuration can be a project level:

sidebar: { print: { show: true}, metadata: {show: false}, ... }

@Raruto what dou you thin about?

@Raruto
Copy link
Collaborator

Raruto commented Oct 30, 2024

@wlorenzetti

Set visibility of other sections: searches, bookmarks, print

Generate some custom css (server side) and then include it on the page, eg:

.sidebar-menu > li:is(#metadata, #spatialbookmarks, #print) { display: none; }

image

Left-bar open on close at client runtime

Maybe you missed: g3w-suite/g3w-admin#944 (comment)

Ref: https://github.com/g3w-suite/g3w-client/blob/8c3e7a36eeb82af699b5889e87f10c1abec0ef01/src/index.html#L18

@wlorenzetti
Copy link
Member

Yeas I can use a custom.css o custom.js, but we want add this as options available in the QGIS project uploading form:

Screenshot_20241030_121958

@Raruto
Copy link
Collaborator

Raruto commented Oct 30, 2024

Yeas I can use a custom.css o custom.js, but we want add this as options available in the QGIS project uploading form:

Yes, as I was saying, you just need to inject some css rules (on the fly) into client template:

# somwhere within your djang app 

elements_to_hide = ['#metadata', '#spatialbookmarks', '#print'] # here your django options.. 😃
SETTINGS.CLIENT_CUSTOM_CSS = f".sidebar-menu > li:is({', '.join(elements_to_hide)})"
# https://github.com/g3w-suite/g3w-client/blob/0322c7bf066eecd92617b7f4c4d7f06c2448ba77/src/index.html

{% if SETTINGS.CLIENT_CUSTOM_CSS %}
  <style>{{ SETTINGS.CLIENT_CUSTOM_CSS | safe }}</style>
{% endif %}

Then, if you're feeling fancy, you could even add two text areas to each project, so anyone can customize any project as they wish..

image

and then append it to any previous (server side generated) custom css:

SETTINGS.CLIENT_CUSTOM_CSS += TEXT_AREA_CUSTOM_CSS

@Raruto Raruto changed the title Left-bar sections visibility management Allow user to conditionally show sidebar items Oct 30, 2024
@Raruto Raruto changed the title Allow user to conditionally show sidebar items Allow project administrator to conditionally show sidebar items Oct 30, 2024
@Raruto Raruto changed the title Allow project administrator to conditionally show sidebar items Allow project administrators to conditionally show sidebar items Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants