Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getnikola/coil
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9341eeeb5306
Choose a base ref
...
head repository: getnikola/coil
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fd94aa80402f
Choose a head ref
  • 2 commits
  • 10 files changed
  • 1 contributor

Commits on Jan 12, 2015

  1. #24a — support 2-file posts

    Signed-off-by: Chris Warrick <kwpolska@gmail.com>
    Kwpolska committed Jan 12, 2015
    Copy the full SHA
    54a0113 View commit details
  2. update templates

    Signed-off-by: Chris Warrick <kwpolska@gmail.com>
    Kwpolska committed Jan 12, 2015
    Copy the full SHA
    fd94aa8 View commit details
8 changes: 6 additions & 2 deletions comet/data/templates/jinja/comet_account.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block extra_js %}
{% if action == 'save' %}
@@ -21,10 +22,13 @@
<h3 class="panel-title">Profile</h3>
</div>
<div class="panel-body">

<div class="form-group">
<label for="name" class="col-sm-2 control-label">Real name</label>
<div class="col-sm-10"><input class="form-control" id="realname" name="realname" value="{{ current_user.realname }}" placeholder="Real name"></div>
<div class="col-sm-10"><input class="form-control" id="realname" name="realname" value="{{ current_user.realname }}" placeholder="Real name" required></div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">E-mail address</label>
<div class="col-sm-10"><input class="form-control" id="email" name="email" type="email" value="{{ current_user.email }}" placeholder="E-mail address" required></div>
</div>
<div class="form-group">
<label for="oldpwd" class="col-sm-2 control-label">Old password</label>
1 change: 1 addition & 0 deletions comet/data/templates/jinja/comet_error.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block extra_head %}
{% endblock %}
1 change: 1 addition & 0 deletions comet/data/templates/jinja/comet_index.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block extra_js %}
<script>
1 change: 1 addition & 0 deletions comet/data/templates/jinja/comet_login.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block content %}
{% if alert %}
9 changes: 8 additions & 1 deletion comet/data/templates/jinja/comet_post_edit.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block extra_js %}
{% if action == 'save' %}
@@ -45,6 +46,7 @@
<div id="toolbar" class="btn-toolbar">
<div class="btn-group"><button type="submit" class="btn btn-sm btn-primary save-btn"><i class="fa fa-save fa-fw save-icon"></i> Save</button></div>

{% if is_html %}
<div class="btn-group">
<a class="btn btn-default btn-sm" data-wysihtml5-command="bold" title="CTRL+B"><i class="fa fa-bold"></i></a>
<a class="btn btn-default btn-sm" data-wysihtml5-command="italic" title="CTRL+I"><i class="fa fa-italic"></i></a>
@@ -96,10 +98,14 @@
</select>
</label>
</div>
</div>
{% else %}
<div class="btn-group btn btn-sm disabled markup-warning text-warning"><i class="fa fa-warning"></i> Format: <strong>{{ post.compiler.name }}</strong> — editor unavailable</div>
{% endif %}
</div>

<textarea name="content" id="content-area" class="form-control" rows="24">{{ post_content }}</textarea>
</form>
{% if is_html %}
<script src="/bower_components/wysihtml/dist/wysihtml5x-toolbar.min.js"></script>
<script src="/bower_components/wysihtml/parser_rules/advanced_and_extended.js"></script>
<script type="text/javascript">
@@ -109,4 +115,5 @@
stylesheets: ['/comet_assets/css/wysihtml5x.css']
});
</script>
{% endif %}
{% endblock %}
18 changes: 11 additions & 7 deletions comet/data/templates/jinja/comet_users.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block extra_js %}
{% if action == 'save' %}
@@ -43,6 +44,7 @@ $('#deleteModal').on('show.bs.modal', function (event) {
<th class="uid">#</th>
<th class="username">Username</th>
<th class="realname">Real name</th>
<th class="email">E-mail address</th>
<th class="is_admin">Admin</th>
<th class="actions">Actions</th>
</tr></thead>
@@ -55,6 +57,7 @@ $('#deleteModal').on('show.bs.modal', function (event) {
<td class="uid">{{ uid }}</td>
<td class="username">{{ user.username }}</td>
<td class="realname">{{ user.realname }}</td>
<td class="email">{{ user.email }}</td>
<td class="actions">
{% if user.is_admin %}
<i class="fa fa-check"></i>
@@ -68,15 +71,15 @@ $('#deleteModal').on('show.bs.modal', function (event) {
<input type="hidden" name="action" value="edit">
<div class="btn-group" role="group">
{% if user.active %}
<button type="submit" class="btn btn-info" title="Edit"><i class="fa fa-pencil fa-fw"></i> Edit</button>
{% if user == current_user %}
<button type="button" class="btn btn-danger" title="Delete" disabled><i class="fa fa-trash fa-fw"></i> Delete</button>
<button type="submit" class="btn btn-sm btn-info" title="Edit"><i class="fa fa-pencil fa-fw"></i> Edit</button>
{% if user.uid == current_user.uid %}
<button type="button" class="btn btn-sm btn-danger" title="Delete" disabled><i class="fa fa-trash fa-fw"></i> Delete</button>
{% else %}
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="del" title="Delete"><i class="fa fa-trash fa-fw"></i> Delete</button>
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="del" title="Delete"><i class="fa fa-trash fa-fw"></i> Delete</button>
{% endif %}
{% else %}
<button type="button" class="btn btn-info" title="Edit" disabled><i class="fa fa-pencil fa-fw"></i> Edit</button>
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="undel" title="Undelete"><i class="fa fa-trash-o fa-fw"></i> Undelete</button>
<button type="button" class="btn btn-sm btn-info" title="Edit" disabled><i class="fa fa-pencil fa-fw"></i> Edit</button>
<button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="undel" title="Undelete"><i class="fa fa-trash-o fa-fw"></i> Undelete</button>
{% endif %}
</div>
</form>
@@ -87,7 +90,8 @@ $('#deleteModal').on('show.bs.modal', function (event) {
<td><input name="username" placeholder="New user" class="form-control"></td>
<td><input name="action" value="new" type="hidden"></td>
<td></td>
<td><button type="submit" class="btn btn-primary"><i class="fa fa-plus-square fa-fw"></i> Create</button></td>
<td></td>
<td><button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-plus-square fa-fw"></i> Create</button></td>
</form></tr>
</table>

7 changes: 6 additions & 1 deletion comet/data/templates/jinja/comet_users_edit.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block extra_js %}
{% if action == 'save' %}
@@ -36,6 +37,10 @@
<label for="name" class="col-sm-2 control-label">Real name</label>
<div class="col-sm-10"><input class="form-control" id="realname" name="realname" value="{{ user.realname }}" placeholder="Real name" required></div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">E-mail address</label>
<div class="col-sm-10"><input class="form-control" id="email" name="email" type="email" value="{{ user.email }}" placeholder="E-mail address" required></div>
</div>
{% if user.password %}
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">New password</label>
@@ -85,7 +90,7 @@
{% if user.is_admin %}
checked
{% endif %}
{% if user == current_user %}
{% if user.uid == current_user.uid %}
disabled
{% endif %}
> User is an administrator
7 changes: 5 additions & 2 deletions comet/data/templates/jinja/comet_users_permissions.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block extra_js %}
<script>
@@ -11,14 +12,16 @@ $(document).ready(function() {

for (var i = 0; i < PERMISSIONS.length; i++) {
var p = PERMISSIONS[i];
// .active is significant in Bootstrap, so we're changing the name here
if (p == 'active') { p = 'is_active'; }
$('th.' + p + ' button.select_all-perm').click(function() {
p = this.attributes['data-perm'].value;
$('.' + p + ' input').each(function() { this.checked = true; });
});
$('th.' + p + ' button.select_none-perm').click(function() {
p = this.attributes['data-perm'].value;
$('.' + p + ' input').each(function() {
if (p != 'is_admin' || this.attributes['data-uid'].value != {{ current_user.uid }}) {
if ((p != 'is_admin' && p != 'is_active') || this.attributes['data-uid'].value != {{ current_user.uid }}) {
this.checked = false;
}
});
@@ -34,7 +37,7 @@ $(document).ready(function() {
$('.u' + uid + ' button.select_none-user').click(function() {
uid = this.attributes['data-uid'].value;
$('input.u' + uid).each(function() {
if (uid != current_uid || this.attributes['data-perm'].value != 'is_admin') { this.checked = false; }
if (uid != current_uid || ((this.attributes['data-perm'].value != 'is_admin') && (this.attributes['data-perm'].value != 'is_active'))) { this.checked = false; }
});
});
}
6 changes: 3 additions & 3 deletions comet/data/templates/mako/comet_users.tmpl
Original file line number Diff line number Diff line change
@@ -20,12 +20,12 @@ $('#deleteModal').on('show.bs.modal', function (event) {
modal.find('.del-noun').text('deletion');
modal.find('.del-verb').text('delete');
modal.find('.del-verb-capital').text('Delete');
modal.find('.del-verb-capital').addClass('btn btn-sm-danger');
modal.find('.del-verb-capital').addClass('btn-danger');
} else {
modal.find('.del-noun').text('undeletion');
modal.find('.del-verb').text('undelete');
modal.find('.del-verb-capital').text('Undelete');
modal.find('.del-verb-capital').addClass('btn btn-sm-success');
modal.find('.del-verb-capital').addClass('btn-success');
}
});
</script>
@@ -109,7 +109,7 @@ $('#deleteModal').on('show.bs.modal', function (event) {
<form method="POST" action="/users/delete" class="delete-button">
<input type="hidden" name="uid" class="del-uid">
<input type="hidden" name="direction" class="del-direction">
<button type="button" class="btn btn btn-sm-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn del-verb-capital">Delete</button>
</div>
</div>
17 changes: 13 additions & 4 deletions comet/web.py
Original file line number Diff line number Diff line change
@@ -482,7 +482,7 @@ def index():
wants = wants_now

if current_user.can_edit_all_posts and wants:
posts = site.posts
posts = site.all_posts
pages = site.pages
else:
wants = False
@@ -492,7 +492,7 @@ def index():
if (p.meta('author.uid')
and p.meta('author.uid') != str(current_user.uid)):
continue
if p.use_in_feeds:
if p.is_post:
posts.append(p)
else:
pages.append(p)
@@ -543,16 +543,25 @@ def edit(path):
or not author_change_success):
meta['author'] = post.meta('author') or current_user.realname
meta['author.uid'] = post.meta('author.uid') or current_user.uid
post.compiler.create_post(post.source_path, onefile=True,

twofile = post.is_two_file
onefile = not twofile
post.compiler.create_post(post.source_path, onefile=onefile,
is_page=False, **meta)
if twofile:
meta_path = os.path.splitext(path)[0] + '.meta'
with io.open(meta_path, 'w+', encoding='utf-8') as fh:
fh.write(nikola.utils.write_metadata(meta))
scan_site()
post = find_post(path)
context['action'] = 'save'
context['post_content'] = meta['content']
else:
context['action'] = 'edit'
with io.open(path, 'r', encoding='utf-8') as fh:
context['post_content'] = fh.read().split('\n\n', 1)[1]
context['post_content'] = fh.read()
if not post.is_two_file:
context['post_content'] = context['post_content'].split('\n\n', 1)[1]

context['post'] = post
users = []