vidpush/app/controllers/videolistings_controller.rb

38 lines
1.0 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-04-24 19:17:23 +00:00
@videolisting.published = true
@videolisting.save
2014-04-24 19:17:23 +00:00
@message = "Campaign Published Successfully."
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
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls)
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