예제 #1
0
def story(title):
	Stories = mongo.returnAllTitles()
	lines = mongo.getLines(title)
	if request.method == 'POST':
		button = request.form['button']
		if button == 'Back':
			return redirect(url_for('home', Stories = Stories))
		if button == 'Add Line':
			line = request.form["line"]
			mongo.addline(title,line)
			lines = mongo.getLines(title)
			print lines
			return render_template('story.html', title = title, lines = lines)
	else:
		return render_template('story.html', title = title, lines = lines)				
def view():
    if request.method == "GET":
        story = session['storyToView']
        return render_template("view.html", story=story, lines = mongo.getLines(story))
    elif request.form['button'] == "Home":
        session['storyToView'] = ""
        return redirect(url_for("home"))
    elif request.form['button'] == "Add Line":
        mongo.addLine(session['storyToView'], request.form["newLine"])
        return redirect(url_for("view"))
예제 #3
0
def home():
	Stories = mongo.returnAllTitles()
	if request.method == 'POST':
		title = request.form['title']	
		button = request.form['button']
		if button == 'Continue':
			title = request.form['story']
			lines = mongo.getLines(title)
			return redirect(url_for('story', title = title, lines = lines))
		if button == 'Create':
			mongo.addStory(title)
			Stories = mongo.returnAllTitles()
		        return render_template("home.html", Stories = Stories)
		if button == 'Remove Stories':
			mongo.removeAll()
			Stories = mongo.returnAllTitles()
			return render_template("home.html", Stories = Stories)
	else:
		return render_template('home.html', Stories = Stories)