vidpush/app/controllers/videolistings_controller.rb
2014-04-28 14:16:43 -04:00

38 lines
1.0 KiB
Ruby

class VideolistingsController < ApplicationController
before_action :set_videolisting, only: [:publish, :show]
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
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