Holger Frey
7 years ago
5 changed files with 123 additions and 86 deletions
@ -1,64 +1,86 @@ |
|||||||
<!DOCTYPE html> |
<!DOCTYPE html> |
||||||
<html lang="{{request.locale_name}}"> |
<html lang="en"> |
||||||
<head> |
<head> |
||||||
<meta charset="utf-8"> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
||||||
<meta name="description" content="pyramid web application"> |
|
||||||
<meta name="author" content="Pylons Project"> |
|
||||||
<link rel="shortcut icon" href="{{request.static_url('ordr2:static/pyramid-16x16.png')}}"> |
|
||||||
|
|
||||||
<title>Cookiecutter Alchemy project for the Pyramid Web Framework</title> |
<title>Ordr | {% block subtitle %} Subtitle {% endblock subtitle %}</title> |
||||||
|
|
||||||
<!-- Bootstrap core CSS --> |
<link href="{{request.static_url('ordr2:static/img/favicon.ico')}}" type="image/x-icon" rel="shortcut icon"> |
||||||
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> |
|
||||||
|
|
||||||
<!-- Custom styles for this scaffold --> |
<link href='http://fonts.googleapis.com/css?family=Anton&subset=latin,latin-ext' rel='stylesheet' type='text/css'> |
||||||
<link href="{{request.static_url('ordr2:static/theme.css')}}" rel="stylesheet"> |
|
||||||
|
|
||||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> |
<link rel="stylesheet" href="{{request.static_url('ordr2:static/css/bootstrap.css')}}" type="text/css" media="screen"> |
||||||
<!--[if lt IE 9]> |
<link rel="stylesheet" href="{{request.static_url('ordr2:static/css/bootstrap-responsive.css')}}" type="text/css" media="screen"> |
||||||
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> |
<link rel="stylesheet" href="{{request.static_url('ordr2:static/css/style.css')}}" type="text/css" media="screen" /> |
||||||
<script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> |
<!--[if !IE 7]> |
||||||
<![endif]--> |
<style type="text/css"> |
||||||
</head> |
#wrap {display:table;height:100%} |
||||||
|
</style> |
||||||
|
<![endif]--> |
||||||
|
|
||||||
<body> |
</head> |
||||||
|
<body class=""> |
||||||
<div class="starter-template"> |
<header class="navbar navbar-fixed-top"> |
||||||
<div class="container"> |
<div class="navbar-inner"> |
||||||
<div class="row"> |
<div class="container-fluid"> |
||||||
<div class="col-md-2"> |
<a href="{{request.resource_url(request.root)}}" class="brand">ordr</a> |
||||||
<img class="logo img-responsive" src="{{request.static_url('ordr2:static/pyramid.png') }}" alt="pyramid web framework"> |
{# TODO: |
||||||
</div> |
{% if request.user %} |
||||||
<div class="col-md-10"> |
<ul class="nav"> |
||||||
|
<li {% if is_active %} class="active" {% endif %}><a href="{{request.resource_url(request.root, 'orders')}}">Orders</a></li> |
||||||
|
<li {% if is_active %} class="active" {% endif %}><a href="{{request.resource_url(request.root, 'faq')}}">FAQs</a></li> |
||||||
|
{% if request.user.role == 'admin' %} |
||||||
|
<li {% if is_active %} class="active" {% endif %}><a href="{{request.resource_url(request.root, 'admin')}}">Admin</a></li> |
||||||
|
{% endif %} |
||||||
|
</ul> |
||||||
|
<ul class="nav pull-right"> |
||||||
|
<li class="dropdown" id="user-options"> |
||||||
|
<a data-toggle="dropdown" class="dropdown-toggle" href="#">Logged in as <span class="user-name">{{request.user.username}}</span></a> |
||||||
|
<ul class="dropdown-menu"> |
||||||
|
<li><a href="{{request.resource_url(request.root, 'account', 'settings')}}">Settings</a></li> |
||||||
|
<li><a href="#">Help</a></li> |
||||||
|
<li><a href="https://git.cpi.imtek.uni-freiburg.de/holgi/ordr2/issues">Submit an Issue</a></li> |
||||||
|
<li class="divider"></li> |
||||||
|
<li><a href="{{request.resource_url(request.root, 'account', 'logout')}}">Settings</a></li> |
||||||
|
</ul> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
{% else %} |
||||||
|
<ul class="nav"> |
||||||
|
<li {% if is_active %} class="active" {% endif %}><a href="{{request.resource_url(request.root, 'register')}}">Register</a></li> |
||||||
|
<li {% if is_active %} class="active" {% endif %}><a href="{{request.resource_url(request.root, 'about')}}">About</a></li> |
||||||
|
</ul> |
||||||
|
<form action="{{request.resource_url(request.root, 'account', 'login')}}" method="post"> |
||||||
|
<input type="hidden" name="redirect" value="{{request.url}}" /> |
||||||
|
<input name="username" type="text" placeholder="Username" class="input-small"> |
||||||
|
<input name="password" type="password" placeholder="Password" class="input-small"> |
||||||
|
<button type="submit" class="btn">Log in</button> |
||||||
|
</form> |
||||||
|
{% endif %} |
||||||
|
#} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</header> |
||||||
|
<div class="content {#<?php echo ($controls) ? ' controls' : ''; ?>#}"> |
||||||
{% block content %} |
{% block content %} |
||||||
<p>No content</p> |
<p>No content</p> |
||||||
{% endblock content %} |
{% endblock content %} |
||||||
</div> |
</div> |
||||||
</div> |
<footer> |
||||||
<div class="row"> |
|
||||||
<div class="links"> |
|
||||||
<ul> |
|
||||||
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li> |
|
||||||
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="https://webchat.freenode.net/?channels=pyramid">IRC Channel</a></li> |
|
||||||
<li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="row"> |
|
||||||
<div class="copyright"> |
|
||||||
Copyright © Pylons Project |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
|
<div class="copy"> |
||||||
|
<a class="icon-dbs" title="This software was orignially written by Sebastian Sebald." target="_blank" href="http://distractedbysquirrels.com/"></a> |
||||||
|
</div> |
||||||
|
|
||||||
<!-- Bootstrap core JavaScript |
</footer> |
||||||
================================================== --> |
<script src="{{request.static_url('ordr2:static/js/jquery.js')}}"></script> |
||||||
<!-- Placed at the end of the document so the pages load faster --> |
<script src="{{request.static_url('ordr2:static/js/bootstrap-transition.js')}}"></script> |
||||||
<script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script> |
<script src="{{request.static_url('ordr2:static/js/bootstrap-dropdown.js')}}"></script> |
||||||
<script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script> |
<script src="{{request.static_url('ordr2:static/js/bootstrap-modal.js')}}"></script> |
||||||
</body> |
<script src="{{request.static_url('ordr2:static/js/bootstrap-alert.js')}}"></script> |
||||||
|
<script src="{{request.static_url('ordr2:static/js/bootstrap-tooltip.js')}}"></script> |
||||||
|
<script src="{{request.static_url('ordr2:static/js/bootstrap-typeahead.js')}}"></script> |
||||||
|
<script src="{{request.static_url('ordr2:static/js/bootstrap-collapse.js')}}"></script> |
||||||
|
<script src="{{request.static_url('ordr2:static/js/functions.js')}}"></script> |
||||||
|
</body> |
||||||
</html> |
</html> |
||||||
|
@ -0,0 +1,38 @@ |
|||||||
|
{% extends "ordr2:templates/layout.jinja2" %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
<div class="container"> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="span12"> |
||||||
|
<hgroup id="welcome"> |
||||||
|
<h1>Welcome to <span class="brand">ordr</span>!</h1> |
||||||
|
<p class="quote">An order management system to simplify your shopping for laboratory supplies.</p> |
||||||
|
</hgroup> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="span12"> |
||||||
|
<p> |
||||||
|
<strong>What can order do for you?</strong> It will simplify the process of ordering laboratory supplies by using the power of the newest web technologies. Interested? Just follow the three steps below! |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="span4"> |
||||||
|
<h2>1. Register</h2> |
||||||
|
<p>Registration is easy as 1-2-3. Just fill out the form on <?php echo anchor('account/register', 'this page');?> and as soon as an admin has activated your account the shopping can begin!</p> |
||||||
|
</div> |
||||||
|
<div class="span4"> |
||||||
|
<h2>2. Place an Order</h2> |
||||||
|
<p>A lot of the chemicals, supllies and so forth are already stored in the database, so you don't have to fill out the order form your self!</p> |
||||||
|
</div> |
||||||
|
<div class="span4"> |
||||||
|
<h2>3. Get notified</h2> |
||||||
|
<p>As soons as your purchase has arrived you will automatically get notified. Or you can use the orders overview to check what the working status is.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div>{% endblock content %} |
@ -1,33 +0,0 @@ |
|||||||
from pyramid.response import Response |
|
||||||
from pyramid.view import view_config |
|
||||||
|
|
||||||
from sqlalchemy.exc import DBAPIError |
|
||||||
|
|
||||||
from ..models import MyModel |
|
||||||
|
|
||||||
|
|
||||||
@view_config(context='ordr2.resources.Root', renderer='../templates/mytemplate.jinja2') |
|
||||||
def my_view(context, request): |
|
||||||
try: |
|
||||||
query = request.dbsession.query(MyModel) |
|
||||||
one = query.filter(MyModel.name == 'one').first() |
|
||||||
except DBAPIError: |
|
||||||
return Response(db_err_msg, content_type='text/plain', status=500) |
|
||||||
return {'one': one, 'project': 'Ordr2'} |
|
||||||
|
|
||||||
|
|
||||||
db_err_msg = '''\ |
|
||||||
Pyramid is having a problem using your SQL database. The problem |
|
||||||
might be caused by one of the following things: |
|
||||||
|
|
||||||
1. You may need to run the 'initialize_ordr2_db' script |
|
||||||
to initialize your database tables. Check your virtual |
|
||||||
environment's 'bin' directory for this script and try to run it. |
|
||||||
|
|
||||||
2. Your database server may not be running. Check that the |
|
||||||
database server referred to by the 'sqlalchemy.url' setting in |
|
||||||
your 'development.ini' file is running. |
|
||||||
|
|
||||||
After you fix the problem, please restart the Pyramid application to |
|
||||||
try it again. |
|
||||||
''' |
|
Reference in new issue