From d34626b6167ba2df865ba6d20c27fa4489310ef0 Mon Sep 17 00:00:00 2001 From: amandanoris Date: Tue, 13 Jun 2023 22:24:34 -0700 Subject: [PATCH] =?UTF-8?q?La=20opci=C3=B3n=20de=20crear=20(o=20editar)=20?= =?UTF-8?q?en=20la=20cada=20subruta=20=20de=20Publicaciones=20solo=20debe?= =?UTF-8?q?=20aparecer=20si=20el=20user=20=20tiene=20permiso=20de=20escrit?= =?UTF-8?q?ura?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../publications_pages/books_and_chapters.py | 2 +- .../pages/publications_pages/journals.py | 70 +++++++++---------- .../pages/publications_pages/presentations.py | 2 +- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/dashboard/pages/publications_pages/books_and_chapters.py b/dashboard/pages/publications_pages/books_and_chapters.py index 25b5eb6..e887af3 100644 --- a/dashboard/pages/publications_pages/books_and_chapters.py +++ b/dashboard/pages/publications_pages/books_and_chapters.py @@ -20,7 +20,7 @@ def books_and_chapters_page(router, **params): chapters = [c for c in BookChapter.all() if c.year == year] chapters.sort(key=lambda b: b.chapter) - if auth.is_user_logged(): + if auth.is_user_logged() and router.user_can_write: with st.expander("⭐ Nuevo libro / 📝 Editar"): if ( st.radio( diff --git a/dashboard/pages/publications_pages/journals.py b/dashboard/pages/publications_pages/journals.py index fddc94f..1629816 100644 --- a/dashboard/pages/publications_pages/journals.py +++ b/dashboard/pages/publications_pages/journals.py @@ -28,44 +28,44 @@ def journals_page(router: PageRouter, **params): presentations.sort(key=lambda p: p.title) st.write(f"#### 🗞️ Revistas `{len(journals)}`") + if router.user_can_write: + with st.expander("Editar revista"): + journal = st.selectbox("Revista", journals) - with st.expander("Editar revista"): - journal = st.selectbox("Revista", journals) - - journal.title = st.text_input( - "Título", key=f"journal_title_{journal.uuid}", value=journal.title - ) - journal.publisher = st.text_input( - "Editorial", - key=f"journal_publisher_{journal.uuid}", - value=journal.publisher, - ) - journal.issn = st.text_input( - "ISSN", key=f"journal_issn_{journal.uuid}", value=journal.issn - ) - journal.url = ( - st.text_input( - "URL", key=f"journal_url_{journal.uuid}", value=journal.url or "" + journal.title = st.text_input( + "Título", key=f"journal_title_{journal.uuid}", value=journal.title + ) + journal.publisher = st.text_input( + "Editorial", + key=f"journal_publisher_{journal.uuid}", + value=journal.publisher, + ) + journal.issn = st.text_input( + "ISSN", key=f"journal_issn_{journal.uuid}", value=journal.issn + ) + journal.url = ( + st.text_input( + "URL", key=f"journal_url_{journal.uuid}", value=journal.url or "" + ) + or None + ) + journal.indices = st.multiselect( + "Indexado en", + key=f"journal_indices_{journal.uuid}", + options=[ + "Web of Science", + "Scopus", + "RICYT", + "Scielo", + "Otro (Internacional)", + "Otro (Nacional)", + ], + default=journal.indices, ) - or None - ) - journal.indices = st.multiselect( - "Indexado en", - key=f"journal_indices_{journal.uuid}", - options=[ - "Web of Science", - "Scopus", - "RICYT", - "Scielo", - "Otro (Internacional)", - "Otro (Nacional)", - ], - default=journal.indices, - ) - if st.button("💾 Guardar"): - journal.save() - st.success("Cambios guardados") + if st.button("💾 Guardar"): + journal.save() + st.success("Cambios guardados") for journal in journals: st.write(journal.format()) diff --git a/dashboard/pages/publications_pages/presentations.py b/dashboard/pages/publications_pages/presentations.py index ed7dfbd..5768083 100644 --- a/dashboard/pages/publications_pages/presentations.py +++ b/dashboard/pages/publications_pages/presentations.py @@ -15,7 +15,7 @@ def presentations_page(router, **params): presentations = [p for p in ConferencePresentation.all() if p.year == year] presentations.sort(key=lambda p: p.title) - if auth.is_user_logged(): + if auth.is_user_logged() and router.user_can_write: with st.expander("⭐ Nueva presentación / 📝 Editar"): if ( st.radio(