コード例 #1
0
def create_nav():
    nav.Bar('main', [
        nav.Item('Dashboard', 'backend.dashboard'),
        nav.Item('Inhalte',
                 'backend.dashboard',
                 items=[
                     nav.Item(
                         "Seiten",
                         'backend.pages',
                         items=[
                             nav.Item("Seiten Übersicht", 'backend.pages'),
                             nav.Item("Seite erstellen", 'backend.add_page')
                         ]),
                     nav.Item("News",
                              'backend.news',
                              items=[
                                  nav.Item("News Übersicht", 'backend.news'),
                                  nav.Item("News Meldung erstellen",
                                           'backend.add_news')
                              ])
                 ]),
    ])

    navbar_main = nav.bars.__getitem__('main')
    navbar_main_items = navbar_main.items

    # navigationpunkte für admins
    if current_user.is_admin:
        navbar_main_items.append(
            nav.Item('Backend Benutzer',
                     'backend.be_user',
                     html_attrs={'class': ['home']},
                     items=[
                         nav.Item('Übersicht', 'backend.be_user'),
                         nav.Item('Benutzer hinzufügen', 'backend.add_be_user')
                     ]))

    # navigationspunkte für admins und moderatoren
    if current_user.is_admin or current_user.is_moderator:
        navbar_main_items.append(
            nav.Item('System',
                     'backend.system',
                     items=[
                         nav.Item("Fehlgeschlagene Login Versuche",
                                  'backend.failed_login_records'),
                         nav.Item("System Mails", 'backend.system_mails'),
                         nav.Item("Einstellungen", 'backend.system_settings'),
                         nav.Item("Papierkorb", 'backend.trash')
                     ]))

    # navigationspunkt account
    navbar_main_items.append(
        nav.Item('Account',
                 '',
                 items=[
                     nav.Item("Account bearbeiten", 'backend.account_edit'),
                     nav.Item('Logout', 'backend.logout')
                 ]))
コード例 #2
0
from app.models import *
from app.tasks.forms import *
from app.tasks.methods import Trello

from flask import render_template, Blueprint, request, redirect, url_for, Response
from uuid import uuid4
from decouple import config
from app import nav
import ast

task = Blueprint('task', __name__, url_prefix='')

nav.Bar('top', [
    nav.Item('Home', 'task.home'),
    nav.Item('Projects', 'task.projects'),
    nav.Item('Actions', 'task.actions'),
    nav.Item('Groups', 'task.groups'),
    nav.Item('Users', 'task.users'),
])


@task.route('/', methods=['GET', 'POST'])
def home():

    user = User.query.all()
    users = len(user)

    data = Project.query.all()
    data = len(data)

    groups = Group.query.all()
コード例 #3
0
from flask_login import current_user, login_required

from app import app, db, nav
from app.models.Goods import Goods
from app.models.Purchase import Purchase
from app.models.PurchaseConsist import PurchaseConsist
from app.models.Users import Users
from app.models.UsersPurchase import UsersPurchase

nav.Bar('top', [
    nav.Item('Главная', 'index'),
    nav.Item(
        'Добавить транзакцию',
        'tr',
        items=[nav.Item('Вручную', 'purchase'),
               nav.Item('По чеку', 'image')]),
    nav.Item('История',
             'nested',
             items=[
                 nav.Item('По транзакциям', 'transactions'),
                 nav.Item('По категориям', 'categorise')
             ]),
])


@app.route('/', methods=['GET', 'POST'])
def index():
    locale.setlocale(locale.LC_ALL, 'ru_RU.UTF-8')
    if current_user.is_authenticated:
        user = Users.query.filter_by(id=current_user.id).first()
        purchases = []
        purchases = db.session.query(Purchase).join(UsersPurchase).filter(
コード例 #4
0
from flask import render_template
from app import nav
from app.home import bp

nav.Bar('top', [nav.Item('Home', 'home.index')])


@bp.route('/')
@bp.route('/index')
def index():
    return render_template('index.html', title='Home')
コード例 #5
0
ファイル: routes.py プロジェクト: tech4germany/steuerlotse
    def __init__(self, label, endpoint, matching_endpoint_prefixes):
        super(MultiEndpointItem, self).__init__(label, endpoint)
        self.matching_endpoint_prefixes = matching_endpoint_prefixes

    @property
    def is_current(self):
        return any([
            request.endpoint.startswith(pfx)
            for pfx in self.matching_endpoint_prefixes
        ])


nav.Bar('top', [
    nav.Item(_l('nav.home'), 'index'),
    nav.Item(_l('nav.how-it-works'), 'howitworks'),
    MultiEndpointItem(_l('nav.lotse-form'),
                      'login_welcome',
                      matching_endpoint_prefixes=['login_', 'lotse']),
    nav.Item(_l('nav.about-us'), 'contact'),
])

# Multistep flows


@app.route('/eligibility/step/<step>', methods=['GET', 'POST'])
def eligibility(step):
    flow = EligibilityMultiStepFlow(endpoint='eligibility')
    return flow.handle(step_name=step)


@app.route('/demo/step/<step>', methods=['GET', 'POST'])
def demo(step):
コード例 #6
0
from flask import render_template, url_for, redirect
from app import app, nav, db, EmailForm, EmailList

# Navigation bars
nav.Bar(
    'nav',
    [
        nav.Item('Home', 'home')
        # nav.Item('FAQ', 'faq'),
        # nav.Item('About', 'about')
    ])


@app.route('/', methods=['GET', 'POST'])
def home():
    form = EmailForm()

    if form.validate_on_submit():
        dat = {'email': form.email.data}
        email = EmailList.create(**dat)

        return redirect(url_for('access'))

    return render_template('home.html', form=form)


@app.route('/access')
def access():
    return render_template('access.html')

コード例 #7
0
ファイル: routes.py プロジェクト: johndoe-dev/Ecodroid
from flask import render_template
from app import nav
from app.main import bp

nav.Bar('top', [
    nav.Item('Dashboard', 'main.index'),
    nav.Item('Project', 'project.projects'),
    nav.Item('Device', 'device.devices'),
    nav.Item('Applications', 'apk.applications'),
    nav.Item('About', 'main.about')
])


@bp.route('/', methods=['GET', 'POST'])
@bp.route('/index', methods=['GET', 'POST'])
def index():
    return render_template('index.html', title='Home')


@bp.route('/about')
def about():
    return render_template('about.html', title='About')
コード例 #8
0
from datetime import datetime
from pathlib import Path
from csv import reader, writer
from zipfile import ZipFile
from pytz import utc, timezone
from os import remove
from io import StringIO

logging.basicConfig(filename=Path(app.config['ROOT_PATH'], 'info.log'),
                    level=logging.INFO,
                    format=f'{datetime.utcnow()}, %(levelname)s, %(message)s')

nav.Bar('top', [
    nav.Item('Dashboard', 'teachers'),
    nav.Item('Enter Student', 'manualentry'),
    nav.Item('Student Lookup', 'studentReport'),
    nav.Item('Teacher Settings', 'teacherSettings'),
    nav.Item('Admin Settings', 'adminSettings'),
    nav.Item('Logout', 'logout')
])


@app.context_processor
def customSettings():
    return getSettings()


@app.route('/')
def public():
    if len(Settings.query.all()) > 0:
        teachers = Subject.query.order_by(Subject.name).all()
        teacherList = []