Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.

Conversation

@ar4s
Copy link
Contributor

@ar4s ar4s commented Oct 2, 2024

@nfoert I know that PR is quite large but if have any question feel free to ask.

  • introduce base.html to inherit common parts across templates
  • add template context processor for server configuration

Resolves #20

@ar4s ar4s changed the title [WIP] fix: refactor and fix favicon.js fix: refactor and fix favicon.js Oct 2, 2024
nfoert added 2 commits October 3, 2024 15:07
The collapse plugin must be imported first so I've adjusted base.html to fix this
@nfoert
Copy link
Owner

nfoert commented Oct 3, 2024

Hi @ar4s! Thanks for working on this. I was looking through the code and attempting to understand the changes, I have a few questions.

  • How do the context processors work? Is this just inserting the same context values into every rendered page?
  • What are these lines doing? I don't see them called anywhere on any templates. I believe this is causing an error on the page: Uncaught TypeError: window.__CONFIG__ is undefined. Additionally, why is it better to access this file via a view instead of the {% static %} tag?

I've also not used the django templating much, and think that that your method of using different blocks and base.html is a good idea, thanks for implementing that.

I made a few formatting changes (I'm a stubborn 4 tabs for indents user lol) and the alpine.js collapse plugin needs to be imported second, so I rearranged a few things in base.html and editor.html to fix this.

@nfoert nfoert added the hacktoberfest A good issue for hacktoberfest 2024 label Oct 3, 2024
@ar4s
Copy link
Contributor Author

ar4s commented Oct 3, 2024

How do the context processors work? Is this just inserting the same context values into every rendered page?

Yes, exactly so you don't need repeat same chunks of code over and over again in views.

What are these lines doing? I don't see them called anywhere on any templates.

It is exposed in urls.py

I believe this is causing an error on the page: Uncaught TypeError: window.CONFIG is undefined.

My bad - I fixed that in c12f4a0

why is it better to access this file via a view instead of the {% static %} tag?

In this case I want to generate JS file on the fly to provide some dynamic information to present how you can pass information from backend to frontend. You can use also JSON or JSONP but i think for that scale it is enough and straightforward.
Keep in mind that you can also cache this view on different levels (app, www server, client cache).

I made a few formatting changes (I'm a stubborn 4 tabs for indents user lol) and the alpine.js collapse plugin needs to be imported second, so I rearranged a few things in base.html and editor.html to fix this.

I appreciate that because I am new in the project and I don't know how to test properly whole application.

It should be the light icon in dark mode and vice versa
@nfoert
Copy link
Owner

nfoert commented Oct 3, 2024

Yes, exactly so you don't need repeat same chunks of code over and over again in views.

Got it, thank you for answering my questions

In this case I want to generate JS file on the fly to provide some dynamic information to present how you can pass information from backend to frontend

That makes sense, it's a good new method I've not used before, I'll have to keep that in mind for future

I appreciate that because I am new in the project and I don't know how to test properly whole application.

I have instructions in the README for installing it locally for development, did those steps not work for you?

In any case this issue has now been completed, I'll get it all merged, thank you!

@nfoert nfoert merged commit 667965f into nfoert:development Oct 3, 2024
@ar4s
Copy link
Contributor Author

ar4s commented Oct 4, 2024

I have instructions in the README for installing it locally for development, did those steps not work for you?

Installation is straigtforward because it is a simple Django project :)
By I don't know how to test properly whole application I meant I don't know full list of use cases and features in terms of bussiness.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

hacktoberfest A good issue for hacktoberfest 2024

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants