moved to bootstrap4
This commit is contained in:
@@ -1,26 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# this file is released under public domain and you can use without limitations
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# This is a sample controller
|
||||
# - index is the default action of any application
|
||||
# - user is required for authentication and authorization
|
||||
# - download is for downloading files uploaded in the db (does streaming)
|
||||
# this file is released under public domain and you can use without limitations
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# ---- example index page ----
|
||||
def index():
|
||||
"""
|
||||
example action using the internationalization operator T and flash
|
||||
rendered by views/default/index.html or views/generic.html
|
||||
|
||||
if you need a simple wiki simply replace the two lines below with:
|
||||
return auth.wiki()
|
||||
"""
|
||||
response.flash = T("Hello World")
|
||||
return dict(message=T('Welcome to web2py!'))
|
||||
|
||||
# ---- API (example) -----
|
||||
@auth.requires_login()
|
||||
def api_get_user_email():
|
||||
if not request.env.request_method == 'GET': raise HTTP(403)
|
||||
return response.json({'status':'success', 'email':auth.user.email})
|
||||
|
||||
# ---- Smart Grid (example) -----
|
||||
@auth.requires_membership('admin') # can only be accessed by members of admin groupd
|
||||
def grid():
|
||||
response.view = 'generic.html' # use a generic view
|
||||
tablename = request.args(0)
|
||||
if not tablename in db.tables: raise HTTP(403)
|
||||
grid = SQLFORM.smartgrid(db[tablename], args=[tablename], deletable=False, editable=False)
|
||||
return dict(grid=grid)
|
||||
|
||||
# ---- Embedded wiki (example) ----
|
||||
def wiki():
|
||||
auth.wikimenu() # add the wiki to the menu
|
||||
return auth.wiki()
|
||||
|
||||
# ---- Action for login/register/etc (required for auth) -----
|
||||
def user():
|
||||
"""
|
||||
exposes:
|
||||
@@ -39,7 +48,7 @@ def user():
|
||||
"""
|
||||
return dict(form=auth())
|
||||
|
||||
|
||||
# ---- action to server uploaded static content (required) ---
|
||||
@cache.action()
|
||||
def download():
|
||||
"""
|
||||
|
||||
@@ -108,8 +108,3 @@ if not configuration.get('app.production'):
|
||||
]),
|
||||
]
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# maybe add a wiki menu if app embeds wiki pages
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
if "auth" in locals():
|
||||
auth.wikimenu()
|
||||
|
||||
@@ -6,6 +6,7 @@ description = a cool new app
|
||||
keywords = web2py, python, framework
|
||||
generator = Web2py Web Framework
|
||||
production = false
|
||||
toolbar = false
|
||||
|
||||
; Host configuration
|
||||
[host]
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
<a class="btn btn-secondary" href="{{=URL('examples','default','index')}}">{{=T("Online examples")}}</a>
|
||||
<a class="btn btn-secondary" href="http://web2py.com">web2py.com</a>
|
||||
<a class="btn btn-secondary" href="http://web2py.com/book">{{=T('Documentation')}}</a>
|
||||
<a class="btn btn-secondary" href="{{=URL('default','api_get_user_email')}}">{{=T('API Example')}}</a>
|
||||
<a class="btn btn-secondary" href="{{=URL('default','grid/auth_user')}}">{{=T('Grid Example')}}</a>
|
||||
<a class="btn btn-secondary" href="{{=URL('default','wiki')}}">{{=T('Wiki Example')}}</a>
|
||||
</center>
|
||||
{{elif 'content' in globals():}}
|
||||
{{=content}}
|
||||
|
||||
@@ -11,6 +11,3 @@ It is used as default when a view is not provided for your controllers
|
||||
{{elif len(response._vars)>1:}}
|
||||
{{=BEAUTIFY(response._vars)}}
|
||||
{{pass}}
|
||||
{{if request.is_local:}}
|
||||
{{=response.toolbar()}}
|
||||
{{pass}}
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
{{block center}}
|
||||
{{include}}
|
||||
{{end}}
|
||||
{{=response.toolbar() if configuration.get('app.toolbar') else ''}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user