Improve navigation bar;
Fix an error upon aggregation of PubSub item entries.
This commit is contained in:
parent
aa90d922b0
commit
928f5272e0
4 changed files with 47 additions and 22 deletions
|
@ -118,7 +118,8 @@ label,
|
|||
|
||||
#action > a,
|
||||
#action-bar > a,
|
||||
#number-of-pages > a {
|
||||
#number-of-pages > a,
|
||||
#number-of-pages .inactive {
|
||||
display: inline-block;
|
||||
font-size: 1.2em;
|
||||
min-width: 90px;
|
||||
|
@ -178,7 +179,8 @@ label,
|
|||
#action-bar > a,
|
||||
#download,
|
||||
#input,
|
||||
#number-of-pages > a {
|
||||
#number-of-pages > a,
|
||||
#number-of-pages .inactive {
|
||||
color: #f5f5f5;
|
||||
font-weight: bold;
|
||||
padding-left: 2em;
|
||||
|
@ -187,6 +189,10 @@ label,
|
|||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#number-of-pages .inactive {
|
||||
background: #7a7a7a;
|
||||
}
|
||||
|
||||
#download {
|
||||
background: #d9541e; /* #e96d1f */
|
||||
}
|
||||
|
|
17
fasi.py
17
fasi.py
|
@ -186,6 +186,7 @@ class HttpInstance:
|
|||
# Group chat messages
|
||||
action = 'Join'
|
||||
messages = []
|
||||
# TODO Create configurations for group chat preview
|
||||
room_info_muc = await XmppXep0045.get_room_information(xmpp_instance, jid_bare, alias, maxstanzas=50)
|
||||
messages = room_info_muc['iq'][3]
|
||||
messages.reverse()
|
||||
|
@ -196,9 +197,11 @@ class HttpInstance:
|
|||
page_number = int(page_number)
|
||||
ix = (page_number -1) * 10
|
||||
except:
|
||||
ix = page_number = 0
|
||||
ix = 0
|
||||
page_number = 1
|
||||
else:
|
||||
ix = page_number = 0
|
||||
ix = 0
|
||||
page_number = 1
|
||||
messages_10 = messages[ix:][:10]
|
||||
number_of_pages = int(len(messages) / 10)
|
||||
if number_of_pages < len(messages) / 10: number_of_pages += 1
|
||||
|
@ -293,6 +296,7 @@ class HttpInstance:
|
|||
'previous' : previous,
|
||||
'request' : request,
|
||||
'subject' : subject,
|
||||
'title' : jid_detail['name'],
|
||||
'url' : request.url._url,
|
||||
'xmpp_uri' : xmpp_uri}
|
||||
response = templates.TemplateResponse(template_file, template_dict)
|
||||
|
@ -438,9 +442,11 @@ class HttpInstance:
|
|||
page_number = int(page_number)
|
||||
ix = (page_number -1) * 10
|
||||
except:
|
||||
ix = page_number = 0
|
||||
ix = 0
|
||||
page_number = 1
|
||||
else:
|
||||
ix = page_number = 0
|
||||
ix = 0
|
||||
page_number = 1
|
||||
item_ids_10 = item_ids[ix:][:10]
|
||||
node_items = await XmppXep0060.get_node_items(xmpp_instance, jid_bare, node_name, item_ids=item_ids_10)
|
||||
number_of_pages = int(len(item_ids) / 10)
|
||||
|
@ -468,7 +474,7 @@ class HttpInstance:
|
|||
for item in node_items['pubsub']['items']:
|
||||
item_payload = item['payload']
|
||||
entry = Syndication.extract_items(item_payload)
|
||||
entry['id'] = item['id']
|
||||
if entry: entry['id'] = item['id']
|
||||
entries.append(entry)
|
||||
#if len(entries) > 10: break
|
||||
if entries: entries.reverse()
|
||||
|
@ -542,6 +548,7 @@ class HttpInstance:
|
|||
'page_number' : page_number,
|
||||
'previous' : previous,
|
||||
'request' : request,
|
||||
'title' : node_title,
|
||||
'url' : request.url._url,
|
||||
'xmpp_uri' : xmpp_uri}
|
||||
response = templates.TemplateResponse(template_file, template_dict)
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<span>
|
||||
<h1>{% if jid_title %}{{jid_title}}{% else %}Group Chat{% endif %}</h1>
|
||||
<a href="/{{jid_bare}}">
|
||||
<h2>{% if jid_title %}{{jid_title}}{% else %}{{jid_bare}}{% endif %}</h2>
|
||||
<h2>{% if jid_note %}{{jid_note}}{% else %}{{jid_bare}}{% endif %}</h2>
|
||||
</a>
|
||||
</span>
|
||||
<img id="qrcode" src="/qr/{{jid_bare}}.png" />
|
||||
|
@ -90,15 +90,21 @@
|
|||
{% if number_of_pages %}
|
||||
<div id="number-of-pages">
|
||||
{% if number_of_pages > 5 %}
|
||||
<a href="?page=1">First</a>
|
||||
<a href="?page={{page_number-1}}">{{page_number-1}}</a>
|
||||
{% if number_of_pages > page_number %}
|
||||
<a href="?page={{page_number}}">{{page_number}}</a>
|
||||
{% if page_number < 2 %}
|
||||
<span class="inactive">First</span>
|
||||
<span class="inactive">Back</span>
|
||||
{% else %}
|
||||
<a href="?page=1">First</a>
|
||||
<a href="?page={{page_number-1}}">Back</a>
|
||||
{% endif %}
|
||||
{% if number_of_pages > page_number+1 %}
|
||||
<a href="?page={{page_number+1}}">{{page_number+1}}</a>
|
||||
<a href="?page={{page_number}}">{{page_number}}</a>
|
||||
{% if page_number == number_of_pages %}
|
||||
<span class="inactive">Proceed</span>
|
||||
<span class="inactive">Last</span>
|
||||
{% else %}
|
||||
<a href="?page={{page_number+1}}">Proceed</a>
|
||||
<a href="?page={{number_of_pages}}">Last</a>
|
||||
{% endif %}
|
||||
<a href="?page={{number_of_pages}}">Last</a>
|
||||
{% else %}
|
||||
{% for number in range(number_of_pages) %}
|
||||
<a href="?page={{number+1}}">{{number+1}}</a>
|
||||
|
|
|
@ -97,15 +97,21 @@
|
|||
{% if number_of_pages %}
|
||||
<div id="number-of-pages">
|
||||
{% if number_of_pages > 5 %}
|
||||
<a href="?page=1">First</a>
|
||||
<a href="?page={{page_number-1}}">{{page_number-1}}</a>
|
||||
{% if number_of_pages > page_number %}
|
||||
<a href="?page={{page_number}}">{{page_number}}</a>
|
||||
{% if page_number < 2 %}
|
||||
<span class="inactive">First</span>
|
||||
<span class="inactive">Back</span>
|
||||
{% else %}
|
||||
<a href="?page=1">First</a>
|
||||
<a href="?page={{page_number-1}}">Back</a>
|
||||
{% endif %}
|
||||
{% if number_of_pages > page_number+1 %}
|
||||
<a href="?page={{page_number+1}}">{{page_number+1}}</a>
|
||||
<a href="?page={{page_number}}">{{page_number}}</a>
|
||||
{% if page_number == number_of_pages %}
|
||||
<span class="inactive">Proceed</span>
|
||||
<span class="inactive">Last</span>
|
||||
{% else %}
|
||||
<a href="?page={{page_number+1}}">Proceed</a>
|
||||
<a href="?page={{number_of_pages}}">Last</a>
|
||||
{% endif %}
|
||||
<a href="?page={{number_of_pages}}">Last</a>
|
||||
{% else %}
|
||||
{% for number in range(number_of_pages) %}
|
||||
<a href="?page={{number+1}}">{{number+1}}</a>
|
||||
|
|
Loading…
Reference in a new issue