]> git.ipfire.org Git - ipfire.org.git/commitdiff
people: Show better message when no calls are available to show
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Oct 2018 08:19:43 +0000 (08:19 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Oct 2018 08:19:43 +0000 (08:19 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/people/modules/cdr.html
src/web/people.py

index a2ad0a2baacbf2928298bafe9f6b6b7976d606bc..456f8f2f76efc2389b2e4080f3f5bb8cf310c5f1 100644 (file)
@@ -1,52 +1,58 @@
-<table class="table table-sm mb-0">
-       <thead>
-               <tr>
-                       <th></th>
-                       <th class="text-right">{{ _("Duration") }}</th>
-               </tr>
-       </thead>
-
-       <tbody>
-               {% for c in cdr %}
+{% if cdr %}
+       <table class="table table-sm mb-0">
+               <thead>
                        <tr>
-                               <td>
-                                       {% if c.direction == "inbound" %}
-                                               <span class="fas fa-arrow-right text-danger"></span>
+                               <th></th>
+                               <th class="text-right">{{ _("Duration") }}</th>
+                       </tr>
+               </thead>
 
-                                               <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
-                                                       {% if c.callee %}
-                                                               {{ c.callee }}
-                                                       {% else %}
-                                                               {{ format_phone_number(c.callee_number) }}
-                                                       {% end %}
-                                               </a>
-                                       {% elif c.direction == "outbound" %}
-                                               <span class="fas fa-arrow-left text-success"></span>
+               <tbody>
+                       {% for c in cdr %}
+                               <tr>
+                                       <td>
+                                               {% if c.direction == "inbound" %}
+                                                       <span class="fas fa-arrow-right text-danger"></span>
 
-                                               <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
-                                                       {% if c.caller %}
-                                                               {{ c.caller }}
-                                                       {% else %}
-                                                               {{ format_phone_number(c.caller_number) }}
-                                                       {% end %}
-                                               </a>
-                                       {% end %}
+                                                       <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
+                                                               {% if c.callee %}
+                                                                       {{ c.callee }}
+                                                               {% else %}
+                                                                       {{ format_phone_number(c.callee_number) }}
+                                                               {% end %}
+                                                       </a>
+                                               {% elif c.direction == "outbound" %}
+                                                       <span class="fas fa-arrow-left text-success"></span>
 
-                                       <br>
+                                                       <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
+                                                               {% if c.caller %}
+                                                                       {{ c.caller }}
+                                                               {% else %}
+                                                                       {{ format_phone_number(c.caller_number) }}
+                                                               {% end %}
+                                                       </a>
+                                               {% end %}
 
-                                       {% module MOS(c) %}
-                               </td>
+                                               <br>
 
-                               <td class="text-right">
-                                       {{ locale.format_date(c.time_start, relative=False) }} <br>
+                                               {% module MOS(c) %}
+                                       </td>
 
-                                       {% if c.time_answered %}
-                                               <span class="text-muted">{{ format_time(c.duration) }}</span>
-                                       {% else %}
-                                               <span class="text-danger">{{ _("Not Answered") }}</span>
-                                       {% end %}
-                               </td>
-                       </tr>
-               {% end %}
-       </tbody>
-</table>
+                                       <td class="text-right">
+                                               {{ locale.format_date(c.time_start, relative=False) }} <br>
+
+                                               {% if c.time_answered %}
+                                                       <span class="text-muted">{{ format_time(c.duration) }}</span>
+                                               {% else %}
+                                                       <span class="text-danger">{{ _("Not Answered") }}</span>
+                                               {% end %}
+                                       </td>
+                               </tr>
+                       {% end %}
+               </tbody>
+       </table>
+{% else %}
+       <p class="text-muted text-center my-5">
+               {{ _("There are no calls") }}
+       </p>
+{% end %}
index 7eb2d06242f7358f21438b9a709a37a63378fcbc..c5f18f5b9eaa48b7b39b23a26f4fc23e5d2081ee 100644 (file)
@@ -356,7 +356,8 @@ class CDRModule(ui_modules.UIModule):
        def render(self, account, date=None, limit=None):
                cdr = account.get_cdr(date=date, limit=limit)
 
-               return self.render_string("people/modules/cdr.html", account=account, cdr=cdr)
+               return self.render_string("people/modules/cdr.html",
+                       account=account, cdr=list(cdr))
 
 
 class ChannelsModule(ui_modules.UIModule):