Sha256: fe0a5997e2449b78d9f85805238a61803b255f5ddb4873066d4c9051fdfde6b4

Contents?: true

Size: 946 Bytes

Versions: 3

Compression:

Stored size: 946 Bytes

Contents

- attachments = page.attachments.find_without_types("video", "image")
- if current_user
  - attachments += page.attachments.find_by_type("video").select { |attachment| can? :update, attachment }
- attachments = attachments.sort_by { |attachment| attachment.created_at }.reverse

- # - attachments = .order('created_at DESC')
- # - attachments = attachments. + attachments.find_by_types('image', 'video').where(author: current_user)

- # Show attachments box if:
- #   (a) There are attachments.
- #   (b) The user can add attachments,
- #          but there are no blog entries.
- #          (If there are blog entries, it is not clear where to put
- #          the attachment.)
- #

- if attachments.count > 0
  = render partial: 'attachments/documents', locals: {attachments: attachments, parent: page}

- if not @blog_entries.present? and can?(:create_attachment_for, page)
  = render partial: 'attachments/drop_field', locals: {parent: page}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 app/views/pages/_attachments.html.haml
your_platform-1.0.0 app/views/pages/_attachments.html.haml
your_platform-0.0.2 app/views/pages/_attachments.html.haml