Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Add confirm pop-up to archive link
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrei committed Jul 25, 2016
1 parent bcdf58c commit 566694f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/helpers/pages_helper.rb
Expand Up @@ -136,4 +136,12 @@ def share_card(page)
image: Image.find_by(id: share.image_id).try(:content).try(:url)
}
end

def archive_confirm_message(page)
msg = "Are you sure you want to archive this page?"
if page.published?
msg += " It will also be unpublished making it inaccessible except to logged-in campaigners."
end
msg
end
end
2 changes: 1 addition & 1 deletion app/views/pages/index.slim
Expand Up @@ -38,7 +38,7 @@
- if page.archived?
= link_to t('pages.index.unarchive'), page_archive_path(page), method: :delete
- else
= link_to t('pages.index.archive'), page_archive_path(page), method: :post
= link_to t('pages.index.archive'), page_archive_path(page), method: :post, 'data-confirm' => archive_confirm_message(page)


#search-filter
Expand Down

0 comments on commit 566694f

Please sign in to comment.