Skip to content

Commit

Permalink
Sort attachments by label
Browse files Browse the repository at this point in the history
  • Loading branch information
davidswelt committed May 26, 2017
1 parent f5f228d commit b338e80
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1358,16 +1358,16 @@ def button_label_for_object(obj, default):
elif 'bib' == sl and bibitem2:
bi = a_button('BIB') + div('bibshowhide', div('bib', bibitem2))
elif 'file' == sl:
fil = sorted(filter(lambda x: x.saved_filename, item.attachments),
key=lambda x: button_label_for_object(x.saved_filename, 'File'))
bi = u''
for a in item.attachments:
if a.saved_filename: # a.itemType=='attachment':
bi += div('blink', a_button(button_label_for_object(a.saved_filename, 'File'),
url=file_output_path + '/' + a.saved_filename))
for a in fil:
lab = button_label_for_object(a.saved_filename, 'File')
bi += div('blink', a_button(lab, url=file_output_path + '/' + a.saved_filename))
elif 'note' == sl:
for a in item.attachments:
if a.itemType == 'note' and a.note:
bi += div('blink', a_button('Note') + div('bibshowhide', div('note', a.note)))

elif (sl == 'pdf' or sl == 'url') and u:
# automatically detect what the link points to
n = button_label_for_object(u, 'link')
Expand Down

0 comments on commit b338e80

Please sign in to comment.