2018-05-16 19:25:16 +00:00
|
|
|
module Nonprofits
|
|
|
|
class CampaignTemplatesController < ApplicationController
|
|
|
|
include NonprofitHelper
|
|
|
|
|
|
|
|
before_filter :authenticate_nonprofit_admin!, only: :create
|
|
|
|
before_filter :authenticate_nonprofit_user!, only: [:index, :show]
|
|
|
|
|
|
|
|
def index
|
|
|
|
@templates = CampaignTemplate.all
|
2018-05-18 15:18:46 +00:00
|
|
|
@nonprofit = current_nonprofit
|
2018-05-16 19:25:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2018-05-18 15:18:46 +00:00
|
|
|
template = CampaignTemplate.create(params[:campaign_template])
|
2018-05-16 19:25:16 +00:00
|
|
|
|
2018-05-18 15:18:46 +00:00
|
|
|
json_saved template
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
campaign = CampaignTemplate.find(params[:id])
|
|
|
|
campaign.destroy
|
|
|
|
|
|
|
|
render json: {}, status: :no_content
|
2018-05-16 19:25:16 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|