Skip to content

Commit

Permalink
rename everything to comet and add setup
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 5, 2015
1 parent fe4cb19 commit 0814762
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 10 deletions.
24 changes: 15 additions & 9 deletions COMET/__init__.py
Expand Up @@ -37,7 +37,7 @@
from flask.ext.bcrypt import Bcrypt
_site = None
app = None
TITLE = 'webapp'
TITLE = 'comet'
USERS = {}
auth_title = 'Comet CMS Login'

Expand Down Expand Up @@ -81,7 +81,7 @@ def render(template_name, context=None):
def unauthorized():
return redirect('/login?status=unauthorized')

app = Flask('webapp')
app = Flask('comet')
app.config['BCRYPT_LOG_ROUNDS'] = 12
bcrypt = Bcrypt(app)
login_manager = LoginManager()
Expand Down Expand Up @@ -183,7 +183,7 @@ def login():
elif request.args.get('status') == 'logout':
alert = 'Logged out successfully.'
alert_status = 'success'
return render('webapp_login.tmpl', {'title': 'Login', 'permalink': '/login', 'alert': alert, 'alert_status': alert_status})
return render('comet_login.tmpl', {'title': 'Login', 'permalink': '/login', 'alert': alert, 'alert_status': alert_status})

@app.route('/logout')
@login_required
Expand All @@ -194,11 +194,18 @@ def logout():
@app.route('/')
@login_required
def index():
if not os.path.exists(os.path.join(_site.config["OUTPUT_FOLDER"], 'assets')):
return redirect('/setup')
context = {}
context['site'] = _site
context['title'] = 'Posts & Pages'
context['permalink'] = '/'
return render('webapp_index.tmpl', context)
return render('comet_index.tmpl', context)

@app.route('/setup')
def setup():
needs_setup = os.path.exists(os.path.join(_site.config["OUTPUT_FOLDER"], 'assets'))
return render("comet_setup.tmpl", context={'needs_setup': needs_setup})

@app.route('/edit/<path:path>', methods=['GET', 'POST'])
@login_required
Expand All @@ -218,7 +225,7 @@ def edit(path):
context['post'] = post
context['title'] = 'Editing {0}'.format(post.title())
context['permalink'] = '/edit/' + path
return render('webapp_post_edit.tmpl', context)
return render('comet_post_edit.tmpl', context)

@app.route('/save/<path:path>', methods=['POST'])
@login_required
Expand Down Expand Up @@ -299,7 +306,7 @@ def acp_profile():
else:
alert = ''
alert_status = ''
return render('webapp_profile.tmpl',
return render('comet_profile.tmpl',
context={'title': 'Edit profile',
'permalink': '/profile',
'alert': alert,
Expand Down Expand Up @@ -334,7 +341,7 @@ def acp_users():
if not current_user.is_admin:
return "Not authorized to edit users.", 401
else:
return render('webapp_users.tmpl',
return render('comet_users.tmpl',
context={'title': 'Edit users',
'permalink': '/users',
'USERS': USERS,
Expand Down Expand Up @@ -367,7 +374,7 @@ def acp_users_edit():
else:
alert = ''
alert_status = ''
return render('webapp_users_edit.tmpl',
return render('comet_users_edit.tmpl',
context={'title': 'Edit user',
'permalink': '/users/edit',
'user': user,
Expand Down Expand Up @@ -421,7 +428,6 @@ def acp_users_delete():
write_users()
return redirect('/users?status={_del}eted'.format(_del=direction))


@app.route('/users/reload')
@login_required
def acp_users_reload():
Expand Down
3 changes: 2 additions & 1 deletion COMET/__main__.py
@@ -1,2 +1,3 @@
import COMET
COMET.main()
if __name__ == '__main__':
COMET.main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions COMET/templates/mako/comet_setup.tmpl
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Comet CMS Setup</title>
<style>
kbd {
padding: 2px 4px;
font-size: 90%;
color: #fff;
background-color: #333;
border-radius: 3px;
}

a {
text-decoration: none;
border-radius: 3px;
border-color: #ccc;
}
</style>
</head>
<body>
<h1>Comet CMS Setup</h1>
% if needs_setup:
<p>Welcome to Comet CMS!</p>
<p>In order to start using Comet CMS, you must run <kbd>nikola build</kbd> first.</p>
<p><a href="/">→ Try again</a></p>
% else
<p>Comet CMS is good to go!</p>
<p><a href="/">→ Continue</a></p>
</body>
</html>
File renamed without changes.
File renamed without changes.

0 comments on commit 0814762

Please sign in to comment.