re-reveal the video code and listing code

This commit is contained in:
Tyrel Souza 2014-05-13 13:33:00 -04:00
parent 445090d084
commit 21a3c113d1
3 changed files with 4 additions and 14 deletions

View File

@ -5,10 +5,8 @@ class Videolisting < ActiveRecord::Base
validates :videocode, presence: true, uniqueness: true validates :videocode, presence: true, uniqueness: true
validates :voiceoverselection, presence: true validates :voiceoverselection, presence: true
validates :musicselection, presence: true validates :musicselection, presence: true
after_create :fix_videocode
after_save :send_notification_after_change after_save :send_notification_after_change
after_initialize :set_defaults after_initialize :set_defaults
before_validation :set_videocode
def get_video_url def get_video_url
"http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4" "http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4"
@ -36,17 +34,6 @@ class Videolisting < ActiveRecord::Base
end end
private private
def set_videocode
self.videocode ||= SecureRandom.hex
end
def fix_videocode
if self.campaign
self.videocode = "#{self.campaign.listingcode}-#{self.id}"
self.save
end
end
def set_defaults def set_defaults
self.producttypeid = 721 self.producttypeid = 721
end end

View File

@ -21,7 +21,7 @@
hint: "The name of the company." %> hint: "The name of the company." %>
<%= frm.input :listingcode, <%= frm.input :listingcode,
label: 'Listing Code', label: 'Listing Code',
as: :hidden %> hint: "Please provide the unique opportunity id." %>
<%= frm.input :description, <%= frm.input :description,
label: 'Description', label: 'Description',
as: 'text', as: 'text',

View File

@ -1,4 +1,7 @@
<div class="nested-fields videolisting_field"> <div class="nested-fields videolisting_field">
<%= f.input :videocode,
label: 'Video Code',
hint: "Please provide the video code id." %>
<%= f.input :voiceoverselection, <%= f.input :voiceoverselection,
label: 'Voiceover Selection', label: 'Voiceover Selection',
collection: voiceoverselection_list, collection: voiceoverselection_list,