def storypage(): if request.method=='GET': lines = db.getLines(title) return render_template("storypage.html", title = title, lines = lines) if request.method=='POST': if request.form["button"] == "Save": line = str(request.form["newLine"]) db.addLine(title, line) lines = db.getLines(title) return render_template("storypage.html", title = title, lines = lines) if request.form["button"] == "Home": return redirect(url_for("storynatorHome"))
def story(s="default story"): db.auth() if request.method=='GET': lines=db.getLines(s) print lines return render_template("story.html",lines=lines,title=s) else: button=request.form['button'] if button=="Add": nline=str(request.form.get("line","")) #print nline if len(nline)>0: db.add_line(s, nline) #print "test" #lines=db.getLines(s) return redirect(url_for('story', s=s)) elif button=="Back": return redirect(url_for("home")) lines=db.getLines(s) return render_template("story.html",lines=lines,title=s)
def storynatorHome(): global title if request.method=='GET': return render_template("storynatorHome.html", titles = db.getStories()) if request.method=='POST': if request.form["button"]=="Select": title = str(request.form["storyPicked"]) lines = db.getLines(title) #return render_template("storypage.html", title = title, lines = lines) return redirect(url_for("storypage")) if request.form["button"]=="Drop": db.dropStory(str(request.form["storyPicked"])) return render_template("storynatorHome.html", titles = db.getStories()) if request.form["button"]=="Create": db.addStory(str(request.form["newTitle"])) return render_template("storynatorHome.html", titles = db.getStories())