]> git.ipfire.org Git - ipfire.org.git/commitdiff
people: Add module for SIP status
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 17 Oct 2018 12:49:56 +0000 (13:49 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 17 Oct 2018 15:12:45 +0000 (16:12 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/people/base.html
src/templates/people/modules/sip-status.html [new file with mode: 0644]
src/templates/people/user.html
src/web/__init__.py
src/web/people.py

index 58a66c3b02abff733ae1b0715a2c43a67f389974..92b14c4dda32e3f56b97d4dbcacf2944b7ef07cd 100644 (file)
@@ -170,7 +170,8 @@ templates_people_modules_DATA = \
        src/templates/people/modules/cdr.html \
        src/templates/people/modules/channels.html \
        src/templates/people/modules/mos.html \
-       src/templates/people/modules/registrations.html
+       src/templates/people/modules/registrations.html \
+       src/templates/people/modules/sip-status.html
 
 templates_people_modulesdir = $(templates_peopledir)/modules
 
index 8a28d21f52d6adbf531315b56ebc21673b5e9d6a..8617dd33d007bee2a540974e8a4b10f4c507714d 100644 (file)
                                </p>
 
                                <p>
-                                       {% if current_user.sip_registrations %}
-                                               <a class="text-success" href="/users/{{ current_user.uid }}/registrations">
-                                                       {{ _("Online") }} ({{ len(current_user.sip_registrations) }})
-                                               </a>
-                                       {% else %}
-                                               <span class="text-danger">{{ _("Offline") }}</span>
-                                       {% end %}
+                                       {% module SIPStatus(current_user) %}
                                </p>
                        </div>
                {% end block %}
diff --git a/src/templates/people/modules/sip-status.html b/src/templates/people/modules/sip-status.html
new file mode 100644 (file)
index 0000000..c614b9f
--- /dev/null
@@ -0,0 +1,7 @@
+{% if account.sip_registrations %}
+    <a class="text-success" href="/users/{{ account.uid }}/registrations">
+        {{ _("Online") }} ({{ len(account.sip_registrations) }})
+    </a>
+{% else %}
+    <span class="text-danger">{{ _("Offline") }}</span>
+{% end %}
index 12b6405dd3f3f057ff0e047410fd89b1e484b4d7..e71e8c703d05f9b12ebca8cbbdbbb70ed7c5eb40 100644 (file)
                                                                        <h6>
                                                                                <span class="mr-2">{{ _("SIP Status") }}</span>
 
-                                                                               {% if account.sip_registrations %}
-                                                                                       <a class="text-success" href="/users/{{ account.uid }}/registrations">
-                                                                                               {{ _("Online") }} ({{ len(account.sip_registrations) }})
-                                                                                       </a>
-                                                                               {% else %}
-                                                                                       <span class="text-danger">{{ _("Offline") }}</span>
-                                                                               {% end %}
+                                                                               {% module SIPStatus(account) %}
                                                                        </h6>
                                                                {% end %}
 
index b8d465462e7271a2ea72961893d03924b8953ee1..b80ac84c0129d9ff149d71dbdf0f4e9757bf9e60 100644 (file)
@@ -64,6 +64,7 @@ class Application(tornado.web.Application):
                                "Channels"             : people.ChannelsModule,
                                "MOS"                  : people.MOSModule,
                                "Registrations"        : people.RegistrationsModule,
+                               "SIPStatus"            : people.SIPStatusModule,
 
                                # Old modules
                                "LanguageName"         : ui_modules.LanguageNameModule,
index 6ab25bc21863c548136298bec3ea20a7f1848e9d..c327e52e3bea1bc2be69a6859a9a440e9cee5624 100644 (file)
@@ -265,3 +265,8 @@ class MOSModule(ui_modules.UIModule):
 class RegistrationsModule(ui_modules.UIModule):
        def render(self, account):
                return self.render_string("people/modules/registrations.html", account=account)
+
+
+class SIPStatusModule(ui_modules.UIModule):
+       def render(self, account):
+               return self.render_string("people/modules/sip-status.html", account=account)