Skip to content

Commit

Permalink
クリック編集画面の実装
Browse files Browse the repository at this point in the history
  • Loading branch information
kzfm committed Mar 3, 2013
1 parent 19c59fa commit cbe66d6
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app.py
Expand Up @@ -42,5 +42,13 @@ def post_content(title=None):
db_session.commit()
return content.html


@app.route("/rst/<title>")
def show_rst(title):
content = WikiContent.query.filter_by(title=title).first()
if content is None:
abort(404)
return content.body

if __name__ == "__main__":
app.run()
38 changes: 38 additions & 0 deletions static/jquery.jeditable.mini.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion templates/show_content.html
@@ -1,6 +1,20 @@
{% extends "layout.html" %}
{% block body %}
<h1>{{content.title}}</h1>
<div>{{content.html|safe}}</div>
<div class="editable_textarea">{{content.html|safe}}</div>
<p>{{content.date}}</p>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="{{url_for('static', filename='jquery.jeditable.mini.js')}}"></script>
<script>
$(".editable_textarea").editable("{{content.title}}", {
type : 'textarea',
submitdata: { _method: "post" },
name : 'body',
loadurl : '/rst/' + '{{content.title}}',
rows : 10,
submit : 'OK',
cancel : 'cancel',
cssclass : "editable"
});
</script>
{% endblock %}

0 comments on commit cbe66d6

Please sign in to comment.