-
Notifications
You must be signed in to change notification settings - Fork 9
Feat: Cria campos no formulário de Pages para referênciar páginas e navegação entre páginas Pais e Filhas #353
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
base: master
Are you sure you want to change the base?
Changes from all commits
9c7473d
7bbf9a7
e6be3f9
4b55b32
7918081
87d0211
069dda1
1649a10
b51c487
33542a5
dea12f7
5c5343a
f5336a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ | |
| from webapp import babel, cache, controllers, forms | ||
| from webapp.choices import STUDY_AREAS | ||
| from webapp.controllers import create_press_release_record | ||
| from webapp.config.lang_names import display_original_lang_name | ||
| from webapp.config.lang_names import display_lang_name_fallback | ||
| from webapp.utils import utils | ||
| from webapp.utils.caching import cache_key_with_lang, cache_key_with_lang_with_qs | ||
| from webapp.main.errors import page_not_found, internal_server_error | ||
|
|
@@ -323,28 +323,44 @@ def collection_list_feed(): | |
| return feed.get_response() | ||
|
|
||
|
|
||
|
|
||
| @main.route("/about/<path:slug_name>", methods=["GET"]) | ||
| def page_about_detail(slug_name): | ||
| language = session.get("lang", get_locale()) | ||
| page = controllers.get_page_by_slug_name(slug_name, lang=language, is_draft=False) | ||
|
|
||
| if not page: | ||
| abort(404, _("Página não encontrada")) | ||
| breadcrumbs = utils.build_breadcrumbs(page) | ||
| context = { | ||
| "breadcrumbs": breadcrumbs, | ||
| "page": page, | ||
| } | ||
| return render_template("collection/about_detail.html", **context) | ||
|
Comment on lines
+327
to
+339
|
||
|
|
||
|
|
||
| @main.route("/about/", methods=["GET"]) | ||
| @main.route("/about/<string:slug_name>", methods=["GET"]) | ||
| @cache.cached(key_prefix=cache_key_with_lang_with_qs) | ||
| def about_collection(slug_name=None): | ||
| def about_collection(): | ||
|
Comment on lines
342
to
+344
|
||
| language = session.get("lang", get_locale()) | ||
|
|
||
| context = {} | ||
| page = None | ||
| if slug_name: | ||
| # caso seja uma página | ||
| page = controllers.get_page_by_slug_name(slug_name, language) | ||
| if not page: | ||
| abort(404, _("Página não encontrada")) | ||
| context["page"] = page | ||
| else: | ||
| # caso não seja uma página é uma lista | ||
| pages = controllers.get_pages_by_lang(language) | ||
| context["pages"] = pages | ||
| pages = controllers.get_page_about_root(language) | ||
|
|
||
| context["pages"] = pages.order_by("order") | ||
| return render_template("collection/about.html", **context) | ||
|
Comment on lines
342
to
351
|
||
|
|
||
|
|
||
| @main.route("/free/<string:slug_name>", methods=["GET"]) | ||
| def free_page(slug_name): | ||
| language = session.get("lang", get_locale()) | ||
| page = controllers.get_free_page_by_slug(slug_name, lang=language, is_draft=False) | ||
|
|
||
|
Comment on lines
+354
to
+358
|
||
| if not page: | ||
| abort(404, _("Página não encontrada")) | ||
|
|
||
| return render_template("collection/about_detail.html", page=page) | ||
|
|
||
| # ###################################Journal##################################### | ||
|
|
||
|
|
||
|
|
@@ -1281,12 +1297,13 @@ def _handle_html(): | |
| logger.exception(exc) | ||
|
|
||
| abort(500, _("Erro inesperado")) | ||
| language = session.get("lang", get_locale()) | ||
|
|
||
| text_versions = sorted( | ||
| [ | ||
| ( | ||
| lang, | ||
| display_original_lang_name(lang), | ||
| display_lang_name_fallback(locale=language, code=lang), | ||
| url_for( | ||
| "main.article_detail_v3", | ||
| url_seg=article.journal.url_segment, | ||
|
|
||
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.
children = page.get_children()é colocado no contexto, mas não é usado no templatecollection/about_detail.html. Isso pode gerar trabalho/query desnecessário. Removachildrendo view ou passe a usar esse valor no template em vez de chamar métodos do modelo repetidamente.