Change clientid param to listingcode param
This commit is contained in:
parent
754576a440
commit
b52a71e7c9
@ -17,7 +17,7 @@ class CampaignsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@action = campaign_path(@campaign.clientid)
|
@action = campaign_path(@campaign.listingcode)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ class CampaignsController < ApplicationController
|
|||||||
if @campaign.save
|
if @campaign.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json { render json: @campaign }
|
format.json { render json: @campaign }
|
||||||
format.html { redirect_to campaign_path(@campaign.clientid), notice: 'Campaign was successfully created.' }
|
format.html { redirect_to campaign_path(@campaign.listingcode), notice: 'Campaign was successfully created.' }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
@ -39,7 +39,7 @@ class CampaignsController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @campaign.update(campaign_params)
|
if @campaign.update(campaign_params)
|
||||||
redirect_to campaign_path(@campaign.clientid), notice: 'Campaign was successfully updated.'
|
redirect_to campaign_path(@campaign.listingcode), notice: 'Campaign was successfully updated.'
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json { render json: {error: @campaign.errors.full_messages } }
|
format.json { render json: {error: @campaign.errors.full_messages } }
|
||||||
@ -55,11 +55,11 @@ class CampaignsController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
def set_campaign
|
def set_campaign
|
||||||
clientid = params[:clientid].to_s.gsub(/\D/, '').to_i
|
listingcode = params[:listingcode]
|
||||||
if params[:campaign]
|
if params[:campaign]
|
||||||
@campaign = Campaign.find_by_clientid(params[:campaign][:clientid]) || not_found
|
@campaign = Campaign.find_by_listingcode(params[:campaign][:listingcode]) || not_found
|
||||||
else
|
else
|
||||||
@campaign = Campaign.find_by_clientid(clientid) || not_found
|
@campaign = Campaign.find_by_listingcode(listingcode) || not_found
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -84,9 +84,4 @@ class CampaignsController < ApplicationController
|
|||||||
@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"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def json_errors
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -14,5 +14,4 @@ class Campaign < ActiveRecord::Base
|
|||||||
#TODO Make API Calls
|
#TODO Make API Calls
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% @campaigns.each do |campaign| %>
|
<% @campaigns.each do |campaign| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to campaign.clientid, campaign_path(campaign.clientid) %></td>
|
<td><%= link_to campaign.listingcode, campaign_path(campaign.listingcode) %></td>
|
||||||
<td><%= campaign.listingcode %></td>
|
<td><%= campaign.listingcode %></td>
|
||||||
<td><%= campaign.billingcode %></td>
|
<td><%= campaign.billingcode %></td>
|
||||||
<td><%= campaign.address %></td>
|
<td><%= campaign.address %></td>
|
||||||
@ -26,8 +26,8 @@
|
|||||||
<td><%= campaign.state %></td>
|
<td><%= campaign.state %></td>
|
||||||
<td><%= campaign.zip %></td>
|
<td><%= campaign.zip %></td>
|
||||||
<td><%= campaign.processed? %></td>
|
<td><%= campaign.processed? %></td>
|
||||||
<td><%= link_to 'Edit', edit_campaign_path(campaign.clientid) %></td>
|
<td><%= link_to 'Edit', edit_campaign_path(campaign.listingcode) %></td>
|
||||||
<td><%= link_to 'Destroy', campaign_path(campaign.clientid), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
<td><%= link_to 'Destroy', campaign_path(campaign.listingcode), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<%= link_to 'Edit', edit_campaign_path(@campaign.clientid) %> |
|
<%= link_to 'Edit', edit_campaign_path(@campaign.listingcode) %> |
|
||||||
<%= link_to 'Back', campaigns_path %>
|
<%= link_to 'Back', campaigns_path %>
|
||||||
|
|
||||||
<div class="col-md-2"></div>
|
<div class="col-md-2"></div>
|
||||||
|
@ -9,6 +9,6 @@ Vidpush::Application.routes.draw do
|
|||||||
|
|
||||||
root to: "campaigns#index"
|
root to: "campaigns#index"
|
||||||
|
|
||||||
resources :campaigns, param: :clientid
|
resources :campaigns, param: :listingcode
|
||||||
resources :videolistings, param: :videocode
|
resources :videolistings, param: :videocode
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user