Get clientid as an in the @set_campaign so it can get it better.
This commit is contained in:
parent
e5c38401ae
commit
6370dcab69
@ -22,7 +22,6 @@ class CampaignsController < ApplicationController
|
|||||||
|
|
||||||
def edit
|
def edit
|
||||||
@action = campaign_path(@campaign.clientid)
|
@action = campaign_path(@campaign.clientid)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +53,8 @@ class CampaignsController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
def set_campaign
|
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
|
end
|
||||||
|
|
||||||
def campaign_params
|
def campaign_params
|
||||||
@ -73,7 +73,6 @@ class CampaignsController < ApplicationController
|
|||||||
raise ActionController::RoutingError.new("Not Found by clientid")
|
raise ActionController::RoutingError.new("Not Found by clientid")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def set_api_key
|
def set_api_key
|
||||||
@BETTER_VIDEO_API_KEY = ENV['BETTER_VIDEO_API_KEY']
|
@BETTER_VIDEO_API_KEY = ENV['BETTER_VIDEO_API_KEY']
|
||||||
@BETTER_VIDEO_API_KEY ||= "propel test key"
|
@BETTER_VIDEO_API_KEY ||= "propel test key"
|
||||||
|
@ -6,6 +6,8 @@ class Campaign < ActiveRecord::Base
|
|||||||
validates :listingcode, presence: true, uniqueness: true
|
validates :listingcode, presence: true, uniqueness: true
|
||||||
validates :advertisername, presence: true
|
validates :advertisername, presence: true
|
||||||
validates :websiteurl, presence: true
|
validates :websiteurl, presence: true
|
||||||
|
validates :description, presence: true
|
||||||
|
validates :productsandservices, presence: true
|
||||||
|
|
||||||
after_create :send_to_better_video
|
after_create :send_to_better_video
|
||||||
def send_to_better_video
|
def send_to_better_video
|
||||||
|
@ -2,6 +2,9 @@ class Videolisting < ActiveRecord::Base
|
|||||||
belongs_to :campaign
|
belongs_to :campaign
|
||||||
validates :videocode, presence: true, uniqueness: true
|
validates :videocode, presence: true, uniqueness: true
|
||||||
validates :producttypeid, presence: true
|
validates :producttypeid, presence: true
|
||||||
|
validates :voiceoverselection, presence: true
|
||||||
|
validates :musicselection, presence: true
|
||||||
|
|
||||||
|
|
||||||
def asseturls_array
|
def asseturls_array
|
||||||
self.asseturls.split(',').collect { |url| { asseturl: url.strip } }
|
self.asseturls.split(',').collect { |url| { asseturl: url.strip } }
|
||||||
|
38
app/views/campaigns/_videolisting.html.erb
Normal file
38
app/views/campaigns/_videolisting.html.erb
Normal 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>
|
@ -60,15 +60,6 @@
|
|||||||
<%= @campaign.customerlastname %>
|
<%= @campaign.customerlastname %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Salesrep:</strong>
|
|
||||||
<%= @campaign.salesrep %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Salesrepemail:</strong>
|
|
||||||
<%= @campaign.salesrepemail %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Businessphone:</strong>
|
<strong>Businessphone:</strong>
|
||||||
@ -76,6 +67,12 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
<strong>Description:</strong>
|
||||||
|
<%= @campaign.description %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
<strong>Contactphone:</strong>
|
<strong>Contactphone:</strong>
|
||||||
<%= @campaign.contactphone %>
|
<%= @campaign.contactphone %>
|
||||||
</p>
|
</p>
|
||||||
@ -87,53 +84,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<ul>
|
<ul>
|
||||||
<% @campaign.videolistings.each do |vl| %>
|
<% @campaign.videolistings.each do |videolisting| %>
|
||||||
<li>
|
<%= render 'videolisting', videolisting: videolisting %>
|
||||||
<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>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @campaign.videolistings.empty? %>
|
<% if @campaign.videolistings.empty? %>
|
||||||
No Video Listings for this Campaign.
|
<li>No Video Listings for this Campaign.</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user