Commit f2866972 authored by Romain Courteaud's avatar Romain Courteaud

romain_dev: forum attachment

parent f908d711
...@@ -218,16 +218,36 @@ ...@@ -218,16 +218,36 @@
domsugar(gadget.element.querySelector(':scope > ol'), domsugar(gadget.element.querySelector(':scope > ol'),
allDocs_result.data.rows.map(function (entry, i) { allDocs_result.data.rows.map(function (entry, i) {
if (i === gadget.state.lines) { 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 ''; return '';
} }
var source_title = entry.value.source_title || '', var source_title = entry.value.source_title || '',
attachment_list = entry.value
.DiscussionPost_getAttachmentList,
attachment_element_list = [],
j,
word_list = source_title.split(' '), word_list = source_title.split(' '),
source_short_title; source_short_title;
if (word_list.length === 1) { if (word_list.length === 1) {
source_short_title = (word_list[0][0] || '?') + (word_list[0][1] || ''); source_short_title = (word_list[0][0] || '?') + (word_list[0][1] || '');
} else { } else {
source_short_title = word_list[0][0] + word_list[1][0]; 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', [ return domsugar('li', [
domsugar('div', { domsugar('div', {
class: 'post_avatar', class: 'post_avatar',
...@@ -248,7 +268,9 @@ ...@@ -248,7 +268,9 @@
) )
}), }),
domsugar('br'), domsugar('br'),
result_dict.viewer_list[i].element result_dict.viewer_list[i].element,
domsugar('br'),
domsugar('ul', attachment_element_list)
// domsugar('hr') // domsugar('hr')
]) ])
]); ]);
...@@ -296,7 +318,7 @@ ...@@ -296,7 +318,7 @@
query: gadget.state.query_string, query: gadget.state.query_string,
limit: limit_options, limit: limit_options,
select_list: ['asStrippedHTML', 'modification_date', select_list: ['asStrippedHTML', 'modification_date',
'source_title'], 'source_title', 'DiscussionPost_getAttachmentList'],
sort_on: [['modification_date', 'ASC'], ['uid', 'ASC']] sort_on: [['modification_date', 'ASC'], ['uid', 'ASC']]
}) })
.push(function (result) { .push(function (result) {
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.28725.48684.35566</string> </value> <value> <string>989.29059.23816.29696</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1611052202.34</float> <float>1611075470.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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