def get(self): page = Page() # Creates an instance of the imported class page page.title = "Title" page.css = "css/styles.css" page.body = "Miss piggy" page.update() self.response.write(page.whole_page)
def Login(params=None, title=None): """ Renders the login page. There is no separate login for the application, this is passed to the database! """ p = Page() p.content('<!DOCTYPE html>') with p.html(): with p.head(): with p.title(): p.content('pgui - Login') with p.link({'href': 'static/lib/bootstrap/bootstrap-3.3.4-dist/css/bootstrap.css', 'rel': 'stylesheet'}): pass with p.link({'href': 'static/login.css', 'rel': 'stylesheet'}): pass with p.body(): with p.div({'class': 'container'}): with p.form({'method': 'POST', 'class': 'login'}): with p.h2({'class': 'login-header'}): p.content('Connect to a postgres database server') with p.label({'for': 'name', 'class': 'sr-only'}): p.content('User name') with p.input({'type': 'input', 'id': 'name', 'name': 'name', 'class': 'form-control', 'placeholder': 'User name'}): pass with p.label({'for': 'password', 'class': 'sr-only'}): p.content('Password') with p.input({'type': 'password', 'id': 'password', 'name': 'password', 'class': 'form-control', 'placeholder': 'Password'}): pass with p.label({'for': 'host', 'class': 'sr-only'}): p.control('Host') with p.input({'type': 'input', 'id': 'host', 'name': 'host', 'class': 'form-control', 'value': 'localhost'}): pass with p.label({'for': 'port', 'class': 'sr-only'}): p.content('Port') with p.input({'type': 'input', 'id': 'port', 'name': 'port', 'class': 'form-control', 'value': '5432'}): pass with p.button({'class': 'btn btn-lg btn-success btn-block', 'type': 'submit'}, args=['autofocus']): p.content('Connect') with p.div({'class': 'login'}): if 'err' in params and params['err']: for err in params['err']: with p.code(): p.content(err) return p
def Header(params=None, title=None, css=None, js=None): p = Page() p.content('<!DOCTYPE html>') with p.html(close=False): with p.head(): with p.title(): p.content('pgui - %s/%s' % (cu.database, title)) with p.meta({'charset': 'utf-8'}): pass with p.script({'src': 'static/lib/jquery/jquery-2.1.3.js'}): pass with p.script({'src': 'static/pgui.js'}): pass with p.link({'href': 'static/pgui.css', 'rel': 'stylesheet'}): pass with p.link({'href': 'static/lib/bootstrap/bootstrap-3.3.4-dist/css/bootstrap.css', 'rel': 'stylesheet'}): pass with p.link({'href': 'static/lib/codemirror/codemirror-5.1/lib/codemirror.css', 'rel': 'stylesheet'}): pass with p.link({'href': 'static/lib/codemirror/codemirror-5.1/theme/neo.css', 'rel': 'stylesheet'}): pass with p.link({'href': 'static/lib/codemirror/codemirror-5.1/addon/hint/show-hint.css', 'rel': 'stylesheet'}): pass if css: for c in css: with p.link({'href': c, 'rel': 'stylesheet'}): pass with p.script({'src': 'static/lib/bootstrap/bootstrap-3.3.4-dist/js/bootstrap.js'}): pass with p.script({'src': 'static/lib/codemirror/codemirror-5.1/lib/codemirror.js'}): pass with p.script({'src': 'static/lib/codemirror/codemirror-5.1/keymap/emacs.js'}): pass with p.script({'src': 'static/lib/codemirror/codemirror-5.1/keymap/vim.js'}): pass with p.script({'src': 'static/lib/codemirror/codemirror-5.1/keymap/sublime.js'}): pass with p.script({'src': 'static/lib/codemirror/codemirror-5.1/mode/sql/sql.js'}): pass with p.script({'src': 'static/lib/codemirror/codemirror-5.1/addon/hint/show-hint.js'}): pass if js: for j in js: with p.script({'src': j}): pass with p.body(close=False): config = 'PGUI.user = "******"; PGUI.db = "%s"; PGUI.host = "%s";' % (cu.name, cu.database, cu.host) with p.script(): p.content(config) return p
def get(self): p = Page() p.body = "Content" self.response.write(p.print_out())
def Login(params=None, title=None): """ Renders the login page. There is no separate login for the application, this is passed to the database! """ p = Page() p.content('<!DOCTYPE html>') with p.html(): with p.head(): with p.title(): p.content('pgui - Login') with p.link({ 'href': 'static/lib/bootstrap/bootstrap-3.3.4-dist/css/bootstrap.css', 'rel': 'stylesheet' }): pass with p.link({'href': 'static/login.css', 'rel': 'stylesheet'}): pass with p.body(): with p.div({'class': 'container'}): with p.form({'method': 'POST', 'class': 'login'}): with p.h2({'class': 'login-header'}): p.content('Connect to a postgres database server') with p.label({'for': 'name', 'class': 'sr-only'}): p.content('User name') with p.input({ 'type': 'input', 'id': 'name', 'name': 'name', 'class': 'form-control', 'placeholder': 'User name' }): pass with p.label({'for': 'password', 'class': 'sr-only'}): p.content('Password') with p.input({ 'type': 'password', 'id': 'password', 'name': 'password', 'class': 'form-control', 'placeholder': 'Password' }): pass with p.label({'for': 'host', 'class': 'sr-only'}): p.control('Host') with p.input({ 'type': 'input', 'id': 'host', 'name': 'host', 'class': 'form-control', 'value': 'localhost' }): pass with p.label({'for': 'port', 'class': 'sr-only'}): p.content('Port') with p.input({ 'type': 'input', 'id': 'port', 'name': 'port', 'class': 'form-control', 'value': '5432' }): pass with p.button( { 'class': 'btn btn-lg btn-success btn-block', 'type': 'submit' }, args=['autofocus']): p.content('Connect') with p.div({'class': 'login'}): if 'err' in params and params['err']: for err in params['err']: with p.code(): p.content(err) return p
def Header(params=None, title=None, css=None, js=None): p = Page() p.content('<!DOCTYPE html>') with p.html(close=False): with p.head(): with p.title(): p.content('pgui - %s/%s' % (cu.database, title)) with p.meta({'charset': 'utf-8'}): pass with p.script({'src': 'static/lib/jquery/jquery-2.1.3.js'}): pass with p.script({'src': 'static/pgui.js'}): pass with p.link({'href': 'static/pgui.css', 'rel': 'stylesheet'}): pass with p.link({ 'href': 'static/lib/bootstrap/bootstrap-3.3.4-dist/css/bootstrap.css', 'rel': 'stylesheet' }): pass with p.link({ 'href': 'static/lib/codemirror/codemirror-5.1/lib/codemirror.css', 'rel': 'stylesheet' }): pass with p.link({ 'href': 'static/lib/codemirror/codemirror-5.1/theme/neo.css', 'rel': 'stylesheet' }): pass with p.link({ 'href': 'static/lib/codemirror/codemirror-5.1/addon/hint/show-hint.css', 'rel': 'stylesheet' }): pass if css: for c in css: with p.link({'href': c, 'rel': 'stylesheet'}): pass with p.script({ 'src': 'static/lib/bootstrap/bootstrap-3.3.4-dist/js/bootstrap.js' }): pass with p.script({ 'src': 'static/lib/codemirror/codemirror-5.1/lib/codemirror.js' }): pass with p.script({ 'src': 'static/lib/codemirror/codemirror-5.1/keymap/emacs.js' }): pass with p.script( {'src': 'static/lib/codemirror/codemirror-5.1/keymap/vim.js'}): pass with p.script({ 'src': 'static/lib/codemirror/codemirror-5.1/keymap/sublime.js' }): pass with p.script({ 'src': 'static/lib/codemirror/codemirror-5.1/mode/sql/sql.js' }): pass with p.script({ 'src': 'static/lib/codemirror/codemirror-5.1/addon/hint/show-hint.js' }): pass if js: for j in js: with p.script({'src': j}): pass with p.body(close=False): config = 'PGUI.user = "******"; PGUI.db = "%s"; PGUI.host = "%s";' % ( cu.name, cu.database, cu.host) with p.script(): p.content(config) return p