33 lines
1009 B
Ruby
33 lines
1009 B
Ruby
class VideolistingsController < ApplicationController
|
|
before_action :set_videolisting, only: [:publish]
|
|
|
|
def publish
|
|
if @videolisting.published?
|
|
@message = "Campaign Already Published."
|
|
elsif @videolisting.campaign.processed?
|
|
@videolisting.published = true
|
|
@videolisting.save
|
|
|
|
@message = "Campaign Published Successfully."
|
|
else
|
|
@message = "Error: Campaign Not Published."
|
|
end
|
|
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
|