Skip to content

Commit

Permalink
jinjify script
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 6, 2015
1 parent 2786ad7 commit 47f289f
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 59 deletions.
68 changes: 49 additions & 19 deletions COMET/templates/jinja/comet_profile.tmpl
Expand Up @@ -9,25 +9,55 @@
<div class="alert alert-{{ alert_status }}" role="alert">{{ alert }}</div>
{% endif %}

<form action="/profile/save" method="POST">
<div class="form-group">
<label for="name">Real name</label>
<input class="form-control" id="realname" name="realname" value="{{ current_user.realname }}" placeholder="Real name">
</div>
<div class="form-group">
<label for="oldpwd">Old password:</label>
<input type="password" class="form-control" id="oldpwd" name="oldpwd" placeholder="Old password">
<p class="help-block">If you do not want to change your password, leave the fields blank.</p>
</div>
<div class="form-group">
<label for="newpwd1">New password:</label>
<input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password">
</div>
<div class="form-group">
<label for="newpwd2">Repeat new password:</label>
<input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat new password">
</div>
<button type="submit" class="btn btn-default">Save</button>
<form action="/profile/save" method="POST" class="form-horizontal">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Details</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>
<div class="form-group">
<label for="oldpwd" class="col-sm-2 control-label">Old password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="oldpwd" name="oldpwd" placeholder="Old password">
<p class="help-block">If you do not want to change your password, leave the fields blank.</p></div>
</div>
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">New password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password"></div>
</div>
<div class="form-group">
<label for="newpwd2" class="col-sm-2 control-label">Repeat password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat new password"></div>
</div>
</div>
</div>


<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Preferences</h3>
</div>
<div class="panel-body">
<div class="checkbox"><label><input type="checkbox" name="wants_see_others_posts"
{% if current_user.can_see_others_posts and current_user.wants_see_others_posts %}
checked
{% endif %}
{% if not current_user.can_see_others_posts %}
disabled
{% endif %}
> Show me posts of other users
</label></div>
</div>
</div>


<div style="text-align: center;">
<button type="submit" class="btn btn-primary btn-lg"><i class="fa fa-save"></i> Save</button>
</div>
</form>

{% endblock %}
114 changes: 74 additions & 40 deletions COMET/templates/jinja/comet_users_edit.tmpl
Expand Up @@ -4,53 +4,87 @@
{% endblock %}
{% block content %}
{% if not new %}
<h1 class="title">Editing profile <tt>{{ user.username }}</tt></h1>
<h1 class="title">Editing user <tt>{{ user.username }}</tt></h1>
{% else %}
<h1 class="title">Creating profile <tt>{{ user.username }}</tt></h1>
<h1 class="title">Creating user <tt>{{ user.username }}</tt></h1>
{% endif %}

{% if alert %}
<div class="alert alert-{{ alert_status }}" role="alert">{{ alert }}</div>
{% endif %}

<form action="/users/save" method="POST">
<input name="uid" type="hidden" value="{{ user.uid }}">
<div class="form-group">
<label for="name">Real name</label>
<input class="form-control" id="realname" name="realname" value="{{ user.realname }}"
placeholder="Real name" required>
</div>
{% if user.password %}
<div class="form-group">
<label for="newpwd1">New password:</label>
<input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password">
<p class="help-block">If you do not want to change the password, leave the fields blank.</p>
</div>
<div class="form-group">
<label for="newpwd2">Repeat new password:</label>
<input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat new password">
</div>
{% else %}
<div class="form-group">
<label for="newpwd1">Password:</label>
<input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="Password" required>
</div>
<div class="form-group">
<label for="newpwd2">Repeat password:</label>
<input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat password" required>
</div>
{% endif %}
<div class="checkbox"><label>
<input type="checkbox" name="is_admin"
{% if user.is_admin %}
checked
{% endif %}
{% if user == current_user %}
disabled
{% endif %}
> Is administrator
</label></div>
<button type="submit" class="btn btn-default">Save</button>
<form action="/users/save" method="POST" class="form-horizontal">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Details</h3>
</div>
<div class="panel-body">

<input name="uid" type="hidden" value="{{ user.uid }}">
<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="{{ user.realname }}" placeholder="Real name" required></div>
</div>
{% if user.password %}
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">New password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password">
<p class="help-block">If you do not want to change the password, leave the fields blank.</p></div>
</div>
<div class="form-group">
<label for="newpwd2" class="col-sm-2 control-label">Repeat password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat password"></div>
</div>
{% else %}
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="Password" required></div>
</div>
<div class="form-group">
<label for="newpwd2" class="col-sm-2 control-label">Repeat password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat password" required></div>
</div>
{% endif %}
</div>
</div>

<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Preferences</h3>
</div>
<div class="panel-body">
<div class="checkbox"><label><input type="checkbox" name="wants_see_others_posts"
{% if user.can_see_others_posts and user.wants_see_others_posts %}
checked
{% endif %}
{% if not user.can_see_others_posts %}
disabled
{% endif %}
> Show this user posts of other users
</label></div>
</div>
</div>

<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Permissions</h3>
</div>
<div class="panel-body">
<div class="checkbox"><label><input type="checkbox" name="is_admin"
{% if user.is_admin %}
checked
{% endif %}
{% if user == current_user %}
disabled
{% endif %}
> User is an administrator
</label></div>
</div>
</div>

<div style="text-align: center;">
<button type="submit" class="btn btn-primary btn-lg"><i class="fa fa-save"></i> Save</button>
</div>
</form>

{% endblock %}

0 comments on commit 47f289f

Please sign in to comment.