Commit c02a0efb authored by Romain Courteaud's avatar Romain Courteaud

romain_dev: forum attachment

parent dba9634f
......@@ -218,16 +218,36 @@
domsugar(gadget.element.querySelector(':scope > ol'),
allDocs_result.data.rows.map(function (entry, i) {
if (i === gadget.state.lines) {
// Drop the last lines, in case we reached the +1 post value
// from allDocs, used to activate the pagination
return '';
}
var source_title = entry.value.source_title || '',
attachment_list = entry.value
.DiscussionPost_getAttachmentList,
attachment_element_list = [],
j,
word_list = source_title.split(' '),
source_short_title;
if (word_list.length === 1) {
source_short_title = (word_list[0][0] || '?') + (word_list[0][1] || '');
} else {
source_short_title = word_list[0][0] + word_list[1][0];
}
for (j = 0; j < attachment_list.length; j += 1) {
attachment_element_list.push(
domsugar('li', [
domsugar('a', {
text: attachment_list[j].title,
href: attachment_list[j].url,
download: attachment_list[j].title
})
])
);
}
return domsugar('li', [
domsugar('div', {
class: 'post_avatar',
......@@ -248,7 +268,9 @@
)
}),
domsugar('br'),
result_dict.viewer_list[i].element
result_dict.viewer_list[i].element,
domsugar('br'),
domsugar('ul', attachment_element_list)
// domsugar('hr')
])
]);
......@@ -296,7 +318,7 @@
query: gadget.state.query_string,
limit: limit_options,
select_list: ['asStrippedHTML', 'modification_date',
'source_title'],
'source_title', 'DiscussionPost_getAttachmentList'],
sort_on: [['modification_date', 'ASC'], ['uid', 'ASC']]
})
.push(function (result) {
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>989.28725.48684.35566</string> </value>
<value> <string>989.29059.23816.29696</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1611052202.34</float>
<float>1611075470.2</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment