Skip to content
Snippets Groups Projects
Commit 89397451 authored by Nathan Bills's avatar Nathan Bills
Browse files

Updating the routing and testing the controllers and models. It all seems to be working well.

parent 4e447b54
Branches
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ class CreateForm(Form):
@app.route('/')
def start():
return render_template('printer/index.html')
return render_template('home/home.html')
@app.route('/print', methods=['GET', 'POST'])
......@@ -20,5 +20,5 @@ def printer():
from app.models.Printer import Printer
printer = Printer()
printer.show_string(form.text.data)
return render_template('printer/index.html')
return render_template('printer/print.html', form=form)
return render_template('home/index.html')
return render_template('home/print.html', form=form)
# -*- coding: utf-8 -*-
from project import app
from flask import render_template, request
from flask.ext.wtf import Form, TextField, validators
class CreateForm(Form):
text = TextField(u'Text:', [validators.Length(min=1, max=200)])
@app.route('/test', methods=['GET', 'POST'])
def test():
form = CreateForm(request.form)
if request.method == 'POST' and form.validate():
from project.models.Test import Test
test = Test()
test.show_string(form.text.data)
return render_template('test/index.html')
return render_template('test/test.html', form=form)
\ No newline at end of file
......@@ -2,7 +2,7 @@
from flask import flash
class Printer(object):
class Home(object):
def show_string(self, text):
if text == '':
......
# -*- coding: utf-8 -*-
from flask import flash
class Test(object):
def show_string(self, text):
if text == '':
flash("You didn't enter any text to flash")
else:
flash(text + "!!!")
\ No newline at end of file
import os
import glob
__all__ = [os.path.basename(
f)[:-3] for f in glob.glob(os.path.dirname(__file__) + "/*.py")]
\ No newline at end of file
{% extends "index.html" %}
{% block content %}
<div class="jumbotron">
<h1>It's working!!!</h1>
<p>Here, all of your wildest dreams can come true.</p>
<p><a class="btn btn-primary btn-lg" role="button">The Demo</a></p>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="thumbnail">
<img data-src="holder.js/100%x200/sky" alt="...">
<div class="caption">
<h3>Awesome Sauce!</h3>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div class="thumbnail">
<img data-src="holder.js/100%x200/vine" alt="...">
<div class="caption">
<h3>It is so cool!</h3>
</div>
</div>
</div>
</div>
{% endblock %}
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<!-- holderJS -->
<script src="lib/holder.js"></script>
<title>My Movie Library</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap-slate.min.css') }}">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- holderJS -->
<script src="{{ url_for('static', filename='lib/holder.js') }}"></script>
</head>
<body>
<div class="page">
<div class="container">
<!-- Begin the navbar -->
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
......@@ -31,42 +27,23 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">My Movie Library</a>
<a class="navbar-brand" href="{{ url_for('start') }}">My Movie Library</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="https://github.com/ndbills/MyMovieLibrary/" target="_blank">GitHub</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Login</a></li>
<li><a href="#">Sign-up</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class="jumbotron">
<h1>Welcome to your new Home Movie Library!</h1>
<p>Here, all of your wildest dreams can come true.</p>
<p><a class="btn btn-primary btn-lg" role="button">The Demo</a></p>
</div>
</nav><!-- end navbar -->
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="thumbnail">
<img data-src="holder.js/100%x200/vine" alt="...">
<div class="caption">
<h3>Facebook</h3>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div class="thumbnail">
<img data-src="holder.js/100%x200/vine" alt="...">
<div class="caption">
<h3>Blog</h3>
</div>
</div>
</div>
</div>
{% block content %}{% endblock %}
<div class="panel panel-default">
<div class="panel-body">
......@@ -76,11 +53,22 @@
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script src="{{ url_for('static', filename='lib/bootstrap.min.js') }}"></script>
<!--<h1>Flask MVC Boilerplate</h1>
{#{% for message in get_flashed_messages() %}
<div class="flash">{{ message }}</div>
{% endfor %}
{% macro render_error(field) %}
{% if field.errors %}
{% for error in field.errors %}<span class='error'>{{ error }}</span>{% endfor %}
{% endif %}
{% endmacro %}
{% block body %}{% endblock %}#}-->
</div>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
......@@ -43,7 +44,7 @@
</nav><!-- end navbar -->
<div class="jumbotron">
<h1>Welcome to the new Movie Library!</h1>
<h1>It didn't work!</h1>
<p>Here, all of your wildest dreams can come true.</p>
<p><a class="btn btn-primary btn-lg" role="button">The Demo</a></p>
</div>
......@@ -67,6 +68,8 @@
</div>
</div>
{% block content %}{% endblock %}
<div class="panel panel-default">
<div class="panel-body">
Open Source by Brian Wood & Nathan Bills, 2014
......
{% extends "layout/layout.html" %}
{% block body %}
<ul>
<p>
<a href="{{ url_for('printer') }}">Click here to print!</a>
</p>
</ul>
{% endblock %}
{% extends "layout/layout.html" %}
{% block body %}
<form action="{{ url_for('printer') }}" method="post">
{{ form.csrf_token }}
<dl>
<dd>{{ form.text.label }} {{ form.text(size=20) }} {{ render_error(form.text) }}</dd>
<dd><input type="submit" value="Flash"/></dd>
</dl>
</form>
{% endblock %}
{% extends "index.html" %}
{% block content %}
<ul>
<p>
<a href="{{ url_for('test') }}">Click here to test!</a>
</p>
</ul>
{% endblock %}
\ No newline at end of file
{% extends "index.html" %}
{% block content %}
<form action="{{ url_for('test') }}" method="post">
{{ form.csrf_token }}
<dl>
<dd>{{ form.text.label }} {{ form.text(size=20) }}
{% if form.error %}
{{ render_error(form.text) }}
{% endif %}
</dd>
<dd><input type="submit" value="Flash"/></dd>
</dl>
</form>
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment