def index(): language = session.get('lang', get_locale()) news = controllers.get_latest_news_by_lang(language) tweets = controllers.get_collection_tweets() press_releases = controllers.get_press_releases({'language': language}) urls = { 'downloads': '{0}/w/accesses?collection={1}'.format( current_app.config['METRICS_URL'], current_app.config['OPAC_COLLECTION']), 'references': '{0}/w/publication/size?collection={1}'.format( current_app.config['METRICS_URL'], current_app.config['OPAC_COLLECTION']), 'other': '{0}/?collection={1}'.format( current_app.config['METRICS_URL'], current_app.config['OPAC_COLLECTION']) } context = { 'news': news, 'urls': urls, 'tweets': tweets, 'press_releases': press_releases, 'journals': controllers.get_journals(query_filter="current", order_by="-last_issue.year") } return render_template("collection/index.html", **context)
def index(): default_lang = current_app.config.get('BABEL_DEFAULT_LOCALE') language = session.get('lang', default_lang) news = controllers.get_latest_news_by_lang(language) tweets = controllers.get_collection_tweets() press_releases = controllers.get_press_releases({'language': language}) urls = { 'downloads': '{0}/w/accesses?collection={1}'.format( current_app.config['OPAC_METRICS_URL'], current_app.config['OPAC_COLLECTION']), 'references': '{0}/w/publication/size?collection={1}'.format( current_app.config['OPAC_METRICS_URL'], current_app.config['OPAC_COLLECTION']), 'other': '{0}/?collection={1}'.format( current_app.config['OPAC_METRICS_URL'], current_app.config['OPAC_COLLECTION']) } context = { 'news': news, 'urls': urls, 'tweets': tweets, 'press_releases': press_releases, 'journals': controllers.get_journals() } return render_template("collection/index.html", **context)
def index(): default_lang = current_app.config.get("BABEL_DEFAULT_LOCALE") language = session.get("lang", default_lang) news = controllers.get_latest_news_by_lang(language) analytics = controllers.get_collection_analytics() tweets = controllers.get_collection_tweets() press_releases = controllers.get_press_releases({"language": language}) context = {"news": news, "analytics": analytics, "tweets": tweets, "press_releases": press_releases} return render_template("collection/index.html", **context)
def journal_detail(url_seg): journal = controllers.get_journal_by_url_seg(url_seg) if not journal: abort(404, _('Periódico não encontrado')) if not journal.is_public: abort(404, JOURNAL_UNPUBLISH + _(journal.unpublish_reason)) # todo: ajustar para que seja só noticias relacionadas ao periódico default_lang = current_app.config.get('BABEL_DEFAULT_LOCALE') language = session.get('lang', default_lang) news = controllers.get_latest_news_by_lang(language) # A ordenação padrão da função ``get_issues_by_jid``: "-year", "-volume", "order" issues = controllers.get_issues_by_jid(journal.id, is_public=True) # A lista de fascículos deve ter mais do que 1 item para que possamos tem # anterior e próximo if len(issues) >= 2: previous_issue = issues[1] else: previous_issue = None # Press releases press_releases = controllers.get_press_releases({'journal': journal, 'language': language}) # Lista de seções # Mantendo sempre o idioma inglês para as seções na página incial do periódico if journal.last_issue: sections = [section for section in journal.last_issue.sections if section.language == 'en'] else: sections = [] context = { 'next_issue': None, 'previous_issue': previous_issue, 'journal': journal, 'press_releases': press_releases, # o primiero item da lista é o último fascículo. # condicional para verificar se issues contém itens 'last_issue': issues[0] if issues else None, 'sections': sections if sections else None, 'news': news } return render_template("journal/detail.html", **context)
def journal_detail(url_seg): journal = controllers.get_journal_by_url_seg(url_seg) if not journal: abort(404, _("Periódico não encontrado")) if not journal.is_public: abort(404, JOURNAL_UNPUBLISH + _(journal.unpublish_reason)) # todo: ajustar para que seja só noticias relacionadas ao periódico default_lang = current_app.config.get("BABEL_DEFAULT_LOCALE") language = session.get("lang", default_lang) news = controllers.get_latest_news_by_lang(language) # A ordenação padrão da função ``get_issues_by_jid``: "-year", "-volume", "order" issues = controllers.get_issues_by_jid(journal.id, is_public=True) # A lista de fascículos deve ter mais do que 1 item para que possamos tem # anterior e próximo if len(issues) >= 2: previous_issue = issues[1] else: previous_issue = None # Get press releases press_releases = controllers.get_press_releases({"journal": journal, "language": language}) context = { "next_issue": None, "previous_issue": previous_issue, "journal": journal, "press_releases": press_releases, # o primiero item da lista é o último fascículo. # condicional para verificar se issues contém itens "last_issue": issues[0] if issues else None, "news": news, } return render_template("journal/detail.html", **context)
def journal_detail(url_seg): journal = controllers.get_journal_by_url_seg(url_seg) if not journal: abort(404, _('Periódico não encontrado')) if not journal.is_public: abort(404, JOURNAL_UNPUBLISH + _(journal.unpublish_reason)) # todo: ajustar para que seja só noticias relacionadas ao periódico language = session.get('lang', get_locale()) news = controllers.get_latest_news_by_lang(language) # A ordenação padrão da função ``get_issues_by_jid``: "-year", "-volume", "order" issues = controllers.get_issues_by_jid(journal.id, is_public=True) # A lista de números deve ter mais do que 1 item para que possamos tem # anterior e próximo if len(issues) >= 2: previous_issue = issues[1] else: previous_issue = None # Press releases press_releases = controllers.get_press_releases({ 'journal': journal, 'language': language }) # Lista de seções # Mantendo sempre o idioma inglês para as seções na página incial do periódico if journal.last_issue and journal.current_status == "current": sections = [ section for section in journal.last_issue.sections if section.language == 'en' ] recent_articles = controllers.get_recent_articles_of_issue( journal.last_issue.iid, is_public=True) else: sections = [] recent_articles = [] if len(issues) > 0: latest_issue = issues[0] latest_issue_legend = descriptive_short_format( title=latest_issue.journal.title, short_title=latest_issue.journal.short_title, pubdate=str(latest_issue.year), volume=latest_issue.volume, number=latest_issue.number, suppl=latest_issue.suppl_text, language=language[:2].lower()) else: latest_issue = None latest_issue_legend = '' context = { 'next_issue': None, 'previous_issue': previous_issue, 'journal': journal, 'press_releases': press_releases, 'recent_articles': recent_articles, 'journal_study_areas': [ STUDY_AREAS.get(study_area.upper()) for study_area in journal.study_areas ], # o primiero item da lista é o último número. # condicional para verificar se issues contém itens 'last_issue': latest_issue, 'latest_issue_legend': latest_issue_legend, 'sections': sections if sections else None, 'news': news } return render_template("journal/detail.html", **context)