Preparing data for attachments display implementation

This commit is contained in:
Dusko Angirevic 2017-06-16 00:56:29 +02:00
parent 7c71abd7a3
commit a3bd2834b7
2 changed files with 28 additions and 2 deletions

View file

@ -224,7 +224,20 @@ function parseToot (data){
console.log(tag)
item['content'] = item['content'].replaceAll('#'+tag, '<a href="#'+tag+'">'+tag+'</a>')
}*/
item['attachments'] = [];
for(var i = 0; i < data['media_attachments'].length ; i++){
var attachments = data['media_attachments'][i];
console.log(JSON.stringify(attachments))
item['content'] = item['content'].replaceAll(attachments['text_url'], '')
item['attachments'].push({
id: attachments['id'],
id: attachments['id'],
type: attachments['type'],
url: attachments['remote_url'] !=="" ? attachments['remote_url'] : attachments['url'] ,
preview_url: attachments['preview_url']
})
}
console.log(JSON.stringify(item['attachments']))
item['content'] = item['content'].split(" ")
for(var i = 0; i < item['content'].length ; i++){
if(item['content'][i][0] === "#"){

View file

@ -6,7 +6,7 @@ BackgroundItem {
signal send (string notice)
signal navigateTo(string link)
width: parent.width
height: miniHeader.height + lblContent.height + Theme.paddingLarge + (ministatus.visible ? ministatus.height : 0) +Theme.paddingLarge
height: miniHeader.height + media.height + lblContent.height + Theme.paddingLarge + (ministatus.visible ? ministatus.height : 0) +Theme.paddingLarge
MiniStatus {
id: ministatus
anchors {
@ -114,6 +114,19 @@ BackgroundItem {
font.pixelSize: Theme.fontSizeSmall
color: (pressed ? Theme.highlightColor : (highlight ? Theme.primaryColor : Theme.secondaryColor))
}
Label {
id: media
anchors {
left: parent.left
leftMargin: Theme.paddingMedium
right: parent.right
rightMargin: Theme.horizontalPageMargin
top: lblContent.bottom
topMargin: Theme.paddingSmall
bottomMargin: Theme.paddingLarge
}
text: attachments.count + "Aaa"
}