bugfix with quotes, added bootstrap themes

Этот коммит содержится в:
Matthew Scragg 2013-10-07 22:06:54 -05:00
родитель a79c9ad007
Коммит d30c9d71a6
18 изменённых файлов: 136 добавлений и 10 удалений

Просмотреть файл

@ -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 Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/cerulean.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/cosmo.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/cyborg.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/default.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/flatly.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/journal.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/readable.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/simplex.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/slate.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/spacelab.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

9
realms/static/css/bootstrap/united.css Обычный файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -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&gt;)", "\n>", content)
content = re.sub(r"(^&gt;)", ">", 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,