Skip to content
This repository has been archived by the owner on Mar 27, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
SectionEditor now saves to the database on save
  • Loading branch information
obmarg committed May 31, 2012
1 parent f2d5745 commit b2bd8b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion coffeescript/views/sectionEditor.coffee
Expand Up @@ -19,7 +19,7 @@ define(
@editor.run()

doSave: ->
@model.set( 'content', $( '#wmd-input' ).val() )
@model.save( content: $( '#wmd-input' ).val() )
# TODO: Move back to index?

doCancel: ->
Expand Down
20 changes: 18 additions & 2 deletions resumr.py
@@ -1,6 +1,6 @@
import json
from flask import Flask, render_template
from db import Document
from flask import Flask, render_template, abort, request, g
from db import Document, SectionNotFound

app = Flask(__name__)

Expand All @@ -27,5 +27,21 @@ def ListSections():
# returning lists
return json.dumps( sections )

@app.route('/api/sections/<name>', methods=['PUT'])
def UpdateSection(name):
'''
Updates a sections contents
Args:
name The name of the section to find
'''
d = GetDoc()
try:
section = d.FindSection( name )
section.SetContent( request.json[ 'content' ] )
except SectionNotFound:
abort(404)
return "OK"

if __name__ == "__main__":
app.run()

0 comments on commit b2bd8b8

Please sign in to comment.