38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
class VideolistingsController < ApplicationController
|
|
before_action :set_videolisting, only: [:publish, :show]
|
|
|
|
def publish
|
|
if @videolisting.published?
|
|
@message = "Campaign Already Published."
|
|
elsif @videolisting.campaign.sent?
|
|
VideolistingMailer.videolisting_complete(@videolisting).deliver
|
|
@videolisting.published = true
|
|
@videolisting.save
|
|
@message = "Campaign Published Successfully."
|
|
else
|
|
@message = "Error: Campaign Not Published."
|
|
end
|
|
end
|
|
|
|
|
|
def show
|
|
@videolisting
|
|
end
|
|
|
|
private
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_videolisting
|
|
@videolisting = set_by_options(:videolisting, :videocode)
|
|
end
|
|
|
|
# Only allow a trusted parameter "white list" through.
|
|
def videolisting_params
|
|
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls)
|
|
end
|
|
|
|
def not_found
|
|
raise ActionController::RoutingError.new("Not Found by video code")
|
|
end
|
|
|
|
end
|