Skip to content

Commit

Permalink
Merge branch 'master' of github.com:makaimc/choose-your-own-adventure…
Browse files Browse the repository at this point in the history
…-presentations
  • Loading branch information
mattmakai committed May 3, 2015
2 parents 321a48b + e819ea3 commit b2dd901
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 508 deletions.
7 changes: 4 additions & 3 deletions cyoa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import redis
from flask import Flask
from flask.ext.socketio import SocketIO
from flask.ext.login import LoginManager
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.socketio import SocketIO
import redis

app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('config.py')
Expand All @@ -18,4 +18,5 @@
login_manager.login_view = 'sign_in'
login_manager.init_app(app)

from . import views, websockets, wizard_views, web_voting_views
from . import views
from . import websockets
23 changes: 1 addition & 22 deletions cyoa/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DateField, IntegerField
from wtforms.validators import Required, Length, Regexp, EqualTo
from wtforms import ValidationError
from .models import Wizard, Presentation
from .models import Wizard


class LoginForm(Form):
Expand All @@ -21,24 +21,3 @@ def validate(self):
self.password.errors.append('Incorrect password.')
return False
return True


class PresentationForm(Form):
name = StringField('Presentation name', validators=[Required(),
Length(1, 60)])
filename = StringField('File name', validators=[Required(),
Length(1, 255)])
slug = StringField('URL slug', validators=[Required(),
Length(1, 255)])
is_active = BooleanField()
voting_number = StringField('Text-in phone number',
validators=[Length(0, 32)])
enable_browser_voting = BooleanField()


class ChoiceForm(Form):
name = StringField('Voting choice name', validators=[Required(),
Length(1, 60)])
slug = StringField('URL slug', validators=[Required(),
Length(1, 60)])
decision_point = IntegerField('Decision Point #', validators=[Required()])
34 changes: 0 additions & 34 deletions cyoa/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,3 @@ def verify_password(self, password):
def __repr__(self):
return '<Wizard %r>' % self.wizard_name


class Presentation(db.Model):
"""
Contains data regarding a single presentation.
"""
__tablename__ = 'presentations'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), unique=True)
slug = db.Column(db.String(128), unique=True)
filename = db.Column(db.String(256))
is_active = db.Column(db.Boolean, default=False)
voting_number = db.Column(db.String(32), default="")
enable_browser_voting = db.Column(db.Boolean, default=False)
choices_list = db.relationship('Choice', lazy='dynamic')

def __repr__(self):
return '<Presentation %r>' % self.name


class Choice(db.Model):
"""
A branch in the storyline that an audience member can vote on.
Maps directly into what is stored in Redis.
"""
__tablename__ = 'choices'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64))
slug = db.Column(db.String(64))
decision_point = db.Column(db.Integer)
presentation = db.Column(db.Integer, db.ForeignKey('presentations.id'))

def __repr__(self):
return '<Choice %r>' % self.name

Binary file added cyoa/static/cyoa-tutorial-step-4.tar.gz
Binary file not shown.
8 changes: 0 additions & 8 deletions cyoa/templates/404.html

This file was deleted.

2 changes: 0 additions & 2 deletions cyoa/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/css/wizard.css">
{% block css_head %}{% endblock %}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<!-- <script src="../../js/ie10-viewport-bug-workaround.js"></script> -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js">
</script>
Expand Down
File renamed without changes.
14 changes: 0 additions & 14 deletions cyoa/templates/decision.html

This file was deleted.

16 changes: 0 additions & 16 deletions cyoa/templates/list_presentations.html

This file was deleted.

23 changes: 0 additions & 23 deletions cyoa/templates/nav.html

This file was deleted.

43 changes: 0 additions & 43 deletions cyoa/templates/web_vote.html

This file was deleted.

32 changes: 0 additions & 32 deletions cyoa/templates/wizard/choice.html

This file was deleted.

41 changes: 0 additions & 41 deletions cyoa/templates/wizard/choices.html

This file was deleted.

41 changes: 0 additions & 41 deletions cyoa/templates/wizard/presentation.html

This file was deleted.

43 changes: 2 additions & 41 deletions cyoa/templates/wizard/presentations.html
Original file line number Diff line number Diff line change
@@ -1,50 +1,11 @@
{% extends "base.html" %}

{% block nav %}
{% include "nav.html" %}
{% endblock %}

{% block content %}
<div class="container">
<div class="row">
<div class="col-md-10">
<h1>Presentations</h1>
{% if not presentations %}
No presentations found.
<a href="{{ url_for('wizard_new_presentation') }}">Create your first one</a>.
{% else %}
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Is Active?</th>
<th>Voting number</th>
<th>Web browser voting?</th>
<th>Story choices</th>
</tr>
</thead>
<tbody>
{% for p in presentations %}
<tr>
<td><a href="{{ url_for('wizard_edit_presentation', id=p.id) }}">{{ p.name }}</a></td>
<td>{{ p.is_active }}</td>
<td>{{ p.voting_number }}</td>
<td>{{ p.enable_browser_voting }}</td>
<td><a href="{{ url_for('wizard_list_presentation_choices', pres_id=p.id) }}">Manage choices</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-md-10">
<div class="btn-top-margin">
<a href="{{ url_for('wizard_new_presentation') }}"
class="btn btn-primary">New Presentation</a>
</div>
</div>
<h1>Wizards Only Stuff Here</h1>
<a href="{{ url_for('sign_out') }}">Sign out</a>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit b2dd901

Please sign in to comment.