GithubHelp home page GithubHelp logo

Comments (7)

findsah avatar findsah commented on July 24, 2024

Hi Petassis ,
its Ali from wildfish ,To customize styles globally, you can create a custom CSS file and include it after the default dashboard CSS files in your base template. For example:
html

{% block dashboards_style %}
{{ super() }}

{% endblock %} You can also override the default CSS templates ,Some examples are included that you can build on. If including the CSS in a template is interfering, you may need to isolate the dashboard rendering somehow, such as rendering it in an iframe or separate view. Let me know if any of those suggestions help or if you have any other questions! Customizing styles can take some trial and error but those methods should allow you to override the default dashboard styling.

from django-dashboards.

findsah avatar findsah commented on July 24, 2024

I checked your link and did inspect element on it , and it seems you are using an iframe . content.js:613 @import rules are not allowed here. See WICG/construct-stylesheets#119 (comment).

content.js:613 @import rules are not allowed here. See WICG/construct-stylesheets#119 (comment). Avoid using @import and instead directly include the CSS files using tags. This avoids the cross-origin issues that @import can cause in iframes.
Set the allow attribute on the iframe to "styles" to allow styling across origins:
html

<iframe allow="styles"></iframe> Use postMessage to communicate between the parent and iframe documents and programmatically add styles instead of @import. Consider rendering the dashboard content in a separate view rather than an iframe, if possible. This may avoid the cross-origin restrictions. As a workaround, you could load the CSS files asynchronously after the iframe loads to avoid the parsing issue: js

iframe.onload = () => {
// load CSS
}
Hope this helps provide some options to try! Let me know if any of those suggestions are unclear or if the issue persists.

from django-dashboards.

petasis avatar petasis commented on July 24, 2024

Dear Ali,

Thank you for the replies. Regarding iframe, I am not sure I use one.
Also, I am not sure where is the "dashboard editor", Editing Dashboard and then "Editing CSS".

from django-dashboards.

findsah avatar findsah commented on July 24, 2024

Dear Petatsis,
What I meant by by by my earlier message was overriding the css stylesheet as well as the js file for dashbaord . Your link is giving js import error mainly thats why it giving import error . you can override the js and css stylesheets to make it work. there might be an issue with rendering charts or plotly error

from django-dashboards.

petasis avatar petasis commented on July 24, 2024

Dear Ali,

I am not sure I see an error while loading the page. Only the matomo.js, which is don downloaded as it comes from another domain.

I am still missing a way to override the default CSS stylesheet. Putting it before the template's CSS, did not work, as dashboards' CSS changes font sizes, which the template CSS does not.

My current plan is to a) modify the dashboards CSS to include a prefix (namespace) for everything, and b) use a div to put dashboards content in it, which has the prefix as its class (thus I can limit the stylesheet only in the dashboards contents).

But I don't know how I can override the default css in the static folder.

from django-dashboards.

petasis avatar petasis commented on July 24, 2024

Modifying the css file to add a prefix, seems to be an adequate solution.

https://digitisation.vast-project.eu/dashboards/vast_dashboards/activitiesdashboard/

It event responds to the template theme changes (as I switch the classes light, dark in body).

The changes I have done to the css are here:

https://github.com/vast-project/activities-visualisation/blob/main/activities-backend/home/static/dashboards/css/dashboards.css

And the "customisations" are here:

https://github.com/vast-project/activities-visualisation/blob/main/activities-backend/home/static/dashboards/css/dashboards-admin_soft.css

I would propose to do the changes in css also in the dashboards package, to ease integration with existing applications.
Just wrap the content in a div, with the dashbaoards class.

from django-dashboards.

OmegaDroid avatar OmegaDroid commented on July 24, 2024

I think I agree on this, we should prefix all the classes in the css with something sensible.

We should also move any rules where we are setting styles on elements to a separate css file too so that it can be included in the default template but easily excluded in the case where you are including dashboards in an existing site.

from django-dashboards.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.