_announcement.html.haml 1.1 KB

12345678910111213141516171819
  1. .announcements-list__item
  2. = link_to edit_admin_announcement_path(announcement), class: 'announcements-list__item__title' do
  3. = truncate(announcement.text)
  4. .announcements-list__item__action-bar
  5. .announcements-list__item__meta
  6. - if announcement.scheduled_at.present?
  7. = t('admin.announcements.scheduled_for', time: l(announcement.scheduled_at))
  8. - else
  9. = l(announcement.created_at)
  10. %div
  11. - if can?(:update, announcement)
  12. - if announcement.published?
  13. = table_link_to 'toggle-off', t('admin.announcements.unpublish'), unpublish_admin_announcement_path(announcement), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }
  14. - else
  15. = table_link_to 'toggle-on', t('admin.announcements.publish'), publish_admin_announcement_path(announcement), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }
  16. = table_link_to 'trash', t('generic.delete'), admin_announcement_path(announcement), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, announcement)