More UI improvements

This commit is contained in:
David Taylor
2015-05-23 03:20:27 +01:00
parent c0dfbb760d
commit 7d0e89eb18
6 changed files with 58 additions and 12 deletions

View File

@@ -185,6 +185,7 @@ USE_TZ = True
DATETIME_INPUT_FORMATS = ('%Y-%m-%dT%H:%M','%Y-%m-%dT%H:%M:%S')
RIGS_DATETIME_FORMAT = ('d/m/Y H:i')
RIGS_DATE_FORMAT = ('d/m/Y')
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",

View File

@@ -9,7 +9,11 @@
<script src="{% static "js/moment.min.js" %}"></script>
<script>
$(function () {
$('[data-toggle="popover"]').popover();
$('[data-toggle="popover"]').popover().click(function(){
if($(this).attr('href')){
window.location.href = $(this).attr('href');
}
});
// This keeps timeago values correct, but uses an insane amount of resources
// $(function () {
@@ -52,15 +56,18 @@
</thead>
<tbody>
{% for version in object_list %}
{% if version.item_changes or version.field_changes %}
{% if version.item_changes or version.field_changes or version.old == None%}
<tr>
<td>{{ version.revision.date_created|date:"RIGS_DATETIME_FORMAT" }}</td>
<td><a href="{% url 'event_detail' version.new.pk %}">N{{ version.new.pk|stringformat:"05d" }}</a></td>
<td>{{ version.version.pk }}|{{ version.revision.pk }}</td>
<td>{{ version.revision.user.name }}</td>
<td>
{% if version.old == None %}
Event Created
{% else %}
{% include 'RIGS/event_version_changes.html' %}
</td>
{% endif %} </td>
</tr>
{% endif %}
{% endfor %}
@@ -76,13 +83,16 @@
<h2>Rigboard Activity Stream - Stream View</h2>
<br>
{% for version in object_list %}
{% if version.item_changes or version.field_changes %}
{% if version.item_changes or version.field_changes or version.old == None %}
<div class="well">
<button title="title" type="button" class="btn btn-default btn-xs">{{ version.revision.user.first_name|default_if_none:"(unknown)" }}</button> changed
{% include 'RIGS/event_version_changes.html' %}
in <button title="title" type="button" class="btn btn-default btn-xs">N{{ version.new.pk|stringformat:"05d" }}</button> <small>(<span data-date='{{ version.revision.date_created|date:"Y-m-d H:i:s" }}' class="date">{{ version.revision.date_created|date:"RIGS_DATETIME_FORMAT" }}</span>)</small>
{% include 'RIGS/profile_button.html' with profile=version.revision.user %}
{% if version.old == None %}
created
{% else %}
changed {% include 'RIGS/event_version_changes.html' %} in
{% endif %}
{% include 'RIGS/event_button.html' with event=version.current %}
</div>
{% endif %}

View File

@@ -0,0 +1,18 @@
{# pass in variable "event" to this template #}
<button title="N{{ event.pk|stringformat:"05d" }} | {{event.name}}" type="button" href="{% url 'event_detail' event.pk %}" class="btn btn-default btn-xs" data-container="body" data-html="true" data-trigger='hover' data-toggle="popover" data-content='
<dl class="dl-vertical">
<dt>Date</dt>
<dd>{{event.start_date|date:"RIGS_DATE_FORMAT"}}</dd>
<dt>Status</dt>
<dd>{{event.get_status_display}}</dd>
<dt>MIC</dt>
<dd>{{event.mic.name}}</dd>
<dt>Venue</dt>
<dd>{{event.venue}}</dd>
</dl>
'>N{{ event.pk|stringformat:"05d" }}</button>

View File

@@ -27,13 +27,17 @@
</thead>
<tbody>
{% for version in object_list %}
{% if version.item_changes or version.field_changes %}
{% if version.item_changes or version.field_changes or version.old == None %}
<tr>
<td>{{ version.version.pk }}|{{ version.revision.pk }}</td>
<td>{{ version.revision.date_created|date:"d/m/Y H:i" }}</td>
<td>{{ version.revision.date_created|date:"RIGS_DATETIME_FORMAT" }}</td>
<td>{{ version.revision.user.name }}</td>
<td>
{% include 'RIGS/event_version_changes.html' %}
{% if version.old == None %}
Event Created
{% else %}
{% include 'RIGS/event_version_changes.html' %}
{% endif %}
</td>
</tr>
{% endif %}

View File

@@ -0,0 +1,12 @@
{# pass in variable "profile" to this template #}
<button title="{{profile.name}}" type="button" class="btn btn-default btn-xs" data-container="body" data-html="true" data-trigger='hover focus' data-toggle="popover" data-content='
<img src="{{profile.profile_picture}}" class="img-responsive img-rounded center-block" style="max-width:4em" />
<dl class="dl-vertical">
<dt>Email</dt>
<dd>{{profile.email}}</dd>
<dt>Phone</dt>
<dd>{{profile.phone}}</dd>
</dl>
'>{{profile.first_name}}</button>

View File

@@ -122,6 +122,7 @@ def get_changes_for_version(newVersion, oldVersion=None):
compare = {}
compare['revision'] = newVersion.revision
compare['new'] = newVersion.object_version.object
compare['current'] = models.Event.objects.get(pk=compare['new'].pk)
compare['version'] = newVersion
if oldVersion: