Sha256: 5ae56fc3a7910f5025060e302f1a6a3d937d9ef940594818dfe197d5f20e70c5

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

# encoding: UTF-8
module AlchemyCrm
  module Admin
    class MailingsController < AlchemyCrm::Admin::BaseController

      before_filter :load_newsletters, :only => [:new, :edit, :copy]

      helper 'AlchemyCrm::Mailings'
      helper 'Alchemy::Admin::Pages'

      def copy
        @mailing = Mailing.copy(params[:id])
        render :action => :new, :layout => false
      end

      def show
        @mailing = Mailing.find(params[:id])
        @page = @mailing.page
        @contact = Contact.fake
        @recipient = Recipient.new_from_contact(@contact)
        @preview_mode = true
        render :layout => 'alchemy_crm/mailings'
      end

      def edit_content
        @mailing = Mailing.find(params[:id])
        @page = @mailing.page
      end

      def update
        @mailing.update_attributes(params[:mailing], :as => current_user.role.to_sym)
        render_errors_or_redirect(
          @mailing,
          :back,
          flash_notice_for_resource_action
        )
      end

    private

      def load_newsletters
        @newsletters = Newsletter.all
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alchemy_crm-2.0.5 app/controllers/alchemy_crm/admin/mailings_controller.rb
alchemy_crm-2.0.4.1 app/controllers/alchemy_crm/admin/mailings_controller.rb
alchemy_crm-2.0.3 app/controllers/alchemy_crm/admin/mailings_controller.rb
alchemy_crm-2.0.2 app/controllers/alchemy_crm/admin/mailings_controller.rb