forked from sch/Rivista
Improve the presentation of related links.
This commit is contained in:
parent
a9c7832da1
commit
44e7778578
3 changed files with 37 additions and 17 deletions
|
@ -107,22 +107,23 @@ async def view_node_items(request: Request):
|
|||
link = form_an_item_link(pubsub, node, item_id)
|
||||
xml_atom = generate_atom(iq, link)
|
||||
iq = await get_node_items(pubsub, node)
|
||||
if iq:
|
||||
generate_json(iq)
|
||||
else:
|
||||
operator = get_configuration('settings')['operator']
|
||||
json_data = [{'title' : 'Error retrieving node items.',
|
||||
'link' : ('javascript:alert("Rivista has experienced an error '
|
||||
'while attempting to retrieve the list of items for '
|
||||
'Node {} of PubSub {}.")')
|
||||
.format(node, pubsub)},
|
||||
{'title' : 'Contact the operator.',
|
||||
'link' : ('xmpp:{}?message;subject=Rivista;body=Greetings! '
|
||||
'I am contacting you to inform you that there is an error listing '
|
||||
'node items for Node {} on PubSub {}.').format(operator, node, pubsub)}]
|
||||
filename = 'data/{}.json'.format(node)
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
||||
if not '/' in node:
|
||||
if iq:
|
||||
generate_json(iq)
|
||||
else:
|
||||
operator = get_configuration('settings')['operator']
|
||||
json_data = [{'title' : 'Error retrieving node items.',
|
||||
'link' : ('javascript:alert("Rivista has experienced an error '
|
||||
'while attempting to retrieve the list of items for '
|
||||
'Node {} of PubSub {}.")')
|
||||
.format(node, pubsub)},
|
||||
{'title' : 'Contact the operator.',
|
||||
'link' : ('xmpp:{}?message;subject=Rivista;body=Greetings! '
|
||||
'I am contacting you to inform you that there is an error listing '
|
||||
'node items for Node {} on PubSub {}.').format(operator, node, pubsub)}]
|
||||
filename = 'data/{}.json'.format(node)
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
||||
else:
|
||||
text = 'Please ensure that the PubSub node and item are valid and accessible.'
|
||||
xml_atom = error_message(text)
|
||||
|
|
|
@ -136,6 +136,7 @@ window.onload = async function(){
|
|||
// Convert URI xmpp: to URI http: links.
|
||||
for (let xmppLink of document.querySelectorAll(
|
||||
'#articles h3 > a[href^="xmpp:"][id^="rivista-"],' +
|
||||
'#articles h5.related > a[class^="rivista-"],' +
|
||||
'#journal > ol > li > a[href^="xmpp:"]')) {
|
||||
xmppUri = new URL(xmppLink);
|
||||
let parameters = xmppUri.search.split(';');
|
||||
|
|
|
@ -284,7 +284,16 @@ xmlns:atom='http://www.w3.org/2005/Atom'>
|
|||
<xsl:attribute name='href'>
|
||||
<xsl:value-of select='atom:link[@rel="alternate" and @type="x-scheme-handler/xmpp"]/@href'/>
|
||||
</xsl:attribute>
|
||||
💡️ XMPP
|
||||
<xsl:attribute name='class'>
|
||||
<xsl:text>rivista-jabber</xsl:text>
|
||||
</xsl:attribute>
|
||||
💡️ Source
|
||||
</xsl:element>
|
||||
<xsl:element name='a'>
|
||||
<xsl:attribute name='href'>
|
||||
<xsl:value-of select='atom:link[@rel="alternate" and @type="x-scheme-handler/xmpp"]/@href'/>
|
||||
</xsl:attribute>
|
||||
(XMPP)
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test='atom:link[@rel="replies"]'>
|
||||
|
@ -292,8 +301,17 @@ xmlns:atom='http://www.w3.org/2005/Atom'>
|
|||
<xsl:attribute name='href'>
|
||||
<xsl:value-of select='atom:link[@rel="replies"]/@href'/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name='class'>
|
||||
<xsl:text>rivista-replies</xsl:text>
|
||||
</xsl:attribute>
|
||||
💬 Discussion
|
||||
</xsl:element>
|
||||
<xsl:element name='a'>
|
||||
<xsl:attribute name='href'>
|
||||
<xsl:value-of select='atom:link[@rel="replies"]/@href'/>
|
||||
</xsl:attribute>
|
||||
(XMPP)
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test='atom:link[@rel="alternate" and @type="text/html"]'>
|
||||
<xsl:element name='a'>
|
||||
|
|
Loading…
Reference in a new issue