コード例 #1
0
def process_navbar():
    # get images here
    lockimage = img(src='static/img/lock.png', height='20', width='20')
    unlockimage = img(src='static/img/unlock.png', height='20', width='20')
    separator = img(src='static/img/separate.png', height='25', width='10')

    # Find all the samples in the data directory
    dir_list = []
    if current_user.is_authenticated:
        current_app.config['DATA_DIR'] = current_app.config['ALL_DATA_DIR']
    else:
        current_app.config['DATA_DIR'] = current_app.config[
            'PUBLISHED_DATA_DIR']
    dir_list = next(walk(current_app.config['DATA_DIR'] + "/ensembles"))[1]
    published_dir_list = next(
        walk(current_app.config['PUBLISHED_DATA_DIR'] + "/ensembles"))[1]

    dir_list_links = []

    first = True

    for x in dir_list:
        if not first:
            dir_list_links.append(Text(separator))
        dir_list_links.append(Link(x, "/" + x))
        if current_user.is_authenticated:
            # x is public: add unlockimage
            if x in published_dir_list:
                dir_list_links.append(Text(unlockimage))
            # x is private: add lockimage
            else:
                dir_list_links.append(Text(lockimage))
        first = False

    nav.register_element('frontend_top', Navbar('', *dir_list_links))
コード例 #2
0
ファイル: navigation.py プロジェクト: stweil/nashi
def mynavbar():
    if current_user.is_anonymous:
        usergroup = Subgroup(
                    "User",
                    Text("Not logged in"),
                    View('Forgot password', 'security.forgot_password'),
                )
    else:
        usergroup = Subgroup(
                    "User",
                    Text(current_user.email),
                    View('Change password', 'security.change_password'),
                    Separator,
                    View('Logout', 'security.logout')
                )

    return Navbar(
        View('nashi', 'index'),
        Subgroup(
            'Links',
            Link('Philosophie Uni Würzburg', 'https://www.philosophie.' +
                 'uni-wuerzburg.de/forschung/forschungsstellephilosophie-un/'),
            Link('AL-Corpus', 'http://arabic-latin-corpus.philosophie.' +
                 'uni-wuerzburg.de/'),
            Link('nashi on Github', 'https://github.com/andbue/nashi'),
        ),
        usergroup
    )
コード例 #3
0
def frontend_top_nav():
    navbar = ExtendedNavbar(
        LocalizedView(babel_config('SITE_TITLE'), 'frontend.index'),
        root_class='navbar navbar-inverse navbar-fixed-top',
        items=(
            LocalizedView(_('Home'), 'frontend.index'),
            LocalizedView(_('Members'), 'frontend.members'),
        ))
    if current_user.is_active:
        navbar.right_items = (
            Text('{}:'.format(current_user.email)),
            LocalizedView(_('Logout'), 'security.logout'),
            LocalizedView(_('Change password'), 'security.change_password'),
        )
        if current_user.has_role('editor'):
            navbar.right_items += \
                (LocalizedView(_('Site editor'), 'backend.index'),)
        if current_user.has_role('admin'):
            navbar.right_items += \
                (LocalizedView(_('User admin'), 'useradmin.index'),)
    else:
        navbar.right_items = (View(_('Login'), 'security.login'), )

    if get_language_code() == 'en':
        navbar.right_items += (LocalizedView(u'עברית', 'frontend.index',
                                             'he'), )
    else:
        navbar.right_items += (LocalizedView('English', 'frontend.index',
                                             'en'), )
    return navbar
コード例 #4
0
def navbar():
    return Navbar(
        'Ryan Ground Hotel',
        View('Home', 'home'),
        View('Register', 'register'),
        View('Log in', 'login'),
        View('Log out', 'logout'),
        View('Profile', 'profile'),
        View('Check in', 'checkin'),
        View('Check out', 'checkout'),
        Subgroup(
            'Staff',
            View('Add Staff', 'add_staff'),
            View('Remove Staff', 'remove_staff'),
        ),
        Subgroup(
            'Bookings',
            View('View Bookings', 'booking'),
            View('Make a Booking', 'make_book_form'),
            View('Cancel', 'cancel_booking_form'),
            View('Price', 'change_price_form'),
        ),
        Subgroup(
            'Test',
            View('admin role', 'special_admin'),
            View('guest role', 'special_guest'),
            Separator(),
            Text('Testing'),
            View('Login required', 'special'),
        ),
    )
コード例 #5
0
def navbar():
    fb_btn = Text('Logged in to Facebook')
    sp_btn = Text('Logged in to Spotify')
    signout = Text('')
    if not fb_logged_in():
        fb_btn = View('Log In To Facebook', 'facebook.facebook_login')
    else:
        fb_btn = Text('fb: ' + fb_data('')['name'])

    if not sp_logged_in():
        sp_btn = View('Log In To Spotify', 'spotify.spotify_login')
    else:
        sp_btn = Text('sp: ' + sp_data('')['email'])

    if fb_logged_in() or sp_logged_in():
        signout = View('Logout', '.logout')

    return Navbar('Spotiflyt',
                  View('Home', '.index'),
                  fb_btn, sp_btn, signout)
コード例 #6
0
ファイル: nav.py プロジェクト: shresthaprasun/storyTracker
def homenavbar():
    return Navbar(
        'Story Tracker',
        View('Flask-Bootstrap', 'storys.index'),
        View('Home', 'storys.index'),
        View('Register', 'users.register'),
        View('Login', 'users.login'),
        # View('Forms Example', '.example_form'),
        # View('Debug-Info', 'debug.debug_root'),
        Subgroup(
            'Docs',
            Link('Flask-Bootstrap', 'http://pythonhosted.org/Flask-Bootstrap'),
            Link('Flask-AppConfig', 'https://github.com/mbr/flask-appconfig'),
            Link('Flask-Debug', 'https://github.com/mbr/flask-debug'),
            Separator(),
            Text('Bootstrap'),
            Link('Getting started', 'http://getbootstrap.com/getting-started/'),
            Link('CSS', 'http://getbootstrap.com/css/'),
            Link('Components', 'http://getbootstrap.com/components/'),
            Link('Javascript', 'http://getbootstrap.com/javascript/'),
            Link('Customize', 'http://getbootstrap.com/customize/'), ),
        Text('Using Flask-Bootstrap {}'.format(FLASK_BOOTSTRAP_VERSION)),
    )
コード例 #7
0
def frontend_top():
    # Sample navbar with left and right align
    # TODO: Adapt to dnd map and incorporate dynamic logged in/out nav items
    return ExtendedNavbar(
        title=View('Flask-Bootstrap', 'frontend.index'),
        root_class='navbar navbar-inverse',
        items=(
            View('Home', 'frontend.index'),
            View('Debug-Info', 'frontend.index'),
            Subgroup(
                'Docs',
                Link(
                    'Flask-Bootstrap',
                    'http://pythonhosted.org/Flask-Bootstrap',
                ),
                Link(
                    'Flask-AppConfig', 'https://github.com/mbr/flask-appconfig'
                ),
                Link('Flask-Debug', 'https://github.com/mbr/flask-debug'),
                Separator(),
                Text('Bootstrap'),
                Link(
                    'Getting started',
                    'http://getbootstrap.com/getting-started/',
                ),
                Link('CSS', 'http://getbootstrap.com/css/'),
                Link('Components', 'http://getbootstrap.com/components/'),
                Link('Javascript', 'http://getbootstrap.com/javascript/'),
                Link('Customize', 'http://getbootstrap.com/customize/'),
            ),
        ),
        right_items=(
            Text('Using Flask-Bootstrap {}'.format(FLASK_BOOTSTRAP_VERSION)),
            View('SignUp', 'frontend.index'),
        ),
    )
コード例 #8
0
ファイル: nav.py プロジェクト: RaenonX/PokemonQuestData
def append_dynamic(navitems):
    to_append = []

    if identity_entry_uid_key in session:
        to_append.append(
            Subgroup(
                "我的資料",
                View("我的開鍋紀錄",
                     "frontend.recent_new_data_by_user",
                     uid=session[identity_entry_uid_key]), Separator(),
                Text("精靈管理"), View("我的精靈一覽",
                                   "frontend_user.view_owned_pokemon"),
                View("新增我的精靈", "frontend_user.submit_owned_pokemon")))
    else:
        to_append.append(
            View("登記身分",
                 "frontend_user.user_verify",
                 prev=url_for("frontend.index")))

    return navitems + to_append
コード例 #9
0
def top_nav():
    return Navbar(
        View('Flask-Bootstrap', '.index'),
        View('Home', '.index'),
        View('Logout', '.logout') if session.get('logged_in') else View(
            'Login', '.form_login'),
        View('Artikel', '.artikel'),
        Subgroup(
            'Docs',
            Link('Flask-Bootstrap', 'http://pythonhosted.org/Flask-Bootstrap'),
            Link('Flask-AppConfig', 'https://github.com/mbr/flask-appconfig'),
            Link('Flask-Debug', 'https://github.com/mbr/flask-debug'),
            Separator(),
            Text('Bootstrap'),
            Link('Getting started',
                 'http://getbootstrap.com/getting-started/'),
            Link('CSS', 'http://getbootstrap.com/css/'),
            Link('Components', 'http://getbootstrap.com/components/'),
            Link('Javascript', 'http://getbootstrap.com/javascript/'),
            Link('Customize', 'http://getbootstrap.com/customize/'),
        ),
        # Text('Using Flask-Bootstrap {}'.format(FLASK_BOOTSTRAP_VERSION)),
    )
コード例 #10
0
ファイル: frontend.py プロジェクト: jamilg/DLSchool_Project
import os

UPLOAD_FOLDER = 'app/static/uploads'

frontend = Blueprint('frontend', __name__)

nav.register_element(
    'frontend_top',
    Navbar(
        View('Object detecttion Demo', '.index'),
        View('Домой', '.index'),
        View('Загрузить изображение', '.upload_file'),
        View('Посмотреть загруженные', '.gallery'),
        View('О проекте', '.about'),
        Text(
            'Используется Flask-Bootstrap {}'.format(FLASK_BOOTSTRAP_VERSION)),
    ))


@frontend.route('/')
def index():
    return render_template('index.html')


@frontend.route('/about')
def about():
    return render_template('about.html')


@frontend.route('/upload', methods=['GET', 'POST'])
def upload_file():
コード例 #11
0
from machine.Demographic import Demographic

frontend_app = Blueprint('frontend', __name__)

nav_app.register_element(
    'frontend_top',
    Navbar(
        View('Home', '.index'),
        Subgroup(
            'Demographics',
            Link('Most Popular', './'),
            Link('Best Score', './most-scored'),
            Link('Most vote count', './most-vote-count'),
            Link('Most vote average', './most-vote-average'),
        ),
        Text('MachineLearning'.format(FLASK_BOOTSTRAP_VERSION)),
    ))


# Our index-page just shows a quick explanation. Check out the template
# "templates/index.html" documentation for more details.
@frontend_app.route('/')
def index():

    dem = Demographic()
    dem.preprocess(creditsStr='/Dataset/tmdb_5000_credits.csv',
                   moviesStr='/Dataset/tmdb_5000_movies.csv')

    return render_template('index.html',
                           data=dem.getMostPopular().to_html(bold_rows=False),
                           title="Demographics / Most Popular")
コード例 #12
0
ファイル: app.py プロジェクト: jefmud/flask_nav_example1
from flask import Flask, render_template
from flask_nav import Nav
from flask_nav.elements import Navbar, Subgroup, View, Link, Text, Separator

app = Flask(__name__)
nav = Nav(app)

nav.register_element('my_navbar',
                        Navbar('thenav',
                        View('Home Page', 'index'),
                        View('Item One', 'item', item=1),
                        View('Item Two', 'item', item=2),
                        Link('Google', 'https://google.com'),
                        Separator(),
                        Text('Some Text'),
                        Subgroup('Extras',Link('yahoo','https://www.yahoo.com'),
                        View('Item 42', 'item', item=42))
                        ))
@app.route('/')
def index():
    return render_template('index.html')

@app.route('/items/<item>')
def item(item):
    return render_template('items.html', item=item)
    #return '<h1>Item Page</h1>\n<p>The item is: {}</p>\n'.format(item)

if __name__ == '__main__':
    app.run(debug=True)
コード例 #13
0
def moodnavbar():
    sg1 = Subgroup("Moods", View("Mood", "mood"), View(
        "Mood List", "moodlist"), Separator(), View("Statistics", "personalstats"))
    sg2 = Subgroup("Teams", View("Team", "team"),
                   View("Team List", "teamlist"))
    sg3 = Subgroup("Auth", View("Login", "security.login"), View("Profile", "profile"), View("Logout", "security.logout"), View("Change password", "security.change_password"),
                   Separator(), View("Register", "security.register"))
    if (current_user.is_authenticated):
        msg = "Welcome "
        if current_user.name:
            msg = msg + current_user.name
        else:
            msg = msg + current_user.email
    else:
        msg = "Please login or register"
    return (Navbar('Mood', View('Home', 'index'), sg1, sg2, sg3, View("Admin", "admin.index"), Text(msg)))
コード例 #14
0
# We're adding a navbar as well through flask-navbar. In our example, the
# navbar has an usual amount of Link-Elements, more commonly you will have a
# lot more View instances.
nav.register_element(
    'frontend_top',
    Navbar(
        #   branding2,
        View(img(src='/static/img/logo_nav.png'), '.index'),
        View('Home', '.index'),
        View('Channel Tester', '.Channel_Tester'),
        #    View('Debug-Info', 'debug.debug_root'),
        View('Results', '.Res_Table'),
        Subgroup(
            'Test Campaign',
            Text('Performances Test'),
            View('Channel Tester', '.Channel_Tester'),
            View('Perf Test', '.Perf_test'),
            Separator(),
            Text('Functionnal Test -- (Todo)'),
            Separator(),
            Text('Docs'),
            Link('Flask-Debug', 'https://github.com/mbr/flask-debug'),
            Link('Flask-Bootstrap', 'http://pythonhosted.org/Flask-Bootstrap'),
            Link('Getting started',
                 'http://getbootstrap.com/getting-started/'),
            Link('CSS', 'http://getbootstrap.com/css/'),
            Link('Components', 'http://getbootstrap.com/components/'),
            Link('Javascript', 'http://getbootstrap.com/javascript/'),
            Link('Customize', 'http://getbootstrap.com/customize/'),
        ),
コード例 #15
0
def basebar():
    return Navbar(
        current_app.config.get('SITE_NAME'),
        View('Home', '.index'),
        Text(f'Using Flask-Bootstrap {FLASK_BOOTSTRAP_VERSION}'),
    )
コード例 #16
0
app = Flask(__name__)
app.config.from_pyfile('settings.py')
app.config.update(dict(
    DATABASE=os.path.join(app.root_path, app.config['DATABASE_NAME']),
))

# We're adding a navbar as well through flask-navbar. In our example, the
# navbar has an usual amount of Link-Elements, more commonly you will have a
# lot more View instances.
nav = Nav()
nav.register_element('frontend_top', Navbar(
    View('Music on Blocks', 'index'),
    View('Tags', 'tags'),
    View('Settings', 'settings'),
    View('Debug', 'debug'),
    Text('Current GIT Hash: {}'.format(get_git_revision_short_hash())), ))

# webapp endpoint
Bootstrap(app)
nav.init_app(app)

# Because we're security-conscious developers, we also hard-code disabling
# the CDN support (this might become a default in later versions):
app.config['BOOTSTRAP_SERVE_LOCAL'] = True


raspberryPi = None
mySonosController = None
lastTag = None

# database stuff
コード例 #17
0
ファイル: HPlay.py プロジェクト: jgonzalez314/HazzahPlayWeb
#   authDomain: "huzzahplay.firebaseapp.com",
#   databaseURL: "https://huzzahplay.firebaseio.com",
#   projectId: "huzzahplay",
#   storageBucket: "huzzahplay.appspot.com",
#   messagingSenderId: "843161759149",
#   appId: "1:843161759149:web:60cdd3bb2df7ababffc524",
#   measurementId: "G-63902Y2BQB"
# };

# firebase = Firebase(config)

nav.register_element(
    'my_navbar',
    Navbar(
        'thenav',
        Text('HazzahPlay'),
        Separator(),
        View('Home', 'index'),
        Separator(),
        View('Item One', 'item', item=1),
        Separator(),
        View('Item two', 'item', item=2),
        Separator(),
        Link('Google Classroom', 'https://www.google.com'),
    ))


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

    uname = ''
コード例 #18
0
ファイル: Nav_Bars.py プロジェクト: Duktig511/Dash_App
from flask_nav.elements import Navbar, View, Link, Text, Separator
from flask_nav.renderers import Renderer
from dominate import tags


class JustDivRenderer(Renderer):
    def visit_Navbar(self, node):

        sub = []
        for item in node.items:
            sub.append(self.visit(item))

        return tags.div('Navigation:', *sub)

    def visit_View(self, node):

        return tags.div('{} ({})'.format(node.title, node.get_url()))

    def visit_Subgroup(self, node):

        # almost the same as visit_Navbar, but written a bit more concise
        return tags.div(node.title, *[self.visit(item) for item in node.items])


nav_bar = (View('Home', 'landing'), View('Visual One', 'visual_1'),
           View('Visual Two', 'visual_2'), View('Visual Three', 'visual_3'),
           View('Visual Four', 'visual_4'), View('Visual Five', 'visual_5'),
           Link('Google', 'www.google.com'), Separator(), Text('HR'))
コード例 #19
0
from flask_nav.elements import Navbar, View, Text

from youtube_dl_web.forms import DownloadForm
from youtube_dl_web.nav import nav
from youtube_dl_web.ydl_helper import YoutubeDownloadHandler

frontend = Blueprint('frontend', __name__)

nav.register_element(
    'frontend_top',
    Navbar(
        View('Youtube-DL-web', 'frontend.index'),
        View('Home', 'frontend.index'),
        View('Download', 'frontend.download'),
        View('Debug-Info', 'debug.debug_root'),
        Text('Using Flask-Bootstrap {}'.format(flask_bootstrap_version)),
    ))


@frontend.after_app_request
def add_security_headers(response):
    response.headers['Content-Security-Policy'] = "default-src 'self'"
    response.headers['X-Content-Type-Options'] = 'nosniff'
    response.headers['X-Frame-Options'] = 'SAMEORIGIN'
    response.headers['X-XSS-Protection'] = '1; mode=block'

    response.set_cookie('username',
                        'flask',
                        secure=True,
                        httponly=True,
                        samesite='Lax')
コード例 #20
0
ファイル: __init__.py プロジェクト: keejiane/KProxyScan
    'frontend_top',
    Navbar(
        View('KScan', '.index'),
        View('Dashboard', '.alertTrend'),
        Subgroup(
            'XSSer',
            View('XSSerTrend', '.xsserTrend'),
            Separator(),
            View('XSSer', '.xsser_search'),
        ),
        Subgroup(
            'Sqlmap',
            View('SqlmapTrend', '.sqlmapTrend'),
            Separator(),
            View('Sqlmap', 'sqlmap_search'),
        ),

        # Subgroup(
        # 	'Others',
        # 	View('UrlRedirect', '.redirect_search'),
        # 	Separator(),
        # 	View('CSRF', '.csrf_search'),
        # ),
        Text('About'),
        Text(''),
        View('Login', '.login'),
        View('Logout', '.logout'),
    ))

from . import views
コード例 #21
0
ファイル: frontend.py プロジェクト: ser/flask-bootstrap
# We're adding a navbar as well through flask-navbar. In our example, the
# navbar has an usual amount of Link-Elements, more commonly you will have a
# lot more View instances.
nav.register_element(
    'frontend_top',
    Navbar(
        View('Flask-Bootstrap', '.index'), View('Home', '.index'),
        View('Forms Example', '.example_form'),
        View('Debug-Info', 'debug.debug_root'),
        Subgroup(
            'Docs',
            Link('Flask-Bootstrap', 'http://pythonhosted.org/Flask-Bootstrap'),
            Link('Flask-AppConfig', 'https://github.com/mbr/flask-appconfig'),
            Link('Flask-Debug', 'https://github.com/mbr/flask-debug'),
            Separator(),
            Text('Bootstrap'),
            Link('Getting started',
                 'http://getbootstrap.com/getting-started/'),
            Link('CSS', 'http://getbootstrap.com/css/'),
            Link('Components', 'http://getbootstrap.com/components/'),
            Link('Javascript', 'http://getbootstrap.com/javascript/'),
            Link('Customize', 'http://getbootstrap.com/customize/'),
        )))


# Our index-page just shows a quick explanation. Check out the template
# "templates/index.html" documentation for more details.
@frontend.route('/')
def index():
    return render_template('index.html')
コード例 #22
0


frontend = Blueprint('frontend', __name__)

# We're adding a navbar as well through flask-navbar. In our example, the
# navbar has an usual amount of Link-Elements, more commonly you will have a
# lot more View instances.
nav.register_element('frontend_top', Navbar(
    View('Home', '.index'),
    Subgroup(
        'About us',
        View('About us', '.about_us'),
        Link('Our GitHub', 'https://github.com/lunarknight00/meshup_app'),
        Separator(),
        Text('Libo Zhuo'),
        Link('Facebook', 'https://www.facebook.com/profile.php?id=100003725844785'),
        Separator(),
        Text('Charles Xiao'),
        Link('Facebook', 'https://www.facebook.com/profile.php?id=100019738470628'),
        Separator(),
        Text('Yun Lu'),
        Link('Facebook', 'https://www.facebook.com/profile.php?id=100003946230232'))))



@frontend.route("/admin/plotting/<country>", methods=['GET'])
def plotting(country):
    try:
        country = (country[0].upper()+country[1:]).replace('_',' ')
        dic = fetch_country_data(country)
コード例 #23
0
ファイル: frontend.py プロジェクト: gregadevinta/skipper
frontend = Blueprint('frontend', __name__)

branding = img(src='/static/fiaas_small.png')

nav.register_element(
    'frontend_top',
    Navbar(
        branding,
        View('Home', '.index'),
        View('Status', '.status'),
        View('Deploy', '.deploy'),
        Subgroup(
            'Docs',
            Link('Getting started', 'https://fiaas.github.io/'),
        ),
        Text('Using FIAAS {}'.format(FIAAS_VERSION)),
    ))


@frontend.route('/')
def index():
    return render_template('index.html')


@frontend.route('/status')
def status():
    versions = {}
    for tag in ("stable", "latest"):
        try:
            channel = frontend.release_channel_factory("fiaas-deploy-daemon",
                                                       tag)
コード例 #24
0
ファイル: __init__.py プロジェクト: weevis/sample_flask
        print('Error: No Secret Key! Create it with:')
        full_path = os.path.dirname(filename)
        if not os.path.isdir(full_path):
            print('mkdir -p {filename}'.format(filename=full_path))
        print('head -c 24 /dev/urandom > {filename}'.format(filename=filename))
        sys.exit(1)


app = create_app()

if not app.config['DEBUG']:
    install_secret_key(app)


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


@app.errorhandler(404)
def not_found(error):
    return render_template('404.html'), 404


nav.register_element(
    'frontend_top',
    ExtendedNavbar(title=View('Home', '.index'),
                   root_class='navbar navbar-default',
                   right_items=(Text('Moop'), View('Register',
                                                   'users.register'))))
コード例 #25
0
@app.route('/trending_games')
def trending_games():
    bgg = BoardGameGeek()
    hot_items_dict = dict()
    for item in bgg.hot_items("boardgame"):
        hot_items_dict[item.id] = item.name
    return render_template('page.html', hot_items_dict=hot_items_dict)


@app.route('/dice_roller')
def dice_rollers():
    return render_template('dice.html')


if __name__ == '__main__':
    Bootstrap(app)
    app.secret_key = 'devkey'
    app.config['SESSION_TYPE'] = 'filesystem'
    app.config['SECRET_KEY'] = 'devkey'
    app.config['RECAPTCHA_PUBLIC_KEY'] = \
        '6Lfol9cSAAAAADAkodaYl9wvQCwBMr3qGR_PPHcw'
    nav = Nav()
    nav.register_element('top', Navbar(
        View('TableTopWeb', '.index'),
        View('Dice Roller', '.dice_rollers'),
        View('Scoreboard', '.scoreboard'),
        View('Trending Games', '.trending_games'),
        Text('Networks Lab 2 by Junsheng & Shaun'), ))
    nav.init_app(app)
    app.run(debug=True, host='0.0.0.0')
コード例 #26
0
from flask import Flask, render_template
from flask_nav import Nav
from flask_nav.elements import Navbar, Subgroup, View, Link, Text, Separator
from flask_bootstrap import Bootstrap
app = Flask(__name__)
Bootstrap(app)

nav = Nav(app)

view1 = View('Home Page', 'index')
view2 = View('Item One', 'items', item = 1)
link1 = Link('Google', 'https://www.google.com')
sep1 = Separator()
text = Text('Here is some text')
subgroup = Subgroup('Subgroup', view1, view2, link1)
navbar = Navbar('name_doesnt_matter', view1, view2, link1, text, subgroup)
nav.register_element('my_navbar',navbar)

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

@app.route('/items/<item>')
def items(item):
    return '<h1>The item is {}</h1>'.format(item)

if __name__ == '__main__':
    app.run(debug = True)
コード例 #27
0
# lot more View instances.
nav.register_element(
    'frontend_top',
    Navbar(
        View('PyLoggi', '.index'),
        View('Home', '.index'),
        View('Forms Example', '.example_form'),
        View('Debug-Info', 'debug.debug_root'),
        View('About', '.about'),
        Subgroup(
            'Docs',
            Link('About', '/about'),
            Link('Flask-AppConfig', 'https://github.com/mbr/flask-appconfig'),
            Link('Flask-Debug', 'https://github.com/mbr/flask-debug'),
            Separator(),
            Text('Bootstrap'),
            Link('Getting started',
                 'http://getbootstrap.com/getting-started/'),
            Link('CSS', 'http://getbootstrap.com/css/'),
            Link('Components', 'http://getbootstrap.com/components/'),
            Link('Javascript', 'http://getbootstrap.com/javascript/'),
            Link('Customize', 'http://getbootstrap.com/customize/'),
        ),
        Text('Using Flask-Bootstrap {}'.format(FLASK_BOOTSTRAP_VERSION)),
    ))


# Our index-page just shows a quick explanation. Check out the template
# "templates/index.html" documentation for more details.
@frontend.route('/')
def index():
コード例 #28
0
ファイル: nav.py プロジェクト: vfedotovs/ss-scraper
# -*- coding: utf-8 -*-

from flask_nav import Nav
from flask_nav.elements import Navbar, View, Subgroup, Link, Text, Separator

nav = Nav()

nav.register_element(
    'frontend_top',
    Navbar(
        View('FS.lv', 'main.index'),
        Subgroup(
            'Cars',
            Text('Timeline'),
            View('Price vs Year', 'cars.price_vs_year'),
            View('Mileage vs Year', 'cars.mileage_vs_year'),
            View('Number vs Year', 'cars.bar_price_counts_by_year'),
            View('Market Cap vs Year', 'cars.bar_price_sum_by_year'),
            View('Mean price vs Year', 'cars.bar_price_mean_by_year'),
            View('Colors vs Year', 'cars.bar_color_by_year'),
            Separator(),
            Text('Empty'),
        ),
        Subgroup(
            'Flats',
            Text('Riga Districts'),
            View('Price vs District', 'flats.box_riga_price_mean_by_district'),
            View('Average price per m2 vs District',
                 'flats.bar_riga_avg_price_m2_by_district'),
            View('Average price vs District',
                 'flats.bar_riga_avg_price_by_district'),