bugfix with quotes, added bootstrap themes
This commit is contained in:
parent
a79c9ad007
commit
d30c9d71a6
|
@ -224,7 +224,8 @@ def create_app(subdomain=None):
|
|||
edit_cname = to_canonical(request.form['name'])
|
||||
if edit_cname != cname:
|
||||
w.rename_page(cname, edit_cname)
|
||||
w.write_page(edit_cname, request.form['content'], message=request.form['message'])
|
||||
w.write_page(edit_cname, request.form['content'], message=request.form['message'],
|
||||
username=CurrentUser.get('username'))
|
||||
return redirect("/" + edit_cname)
|
||||
else:
|
||||
if data:
|
||||
|
|
|
@ -31,6 +31,7 @@ def to_dict(cur, first=False):
|
|||
else:
|
||||
return ret
|
||||
|
||||
|
||||
def cache_it(fn):
|
||||
def wrap(*args, **kw):
|
||||
key = "%s:%s" % (args[0].table, args[1])
|
||||
|
@ -47,6 +48,7 @@ def cache_it(fn):
|
|||
return data
|
||||
else:
|
||||
data = fn(*args)
|
||||
print data
|
||||
ret = data
|
||||
if data is None:
|
||||
data = ''
|
||||
|
@ -59,6 +61,7 @@ def cache_it(fn):
|
|||
return ret
|
||||
return wrap
|
||||
|
||||
|
||||
class BaseModel(RethinkModel):
|
||||
|
||||
_conn = db
|
||||
|
@ -74,7 +77,7 @@ class BaseModel(RethinkModel):
|
|||
|
||||
@cache_it
|
||||
def get_by_id(self, id):
|
||||
return to_dict(rdb.table(self.table).get(id).run(self._conn))
|
||||
return rdb.table(self.table).get(id).run(self._conn)
|
||||
|
||||
def get_all(self, arg, index):
|
||||
return rdb.table(self.table).get_all(arg, index=index).run(self._conn)
|
||||
|
@ -96,6 +99,12 @@ class CurrentUser():
|
|||
|
||||
def __init__(self, id):
|
||||
self.id = id
|
||||
if id:
|
||||
user = User()
|
||||
session['user'] = user.get_by_id(id)
|
||||
#import sys
|
||||
#sys.exit()
|
||||
#session['user'] = to_dict(user.get_one(id, 'id'), True)
|
||||
|
||||
def get_id(self):
|
||||
return self.id
|
||||
|
@ -142,7 +151,7 @@ class User(BaseModel):
|
|||
return False
|
||||
|
||||
if bcrypt.checkpw(password, data['password']):
|
||||
cls.login(data['id'], data)
|
||||
cls.login(data['id'])
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -164,12 +173,11 @@ class User(BaseModel):
|
|||
password=bcrypt.hashpw(password, bcrypt.gensalt(10)),
|
||||
avatar=gravatar_url(email))
|
||||
|
||||
User.login(u.id, to_dict(user.get_one(u.id, 'id')))
|
||||
User.login(u.id)
|
||||
|
||||
@classmethod
|
||||
def login(cls, id, data=None):
|
||||
login_user(CurrentUser(id), True)
|
||||
session['user'] = data
|
||||
|
||||
@classmethod
|
||||
def logout(cls):
|
||||
|
|
9
realms/static/css/bootstrap/amelia.css
Normal file
9
realms/static/css/bootstrap/amelia.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/cerulean.css
Normal file
9
realms/static/css/bootstrap/cerulean.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/cosmo.css
Normal file
9
realms/static/css/bootstrap/cosmo.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/cyborg.css
Normal file
9
realms/static/css/bootstrap/cyborg.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/default.css
Normal file
9
realms/static/css/bootstrap/default.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/flatly.css
Normal file
9
realms/static/css/bootstrap/flatly.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/journal.css
Normal file
9
realms/static/css/bootstrap/journal.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/readable.css
Normal file
9
realms/static/css/bootstrap/readable.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/simplex.css
Normal file
9
realms/static/css/bootstrap/simplex.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/slate.css
Normal file
9
realms/static/css/bootstrap/slate.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/spacelab.css
Normal file
9
realms/static/css/bootstrap/spacelab.css
Normal file
File diff suppressed because one or more lines are too long
9
realms/static/css/bootstrap/united.css
Normal file
9
realms/static/css/bootstrap/united.css
Normal file
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,11 @@ body {
|
|||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.navbar-nav>li>a:hover {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
#main-body {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class="form-group">
|
||||
<label for="wiki" class="control-label">Site Name</label>
|
||||
<div class="input-group">
|
||||
<input id="wiki" name="name" type="text" class="form-control" value="{{ request.args.get('site') }}" />
|
||||
<input id="wiki" name="name" type="text" class="form-control" value="{{ request.args.get('site', '') }}" />
|
||||
<span class="input-group-addon">.realms.io</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -16,6 +16,4 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<title>Realms</title>
|
||||
|
||||
<link href="/static/css/cerulean.bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/bootstrap/spacelab.css" rel="stylesheet">
|
||||
<link href="/static/css/font-awesome.min.css" rel="stylesheet">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
|||
<li><a href="/_new/">Create New Wiki</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
{% if session.get('user') %}
|
||||
<li class="dropdown user-avatar">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import re
|
||||
from lxml.html.clean import clean_html
|
||||
import ghdiff
|
||||
|
||||
|
@ -70,6 +71,9 @@ class Wiki():
|
|||
# adding the div wrapper apparently fixes anomalies with the lxml parser with certain markdown
|
||||
content = clean_html('<div>' + content + '</div>')
|
||||
content = content[5:-6]
|
||||
content = re.sub(r"(\n>)", "\n>", content)
|
||||
content = re.sub(r"(^>)", ">", content)
|
||||
|
||||
filename = self.cname_to_filename(to_canonical(name))
|
||||
f = open(self.path + "/" + filename, 'w')
|
||||
f.write(content)
|
||||
|
@ -83,8 +87,9 @@ class Wiki():
|
|||
|
||||
if not username:
|
||||
username = self.default_committer_name
|
||||
email = "%s@domain.com" % username
|
||||
|
||||
if not email:
|
||||
email = "%s@realms.io" % username
|
||||
|
||||
return self.repo.commit(name=username,
|
||||
email=email,
|
||||
|
|
Loading…
Reference in a new issue