vidpush/app/controllers/videolistings_controller.rb

44 lines
1.1 KiB
Ruby
Raw Normal View History

2014-04-07 18:41:34 +00:00
class VideolistingsController < ApplicationController
before_action :set_videolisting, only: [:publish, :show]
2014-04-24 19:17:23 +00:00
def publish
if @videolisting.published?
@message = "Campaign Already Published."
2014-04-29 17:03:46 +00:00
elsif @videolisting.campaign.sent?
2014-05-05 18:07:33 +00:00
VideolistingMailer.videolisting_complete(@videolisting).deliver
2014-04-24 19:17:23 +00:00
@videolisting.published = true
@videolisting.save
@message = "Campaign Published Successfully."
download_video @videolisting
2014-04-07 18:41:34 +00:00
else
2014-04-24 19:17:23 +00:00
@message = "Error: Campaign Not Published."
2014-04-07 18:41:34 +00:00
end
end
def show
@videolisting
end
2014-04-07 18:41:34 +00:00
private
# Use callbacks to share common setup or constraints between actions.
def set_videolisting
2014-04-25 15:32:58 +00:00
@videolisting = set_by_options(:videolisting, :videocode)
2014-04-07 18:41:34 +00:00
end
# Only allow a trusted parameter "white list" through.
def videolisting_params
2014-05-29 20:57:34 +00:00
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls, :on_s3)
2014-04-07 18:41:34 +00:00
end
2014-04-24 20:33:48 +00:00
def not_found
raise ActionController::RoutingError.new("Not Found by video code")
end
2014-04-07 18:41:34 +00:00
end