def render_user_profile(user_id): with app.app_context(): user, error = user_service.get_by_id(user_id) if error: return error.description return render_template('user_page/user_profile.html', user=user)
def render_all_companies(): with app.app_context(): companies, error = company_service.get_all_companies() if error: return jsonify(error.jsonify()) return render_template('companies_page/companies.html', companies=companies)
def render_user_subscriptions(user_email): with app.app_context(): if user_email is None: return "" user, error = user_service.get_by_email(user_email) if error: return error.description if user is None: return "User %s does not exists" % (user_email) user_subscription, error = user_subscriptions_service.get_subscriptions_for_user( user.id) if error: return error.description user_subscription.companies = [] for company_id in user_subscription.company_ids: company, error = company_service.get_by_id(company_id) user_subscription.companies.append(company) return render_template( 'admin/user_management_page/user_subscriptions.html', user_subscription=user_subscription)
def render_company_edit_form(company_name): with app.app_context(): company, error = company_service.get_by_name(company_name) if error: return jsonify(error.jsonify()) return render_template('companies_page/company_edit_form.html', company=company)
def render_user_article_actions(user_email): with app.app_context(): if user_email is None: return "" user, error = user_service.get_by_email(user_email) if error: return error.description return render_template( 'admin/user_management_page/user_article_actions.html', user=user)
def render_user_subscription(user_id): with app.app_context(): user_subscription, error = user_subscriptions_service.get_subscriptions_for_user( user_id) if error: return error.description user_subscription.companies = [] for company_id in user_subscription.company_ids: company, error = company_service.get_by_id(company_id) user_subscription.companies.append(company) return render_template( 'user_subscriptions_page/user_subscriptions.html', user_subscription=user_subscription)
def render_user_profile_edit_form(user_email): with app.app_context(): if user_email is None: return "" user, error = user_service.get_by_email(user_email) if error: return error.description if user is None: return "User %s does not exists" % (user_email) return render_template( 'admin/user_management_page/user_profile_edit_form.html', user=user, roles=User.valid_roles)
def render_user_unsubscribed_companies(user_id): with app.app_context(): user_subscription, error = user_subscriptions_service.get_subscriptions_for_user( user_id) if error: return error.description companies, error = company_service.get_all_active_companies() if error: return error.description unsubscribed_companies = [ company for company in companies if company.id not in set(user_subscription.company_ids) ] return render_template( 'user_subscriptions_page/user_unsubscribed_companies.html', unsubscribed_companies=unsubscribed_companies)
def render_pre_body(): with app.app_context(): return render_template('common/pre_body.html')
def render_top_menu(is_authenticated): with app.app_context(): return render_template('menus/top_menu.html', is_authenticated=is_authenticated)
def render_main_content(): with app.app_context(): return render_template('index_page/main_content.html')
def render_layout(): with app.app_context(): return render_template('index_page/layout.html')
def render_article(article): with app.app_context(): return render_template('article_page/article.html', article=article)
def render_action_buttons(): with app.app_context(): return render_template('article_page/article_actions.html')
def render_layout(): with app.app_context(): return render_template('dashboard_page/layout.html')
def render_company_add_form(): with app.app_context(): return render_template('companies_page/company_add_form.html')
def render_user_search_bar(): with app.app_context(): return render_template('admin/user_management_page/user_search.html')
def render_companies_action_buttons(): with app.app_context(): return render_template('companies_page/companies_actions.html')
def render_layout(): with app.app_context(): return render_template('admin/user_management_page/layout.html')
def render_articles_home_layout(): with app.app_context(): return render_template('articles_page/home_layout.html')
def render_articles(user_id, bucket_name): articles, error = user_bucket_service.get_articles_from_bucket( user_id, bucket_name) with app.app_context(): return render_template('articles_page/articles.html', articles=articles)
def render_layout(): with app.app_context(): return render_template('user_subscriptions_page/layout.html')
def render_user_action_buttons(): with app.app_context(): return render_template('user_page/user_actions.html')
def render_layout_company_edit(): with app.app_context(): return render_template('companies_page/company_edit_form_layout.html')
def render_pending_articles(): with app.app_context(): return render_template('articles_page/articles.html')
def render_layout(): with app.app_context(): return render_template('companies_page/layout.html')