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

Removed old test data, cleaned up some files and updated the library.html view.

parent 609c8f8a
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
from project import app
from flask import render_template, request
from flask.ext.wtf import Form, TextField, validators
import datetime
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)
@app.route('/test-user')
def test_user():
from project.model.User import User
test_user = User.createUser(email='ndbills@gmail.com', password='password')
#check if test_user exists
#if yes, return a success render_template
#else add the user and return some other template
return render_template('test/test-user.html')
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{% if message %} {% if message %}
{{ message }} {{ message }}
{% else %} {% else %}
What you were looking for is just not there. What you are looking for is just not here.
{% endif %} {% endif %}
</p> </p>
</div> </div>
......
...@@ -77,23 +77,10 @@ ...@@ -77,23 +77,10 @@
</div> </div>
</div> </div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <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 --> <!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="{{ url_for('static', filename='lib/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> </div>
</body> </body>
</html> </html>
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
{% set loan = movie.getLoan(user) %} {% set loan = movie.getLoan(user) %}
<tr class='clickable' data-id='{{ loop.index }}'> <tr class='clickable' data-id='{{ loop.index }}'>
<td> <td>
<h4>{{ movie.title }}</h4>
<img src="{{ movie.poster|default('') }}" style="max-width: 200px;" alt="{{ movie.title }}"> <img src="{{ movie.poster|default('') }}" style="max-width: 200px;" alt="{{ movie.title }}">
<p>{{ movie.title }}</p>
<div class="btn-group hidden-md hidden-lg"> <div class="btn-group hidden-md hidden-lg">
{% if loan == None %} {% if loan == None %}
<button type="button" class="btn btn-default btn-small lend-movie" data-toggle="modal" data-target="#loan-form" data-id='{{ movie.id }}'>Lend</button> <button type="button" class="btn btn-default btn-small lend-movie" data-toggle="modal" data-target="#loan-form" data-id='{{ movie.id }}'>Lend</button>
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</tbody> </tbody>
</table> </table>
...@@ -148,7 +147,7 @@ ...@@ -148,7 +147,7 @@
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
var movie_id = $(this).data('id'); var movie_id = $(this).data('id');
var message = "Are you sure you want return this movie? "; var message = "Are you sure this movie has been returned? ";
if (confirm(message)) { if (confirm(message)) {
$.ajax({ $.ajax({
url: returnPath, url: returnPath,
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<div class="col-sm-12"> <div class="col-sm-12">
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-3 col-md-3" style="margin-bottom:20px"> <div class="col-xs-12 col-sm-3 col-md-3" style="margin-bottom:20px">
<img src="{{ item.poster }}" style="max-width: 180px;" alt="{{ item.title }}">
<h3>{{ item.title }}</h3> <h3>{{ item.title }}</h3>
<img src="{{ item.poster }}" style="max-width: 180px; margin-bottom: 15px;" alt="{{ item.title }}">
{% if loan != None %} {% if loan != None %}
Loaned to: {{ loan.borrower_email }}<br/> Loaned to: {{ loan.borrower_email }}<br/>
Due back: {{ loan.expected_return_date.strftime('%m-%d-%Y') }} Due back: {{ loan.expected_return_date.strftime('%m-%d-%Y') }}
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
{% if library.name != "Master" or loan == None %} {% if library.name != "Master" or loan == None %}
<button type="button" class="btn btn-default btn-small remove-movie" data-id='{{ index }}'>Remove</button> <button type="button" class="btn btn-default btn-small remove-movie" data-id='{{ index }}'>Remove</button>
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="col-md-1 hidden-sm"> <div class="col-md-1 hidden-sm">
...@@ -49,7 +48,6 @@ ...@@ -49,7 +48,6 @@
<dt>{{ actor }}</dt> <dt>{{ actor }}</dt>
<dd>{{ character }}</dd> <dd>{{ character }}</dd>
{% endfor %} {% endfor %}
</dl> </dl>
</div> </div>
...@@ -95,7 +93,6 @@ ...@@ -95,7 +93,6 @@
} }
} }
}); });
} }
}); });
...@@ -126,7 +123,6 @@ ...@@ -126,7 +123,6 @@
} }
} }
}); });
} }
}); });
}); });
......
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
} }
} }
}); });
} }
}); });
}); });
......
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
$(".{{ self.form_id() }}-error").html('').addClass('hide'); $(".{{ self.form_id() }}-error").html('').addClass('hide');
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block additional_javascripts %} {% block additional_javascripts %}
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
<tr> <tr>
<td> <td>
<!--<img data-src="holder.js/165x200/sky" alt="movie title">--> <!--<img data-src="holder.js/165x200/sky" alt="movie title">-->
<img src="http://1.bp.blogspot.com/__cfySUj2yhk/TKE8n5fJo4I/AAAAAAAAAnY/Vwf39Hilx2Y/s1600/Bourne_Identity.jpg" style="max-width: 200px;" alt="The Bourne Identity">
<p>The Bourne Identity</p> <p>The Bourne Identity</p>
<img src="http://1.bp.blogspot.com/__cfySUj2yhk/TKE8n5fJo4I/AAAAAAAAAnY/Vwf39Hilx2Y/s1600/Bourne_Identity.jpg" style="max-width: 200px;" alt="The Bourne Identity">
</td> </td>
<td> <td>
<p>A man is picked up by a fishing boat, bullet-riddled and without memory, then races to elude assassins and recover from amnesia.</p> <p>A man is picked up by a fishing boat, bullet-riddled and without memory, then races to elude assassins and recover from amnesia.</p>
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<img src="http://www.eeriedigest.com/wordpress/wp-content/uploads/2011/08/bourne-supremacy.jpg" style="max-width: 200px;" alt="The Bourne Supremacy">
<p>The Bourne Supremacy</p> <p>The Bourne Supremacy</p>
<img src="http://www.eeriedigest.com/wordpress/wp-content/uploads/2011/08/bourne-supremacy.jpg" style="max-width: 200px;" alt="The Bourne Supremacy">
</td> </td>
<td> <td>
<p>When Jason Bourne is framed for a CIA operation gone awry, he is forced to resume his former life as a trained assassin to survive.</p> <p>When Jason Bourne is framed for a CIA operation gone awry, he is forced to resume his former life as a trained assassin to survive.</p>
......
{% 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 %}
<h2>Check to see if it worked??!</h2>
{% 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