[odrs-web] Make the per-review page nicer on the eye
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web] Make the per-review page nicer on the eye
- Date: Wed, 3 Jul 2019 13:37:09 +0000 (UTC)
commit 0fc53c5033eae2af4742cf78821dd1a40ce84e18
Author: Richard Hughes <richard hughsie com>
Date: Wed Jul 3 14:13:51 2019 +0100
Make the per-review page nicer on the eye
app_data/odrs/static/style.css | 9 ++
app_data/odrs/templates/show.html | 263 +++++++++++++++-----------------------
app_data/odrs/views_admin.py | 5 +-
3 files changed, 114 insertions(+), 163 deletions(-)
---
diff --git a/app_data/odrs/static/style.css b/app_data/odrs/static/style.css
index 723a655..906538c 100644
--- a/app_data/odrs/static/style.css
+++ b/app_data/odrs/static/style.css
@@ -38,3 +38,12 @@ td {
.form .form-control {
padding: 3px 12px;
}
+
+.table-borderless > tbody > tr > td,
+.table-borderless > tbody > tr > th,
+.table-borderless > tfoot > tr > td,
+.table-borderless > tfoot > tr > th,
+.table-borderless > thead > tr > td,
+.table-borderless > thead > tr > th {
+ border: none;
+}
diff --git a/app_data/odrs/templates/show.html b/app_data/odrs/templates/show.html
index 5cff6c4..5ef094f 100644
--- a/app_data/odrs/templates/show.html
+++ b/app_data/odrs/templates/show.html
@@ -3,179 +3,122 @@
{% block content %}
-<ul class="pagination">
- <li><a href="{{url_for('.admin_show_review', review_id=r.review_id - 1)}}"><<</a></li>
- <li><a href="{{url_for('.admin_show_review', review_id=r.review_id + 1)}}">>></a></li>
-</ul>
-
<form class="form" name="myform" action="{{url_for('admin_modify', review_id=r.review_id)}}" method="POST">
-{% if current_user.is_authenticated %}
-<div class="row form-group">
- <div class="col-sm-1">
- <strong>Actions</strong>
- </div>
- <div class="col-sm-11">
+<div class="card">
+ <div class="card-body">
+ <h1 class="card-title">
+ {{r.app_id}}
+ <a class="btn pull-right" href="{{url_for('.admin_show_app', app_id=r.app_id)}}">All</a>
+ </h1>
+ <table class="table card-text table-borderless table-condensed">
+ <tr class="row">
+ <th class="col col-md-2">Rating</th>
+ <td class="col col-md-7">
+ {{format_rating(r.rating)}}
+ ({{r.karma_up}}↑, {{r.karma_down}}↓)
+ </td>
+ <td class="col-md-1">
{% if current_user.user.user_hash and not vote_exists %}
- <a href="{{url_for('.admin_vote', review_id=r.review_id, val_str='up')}}">
- <button class="btn btn-action" type="button">Vote Up</button>
- </a>
- <a href="{{url_for('.admin_vote', review_id=r.review_id, val_str='down')}}">
- <button class="btn btn-action" type="button">Vote Down</button>
- </a>
- <a href="{{url_for('.admin_vote', review_id=r.review_id, val_str='meh')}}">
- <button class="btn btn-action" type="button">Meh</button>
- </a>
-{% endif %}
- <a href="{{url_for('.admin_delete', review_id=r.review_id)}}">
- <button class="btn btn-danger" type="button">Remove Forever</button>
- </a>
- </div>
-</div>
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_vote', review_id=r.review_id,
val_str='up')}}">Vote ↑</a>
{% endif %}
-<div class="row form-group">
- <div class="col-sm-1">
- <strong>Application</strong>
- </div>
- <div class="col-sm-11">
- <div class="input-group col-xs-12">
- <textarea class="form-control" rows="1" name="app_id">{{r.app_id}}</textarea>
-{% if current_user.is_authenticated %}
- <span class="input-group-addon btn btn-action">
- <a href="{{url_for('.admin_show_app', app_id=r.app_id)}}">All</a>
- </span>
+ </td>
+ <td class="col-md-1">
+{% if current_user.user.user_hash and not vote_exists %}
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_vote', review_id=r.review_id,
val_str='down')}}">Vote ↓</a>
{% endif %}
- </div>
- </div>
-</div>
-<div class="row form-group">
- <div class="col-sm-1">
- <strong>Rating</strong>
- </div>
- <div class="col-sm-1">
- {{format_rating(r.rating)}}
- </div>
- <div class="col-sm-1">
- <strong>Karma</strong>
- </div>
- <div class="col-sm-3">
- {{r.karma_up}}↑, {{r.karma_down}}↓
+ </td>
+ </tr>
{% if r.reported > 0 %}
- (reported {{r.reported}})
-{% if current_user.is_authenticated %}
- <a href="{{url_for('.admin_unreport', review_id=r.review_id)}}">
- <button class="btn btn-action" type="button">Unreport</button>
- </a>
-{% endif %}
-{% endif %}
- </div>
- <div class="col-sm-1">
- <strong>Created</strong>
- </div>
- <div class="col-sm-5">
- {{r.date_created}}
+ <tr class="row">
+ <th class="col">Reported</th>
+ <td class="col">
+ {{r.reported}}
+ <td class="col" colspan="2">
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_unreport',
review_id=r.review_id)}}">Unreport</a>
+ </td>
+ </tr>
+{% endif %}
+ <tr class="row">
+ <th class="col">Created</th>
+ <td class="col">
+ {{r.date_created}}
{% if r.date_deleted %}
- (deleted {{r.date_deleted}})
-{% if current_user.is_authenticated %}
- <a href="{{url_for('.admin_unremove', review_id=r.review_id)}}">
- <button class="btn btn-action" type="button">Unremove</button>
- </a>
+ ({{r.date_deleted}})
{% endif %}
+ </td>
+ <td class="col" colspan="2">
+{% if r.date_deleted %}
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_unremove',
review_id=r.review_id)}}">Unremove</a>
{% endif %}
- </div>
-</div>
-<div class="row form-group">
- <div class="col-sm-1">
- <strong>User Display</strong>
- </div>
- <div class="col-sm-11">
+ </td>
+ </tr>
{% if r.user_display %}
-{% if current_user.is_authenticated %}
- <span class="help-block"><em>Names cannot be offensive or trademarks</em></span>
-{% endif %}
- <div class="input-group col-xs-12">
- <textarea class="form-control" rows="1" name="user_display">{{r.user_display}}</textarea>
-{% if current_user.is_authenticated %}
- <span class="input-group-addon btn btn-action">
- <a href="{{url_for('.admin_anonify',
review_id=r.review_id)}}/admin/anonify/{{r.review_id}}">Anonify</a>
- </span>
-{% endif %}
-{% else %}
- <textarea class="form-control" rows="1" name="user_display"></textarea>
-{% endif %}
-{% if current_user.is_authenticated %}
- <span class="input-group-addon btn btn-action">
- <a href="{{url_for('.admin_show_user', user_hash=r.user.user_hash)}}">All</a>
- </span>
- <span class="input-group-addon btn btn-action">
- <a href="{{url_for('.admin_user_ban', user_hash=r.user.user_hash)}}">Ban</a>
- </span>
-{% endif %}
- </div>
+ <tr class="row">
+ <th class="col">User Display</th>
+ <td class="col">
+ <input type="text" class="form-control" rows="1" name="user_display" value="{{r.user_display}}"/>
+ </td>
+ <td class="col">
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_anonify',
review_id=r.review_id)}}">Anonify</a>
+ </td>
+ <td class="col">
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_show_user',
user_hash=r.user.user_hash)}}">Show All</a>
+ </td>
+ </tr>
+{% endif %}
+ <tr class="row">
+ <th class="col">Locale</th>
+ <td class="col">
+ <input type="text" class="form-control" rows="1" name="locale" value="{{r.locale}}"/>
+ </td>
+ <td class="col">
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_show_lang', locale=r.locale)}}">All</a>
+ </td>
+ <td class="col">
+ <a class="btn btn-action btn-block" href="{{url_for('.admin_englishify',
review_id=r.review_id)}}">Englishify</a>
+ </td>
+ </tr>
+ <tr class="row">
+ <th class="col">Version</th>
+ <td class="col" colspan="3">
+ <input type="text" class="form-control" rows="1" name="version" value="{{r.version}}"/>
+ </td>
+ <td class="col"></td>
+ </tr>
+ <tr class="row">
+ <th class="col">Distro</th>
+ <td class="col" colspan="3">
+ <input type="text" class="form-control" rows="1" name="distro" value="{{r.distro}}"/>
+ </td>
+ <td class="col"></td>
+ </tr>
+ <tr class="row">
+ <th class="col">Summary</th>
+ <td class="col" colspan="3">
+ <input type="text" class="form-control" rows="1" name="summary" value="{{r.summary}}"/>
+ </td>
+ <td class="col"></td>
+ </tr>
+ <tr class="row">
+ <th class="col">Description</th>
+ <td class="col" colspan="3">
+ <textarea class="form-control" rows="4" name="description">{{r.description}}</textarea>
+ <span class="help-block"><em>
+ This should start with a capital letter and each sentance should end with a full stop.
+ Please remove any incorrect content, and correct spelling, and grammar where required.
+ </em></span>
+ </td>
+ </tr>
+ </table>
+ <a class="card-link btn btn-action" type="submit">Modify</a>
+ <a class="card-link btn btn-danger pull-right" href="{{url_for('.admin_user_ban',
user_hash=r.user.user_hash)}}">Ban & Delete All</a>
+ <a class="card-link btn btn-warning pull-right" href="{{url_for('.admin_delete_force',
review_id=r.review_id)}}">Remove Forever</a>
</div>
</div>
-<div class="row form-group">
- <div class="col-sm-1">
- <strong>Locale</strong>
- </div>
- <div class="col-sm-5">
- <div class="input-group col-xs-12">
- <textarea class="form-control" rows="1" name="locale">{{r.locale}}</textarea>
-{% if current_user.is_authenticated %}
- <span class="input-group-addon btn btn-action">
- <a href="{{url_for('.admin_show_lang', locale=r.locale)}}">All</a>
- </span>
-{% if not r.locale.startswith('en_') %}
- <span class="input-group-addon btn btn-action">
- <a href="{{url_for('.admin_englishify', review_id=r.review_id)}}">Englishify</a>
- </span>
-{% endif %}
-{% endif %}
- </div>
- </div>
- <div class="col-sm-1">
- <strong>Version</strong>
- </div>
- <div class="col-sm-2">
- <textarea class="form-control" rows="1" name="version">{{r.version}}</textarea>
- </div>
- <div class="col-sm-1">
- <strong>Distro</strong>
- </div>
- <div class="col-sm-2">
- <textarea class="form-control" rows="1" name="distro">{{r.distro}}</textarea>
- </div>
-</div>
-<div class="row form-group">
- <div class="col-sm-1">
- <strong>Summary</strong>
- </div>
- <div class="col-sm-11">
-{% if current_user.is_authenticated %}
- <span class="help-block"><em>This should start with a capital letter and not end with a full
stop</em></span>
-{% endif %}
- <textarea class="form-control" rows="1" name="summary">{{r.summary}}</textarea>
- </div>
-</div>
-<div class="row form-group">
- <div class="col-sm-1">
- <strong>Description</strong>
- </div>
- <div class="col-sm-11">
-{% if current_user.is_authenticated %}
- <span class="help-block"><em>
- This should start with a capital letter and each sentance should end with a full stop.<br/>
- Please remove any incorrect content, and correct spelling, and grammar where required.
- </em></span>
-{% endif %}
- <textarea class="form-control" rows="20" name="description">{{r.description}}</textarea>
- <br/>
-{% if current_user.is_authenticated %}
- <button class="btn btn-action" type="submit">Modify</button>
-{% endif %}
- </div>
-</div>
</form>
+<hr/>
+
{% endblock %}
diff --git a/app_data/odrs/views_admin.py b/app_data/odrs/views_admin.py
index 675cb0e..b3ecc2a 100644
--- a/app_data/odrs/views_admin.py
+++ b/app_data/odrs/views_admin.py
@@ -271,9 +271,8 @@ def admin_show_review(review_id):
return redirect(url_for('.odrs_index'))
# has the user already voted
- user_hash = _get_hash_for_user(current_user)
- if user_hash:
- vote = _vote_exists(review_id, user_hash)
+ if current_user.user:
+ vote = _vote_exists(review_id, current_user.user.user_id)
else:
vote = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]