Patch #37687 » 0002-Unify-duplicate-codes.patch
| app/helpers/journals_helper.rb | ||
|---|---|---|
|
# Returns the attachments of a journal that are displayed as thumbnails
|
||
|
def journal_thumbnail_attachments(journal)
|
||
|
ids = journal.details.select {|d| d.property == 'attachment' && d.value.present?}.map(&:prop_key)
|
||
|
ids.any? ? Attachment.where(:id => ids).select(&:thumbnailable?).sort_by{|a| ids.index(a.id.to_s)} : []
|
||
|
journal.attachments.select(&:thumbnailable?)
|
||
|
end
|
||
|
# Returns the action links for an issue journal
|
||
| app/models/journal.rb | ||
|---|---|---|
|
def attachments
|
||
|
ids = details.select {|d| d.property == 'attachment' && d.value.present?}.map(&:prop_key)
|
||
|
Attachment.where(id: ids).to_a
|
||
|
Attachment.where(id: ids).sort_by {|a| ids.index(a.id.to_s)}
|
||
|
end
|
||
|
# Returns a string of css classes
|
||
- « Previous
- 1
- 2
- 3
- Next »