Get clientid as an in the @set_campaign so it can get it better.

This commit is contained in:
Tyrel Souza 2014-04-21 14:26:46 -04:00
parent e5c38401ae
commit 6370dcab69
5 changed files with 54 additions and 56 deletions

View File

@ -22,7 +22,6 @@ class CampaignsController < ApplicationController
def edit
@action = campaign_path(@campaign.clientid)
end
@ -54,7 +53,8 @@ class CampaignsController < ApplicationController
private
def set_campaign
@campaign = Campaign.find_by_clientid(params[:clientid]) || not_found
clientid = params[:clientid].to_s.gsub(/\D/, '').to_i
@campaign = Campaign.find_by_clientid(clientid) || Campaign.find_by_clientid(params[:campaign][:clientid]) || not_found
end
def campaign_params
@ -73,7 +73,6 @@ class CampaignsController < ApplicationController
raise ActionController::RoutingError.new("Not Found by clientid")
end
def set_api_key
@BETTER_VIDEO_API_KEY = ENV['BETTER_VIDEO_API_KEY']
@BETTER_VIDEO_API_KEY ||= "propel test key"

View File

@ -6,6 +6,8 @@ class Campaign < ActiveRecord::Base
validates :listingcode, presence: true, uniqueness: true
validates :advertisername, presence: true
validates :websiteurl, presence: true
validates :description, presence: true
validates :productsandservices, presence: true
after_create :send_to_better_video
def send_to_better_video

View File

@ -2,6 +2,9 @@ class Videolisting < ActiveRecord::Base
belongs_to :campaign
validates :videocode, presence: true, uniqueness: true
validates :producttypeid, presence: true
validates :voiceoverselection, presence: true
validates :musicselection, presence: true
def asseturls_array
self.asseturls.split(',').collect { |url| { asseturl: url.strip } }

View File

@ -0,0 +1,38 @@
<li>
<p>
<strong>videocode</strong>
<%= videolisting.videocode %>
</p>
<p>
<strong>producttypeid</strong>
<%= videolisting.producttypeid %>
</p>
<p>
<strong>voiceoverselection</strong>
<%= videolisting.voiceoverselection %>
</p>
<p>
<strong>musicselection</strong>
<%= videolisting.musicselection %>
</p>
<p>
<strong>clientprovidedscript</strong>
<%= videolisting.clientprovidedscript %>
</p>
<p>
<strong>keywords</strong>
<%= videolisting.keywords %>
</p>
<p>
<strong>focus</strong>
<%= videolisting.focus %>
</p>
<p>
<strong>notes</strong>
<%= videolisting.notes %>
</p>
<p>
<strong>asseturls</strong>
<%= videolisting.asseturls %>
</p>
</li>

View File

@ -60,21 +60,18 @@
<%= @campaign.customerlastname %>
</p>
<p>
<strong>Salesrep:</strong>
<%= @campaign.salesrep %>
</p>
<p>
<strong>Salesrepemail:</strong>
<%= @campaign.salesrepemail %>
</p>
<p>
<strong>Businessphone:</strong>
<%= @campaign.businessphone %>
</p>
<p>
<strong>Description:</strong>
<%= @campaign.description %>
</p>
<p>
<strong>Contactphone:</strong>
<%= @campaign.contactphone %>
@ -87,53 +84,12 @@
</div>
<div class="col-md-4">
<ul>
<% @campaign.videolistings.each do |vl| %>
<li>
<p>
<strong>videocode</strong>
<%= vl.videocode %>
</p>
<p>
<strong>producttypeid</strong>
<%= vl.producttypeid %>
</p>
<p>
<strong>remoteassetsarchive</strong>
<%= vl.remoteassetsarchive %>
</p>
<p>
<strong>voiceoverselection</strong>
<%= vl.voiceoverselection %>
</p>
<p>
<strong>musicselection</strong>
<%= vl.musicselection %>
</p>
<p>
<strong>clientprovidedscript</strong>
<%= vl.clientprovidedscript %>
</p>
<p>
<strong>keywords</strong>
<%= vl.keywords %>
</p>
<p>
<strong>focus</strong>
<%= vl.focus %>
</p>
<p>
<strong>notes</strong>
<%= vl.notes %>
</p>
<p>
<strong>asseturls</strong>
<%= vl.asseturls %>
</p>
</li>
<% @campaign.videolistings.each do |videolisting| %>
<%= render 'videolisting', videolisting: videolisting %>
<% end %>
<% if @campaign.videolistings.empty? %>
No Video Listings for this Campaign.
<li>No Video Listings for this Campaign.</li>
<% end %>
</ul>