Module: Crm::PublicationsHelper
- Defined in:
- app/helpers/crm/publications_helper.rb
Overview
View helper: publications.
Instance Method Summary collapse
- #publication_command_options(publication = @publication) ⇒ Object
- #publication_transmit_options(publication = @publication) ⇒ Object
- #setup_publication(publication) ⇒ Object
Instance Method Details
#publication_command_options(publication = @publication) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/crm/publications_helper.rb', line 11 def (publication = @publication) links = [] if can?(:update, publication) links << link_to("Edit", edit_publication_path(publication), data: { turbo_action: 'replace' }) links << link_to("Revise", revise_publication_path(publication), data: { turbo_method: :post }) links << link_to("Update Stock", edit_stock_publication_path(publication), data: { turbo_method: :post }) links << link_to("Generate Cover Image", generate_cover_image_publication_path(publication), data: { turbo_method: :post }) links << link_to("Create PDF Variation", create_pdf_variation_publication_path(publication), data: { turbo_method: :post }) if publication.literature && can?(:read, GeneratedPdf) end links << link_to(fa_icon('trash', text: 'Destroy'), publication_path(publication), data: { turbo_method: :delete, turbo_confirm: 'Are you sure you want to delete this publication?' }) if can?(:manage, publication) links end |
#publication_transmit_options(publication = @publication) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/helpers/crm/publications_helper.rb', line 24 def (publication = @publication) links = [] if publication.literature links << link_to("Transmit", new_communication_path(upload_id: publication.literature_id, return_path: publication_path(publication))) links << link_to(fa_icon('download', text: 'Download'), upload_path(publication.literature)) end links end |
#setup_publication(publication) ⇒ Object
5 6 7 8 9 |
# File 'app/helpers/crm/publications_helper.rb', line 5 def setup_publication(publication) publication.tap do |p| p.build_literature unless p.literature end end |