vidpush/app/controllers/videolistings_controller.rb

33 lines
1009 B
Ruby
Raw Normal View History

2014-04-07 18:41:34 +00:00
class VideolistingsController < ApplicationController
2014-04-24 19:17:23 +00:00
before_action :set_videolisting, only: [:publish]
def publish
if @videolisting.published?
@message = "Campaign Already Published."
elsif @videolisting.campaign.processed?
@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
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