Commit 4a1fae7fbdc5943b5a12615632ccb9aa41630706
- server.py 61 --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/css/main.css 60 ---------------+++++++++++++++++++++++++++++++++++++++++++++
- static/img/glyphicons-halflings-white.png 0
- static/img/glyphicons-halflings.png 0
- static/js/editor.js 346 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/backbone-1.0.0.js 1571 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/jquery.tinymce.min.js 1 +
- static/js/lib/tinymce/langs/readme.md 1 +
- static/js/lib/tinymce/license.txt 504 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/plugins/advlist/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/anchor/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/autolink/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/autoresize/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/autosave/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/bbcode/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/charmap/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/code/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/compat3x/editable_selects.js 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/plugins/compat3x/form_utils.js 210 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/plugins/compat3x/mctabs.js 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/plugins/compat3x/tiny_mce_popup.js 435 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/plugins/compat3x/validate.js 252 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/plugins/contextmenu/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/directionality/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/emoticons/img/smiley-cool.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-cry.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-embarassed.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-frown.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-innocent.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-kiss.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-laughing.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-money-mouth.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-sealed.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-smile.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-surprised.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-tongue-out.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-undecided.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-wink.gif 0
- static/js/lib/tinymce/plugins/emoticons/img/smiley-yell.gif 0
- static/js/lib/tinymce/plugins/emoticons/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/example/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/example_dependency/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/fullpage/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/fullscreen/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/hr/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/image/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/insertdatetime/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/layer/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/legacyoutput/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/link/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/lists/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/media/moxieplayer.swf 0
- static/js/lib/tinymce/plugins/media/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/nonbreaking/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/noneditable/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/pagebreak/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/paste/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/preview/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/print/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/save/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/searchreplace/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/spellchecker/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/tabfocus/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/table/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/template/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/textcolor/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/visualblocks/css/visualblocks.css 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/plugins/visualblocks/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/visualchars/plugin.min.js 1 +
- static/js/lib/tinymce/plugins/wordcount/plugin.min.js 1 +
- static/js/lib/tinymce/skins/lightgray/content.min.css 1 +
- static/js/lib/tinymce/skins/lightgray/fonts/icomoon.eot 0
- static/js/lib/tinymce/skins/lightgray/fonts/icomoon.svg 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/lib/tinymce/skins/lightgray/fonts/icomoon.ttf 0
- static/js/lib/tinymce/skins/lightgray/fonts/icomoon.woff 0
- static/js/lib/tinymce/skins/lightgray/fonts/readme.md 1 +
- static/js/lib/tinymce/skins/lightgray/img/anchor.gif 0
- static/js/lib/tinymce/skins/lightgray/img/loader.gif 0
- static/js/lib/tinymce/skins/lightgray/img/object.gif 0
- static/js/lib/tinymce/skins/lightgray/img/trans.gif 0
- static/js/lib/tinymce/skins/lightgray/img/wline.gif 0
- static/js/lib/tinymce/skins/lightgray/skin.classic.min.css 1 +
- static/js/lib/tinymce/skins/lightgray/skin.ie7.min.css 1 +
- static/js/lib/tinymce/skins/lightgray/skin.min.css 1 +
- static/js/lib/tinymce/themes/modern/theme.min.js 1 +
- static/js/lib/tinymce/tinymce.min.js 9 +++++++++
- static/js/models.js 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- static/js/mouchak.js 336 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+++++++++++++++++++++++++++++++
- static/js/views.js 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- templates/editor.html 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- templates/index.html 7 --+++++
- Diff rendering mode:
- inline
- side by side
server.py
1 | #!/usr/bin/python | 1 | #!/usr/bin/python |
---|---|---|---|
2 | 2 | # Mouchak Server - | |
3 | # A Flask Application (http://flask.pocoo.org/) | ||
4 | |||
3 | import flask | 5 | import flask |
6 | import pymongo | ||
7 | import bson | ||
4 | 8 | ||
5 | app = flask.Flask(__name__) | 9 | app = flask.Flask(__name__) |
6 | 10 | ||
11 | dbClient = pymongo.MongoClient() | ||
12 | db = dbClient['mouchak'] | ||
13 | collection = db['content'] | ||
14 | # handy reference to otherwise long name | ||
15 | bson.ObjId = bson.objectid.ObjectId | ||
16 | |||
17 | def getContent(): | ||
18 | content = [] | ||
19 | for i in collection.find(): | ||
20 | objId = bson.ObjId(i['_id']) | ||
21 | del(i['_id']) | ||
22 | i['id'] = str(objId) | ||
23 | content.append(i) | ||
24 | return content | ||
25 | |||
26 | |||
7 | @app.route('/', methods=['GET']) | 27 | @app.route('/', methods=['GET']) |
8 | def index(): | 28 | def index(): |
9 | 29 | return flask.render_template('index.html', content=getContent()) | |
30 | |||
31 | |||
32 | @app.route('/edit', methods=['GET', 'POST']) | ||
33 | def edit(): | ||
34 | if flask.request.method == 'GET': | ||
35 | return flask.render_template('editor.html', content=getContent()) | ||
36 | |||
37 | elif flask.request.method == 'POST': | ||
38 | newpage = flask.request.json | ||
39 | print newpage | ||
40 | res = collection.insert(newpage) | ||
41 | print res | ||
42 | return flask.jsonify(status='success')#, content=getContent()) | ||
43 | |||
44 | |||
45 | @app.route('/edit/<_id>', methods=['PUT', 'DELETE']) | ||
46 | def editPage(_id): | ||
47 | if flask.request.method == 'PUT': | ||
48 | changedPage = flask.request.json | ||
49 | print changedPage | ||
50 | res = collection.update({'_id' : bson.ObjId(_id)}, | ||
51 | changedPage) | ||
52 | print res | ||
53 | #print collection.find({'name': changed['name']}) | ||
54 | #for i in collection.find({'name': changed['name']}): | ||
55 | #print i | ||
56 | return flask.jsonify(status='success')#, content=getContent()) | ||
57 | |||
58 | elif flask.request.method == 'DELETE': | ||
59 | delPage = flask.request.url | ||
60 | print delPage | ||
61 | print _id | ||
62 | res = collection.remove({'_id': bson.ObjId(_id)}) | ||
63 | print res | ||
64 | return flask.jsonify(status='success', msg='removed') | ||
65 | |||
10 | 66 | ||
11 | if __name__ == "__main__": | 67 | if __name__ == "__main__": |
12 | app.run(debug=True, host='0.0.0.0') | 68 | app.run(debug=True, host='0.0.0.0') |
static/css/main.css
93 | Author's custom styles | 93 | Author's custom styles |
---|---|---|---|
94 | ========================================================================== */ | 94 | ========================================================================== */ |
95 | 95 | ||
96 | |||
97 | |||
98 | |||
99 | |||
100 | |||
101 | |||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | |||
110 | 96 | .page { | |
97 | border: 1px solid #999; | ||
98 | padding: 20px; | ||
99 | width: 400px; | ||
100 | height: 400px; | ||
101 | } | ||
102 | #pages { | ||
103 | position: absolute; | ||
104 | left: 20px; | ||
105 | top: 20px; | ||
106 | border: 1px solid black; | ||
107 | padding: 10px; | ||
108 | width: 300px; | ||
109 | height: 80%; | ||
110 | } | ||
111 | #page { | ||
112 | position: absolute; | ||
113 | left: 500px; | ||
114 | top: 90px; | ||
115 | } | ||
116 | #pagelist { | ||
117 | padding: 10px; | ||
118 | } | ||
119 | #content { | ||
120 | padding: 10px; | ||
121 | margin: 3px; | ||
122 | margin-bottom: 10px; | ||
123 | max-height: 120px; | ||
124 | overflow-y: auto; | ||
125 | } | ||
126 | .content-item:hover { | ||
127 | cursor: pointer; | ||
128 | cursor: hand; | ||
129 | } | ||
130 | #contentview { | ||
131 | border: 1px solid #999; | ||
132 | padding: 10px; | ||
133 | margin: 10px; | ||
134 | } | ||
135 | .contentview { | ||
136 | } | ||
137 | #specific-content { | ||
138 | padding: 3px; | ||
139 | margin-bottom: 10px; | ||
140 | } | ||
111 | 141 | ||
112 | /* ========================================================================== | 142 | /* ========================================================================== |
113 | Helper classes | 143 | Helper classes |
static/img/glyphicons-halflings-white.png
1 | PNG | ||
---|---|---|---|
2 | |||
3 |