-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 to create custom pages and add them to the menu. #2898
base: master
Are you sure you want to change the base?
Conversation
Thanks for this great Open Source Project! Will be appreciated if you take a look to this PR because we need to add some legal stuff like the Privacy Notice in our public library and will be great if we can have it from mainstream (we want to avoid hacks to get it done) |
@OzzieIsaacs I notice you merged some stuff recently, could you take a look to this MR? |
cps/editpage.py
Outdated
page = ub.session.query(ub.Page).filter(ub.Page.id == file).first() | ||
if page: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could also do
page = ub.session.query(ub.Page).filter(ub.Page.id == file).first() | |
if page: | |
try: | |
page = ub.session.query(ub.Page).get_or_404(file) |
And then check my comment after line 51
https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.BaseQuery.get_or_404
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shows an error with get_or_404, added try.
From: https://github.com/janeczku/calibre-web/blob/master/CONTRIBUTING.md#contributing-code-to-calibre-web |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 !
@OzzieIsaacs could this be considered to be pulled in? This would be a really useful feature. |
@apollo1220 You could speed up the process by writing some tests (https://github.com/OzzieIsaacs/calibre-web-test). |
… feature/allow-create-pages
This PR creates a new link in the admin page to go to a list of pages or allows to creation of new pages.
It saves basic page information in the database and it creates a markdown file in a pages directory within the config folder.
It shows pages in the sidebar before the books list or after the About link.
Pages can be enabled or disabled to hide them.