fix types, coverage up to 99.26%

This commit is contained in:
Tyrel Souza 2014-04-25 16:35:42 -04:00
parent 5739401cad
commit fc0d96e481
7 changed files with 35 additions and 42 deletions

View File

@ -16,23 +16,10 @@ class ApplicationController < ActionController::Base
end
end
private
def authenticate_user_from_token!
if request.headers["HTTP_AUTHORIZATION"]
authenticate_or_request_with_http_token do |token, options|
email = token.split[1].split("=")[1]
token = token.split[0]
user_email = email.presence
end
else
user_email = params[:user_email].presence
token = params[:user_token]
end
log_it_in(token, user_email)
end
def log_it_in(token, user_email)
user_email = params[:user_email].presence
token = params[:user_token]
user = user_email && User.find_by_email(user_email)
if user && Devise.secure_compare(user.authentication_token, token)
sign_in user, store: false

View File

@ -25,10 +25,11 @@
<% end %>
<% unless videolisting.asseturls.empty? %>
<li>
<p><strong>asseturls</strong><br>
<p><strong>asseturls</strong><br />
<% videolisting.asseturls_array.each do |asset| %>
<%= asset[:asseturl] %></p>
<%= asset[:asseturl] %><br />
<% end %>
</p>
</li>
<% end %>
</ul>

View File

@ -10,121 +10,121 @@
<div class="row">
<div class="col-md-8">
<ul>
<% unless @campaign.listingcode.empty? %>
<% unless @campaign.listingcode.blank? %>
<li>
<p><strong>Listing Code</strong><br>
<%= @campaign.listingcode %></p>
</li>
<% end %>
<% unless @campaign.description.empty? %>
<% unless @campaign.description.blank? %>
<li>
<p><strong>Description</strong><br>
<%= @campaign.description %></p>
</li>
<% end %>
<% unless @campaign.productsandservices.empty? %>
<% unless @campaign.productsandservices.blank? %>
<li>
<p><strong>Products & Services</strong><br>
<%= @campaign.productsandservices %></p>
</li>
<% end %>
<% unless @campaign.websiteurl.empty? %>
<% unless @campaign.websiteurl.blank? %>
<li>
<p><strong>Websiteurl</strong><br>
<%= @campaign.websiteurl %></p>
</li>
<% end %>
<% unless @campaign.vpa.empty? %>
<% unless @campaign.vpa.blank? %>
<li>
<p><strong>Client Services Rep</strong><br>
<%= @campaign.vpa %></p>
</li>
<% end %>
<% unless @campaign.billingcode.empty? %>
<% unless @campaign.billingcode.blank? %>
<li>
<p><strong>Billing Code</strong><br>
<%= @campaign.billingcode %></p>
</li>
<% end %>
<% unless @campaign.emailaddress.empty? %>
<% unless @campaign.emailaddress.blank? %>
<li>
<p><strong>Email Address</strong><br>
<%= @campaign.emailaddress %></p>
</li>
<% end %>
<% unless @campaign.businessphone.empty? %>
<% unless @campaign.businessphone.blank? %>
<li>
<p><strong>Business Phone</strong><br>
<%= number_to_phone @campaign.businessphone %></p>
</li>
<% end %>
<% unless @campaign.contactphone.empty? %>
<% unless @campaign.contactphone.blank? %>
<li>
<p><strong>Contact Phone</strong><br>
<%= number_to_phone @campaign.contactphone %></p>
</li>
<% end %>
<% unless @campaign.customerfirstname.empty? %>
<% unless @campaign.customerfirstname.blank? %>
<li>
<p><strong>Customer First Name</strong><br>
<%= @campaign.customerfirstname %></p>
</li>
<% end %>
<% unless @campaign.customerlastname.empty? %>
<% unless @campaign.customerlastname.blank? %>
<li>
<p><strong>Customer Last Name</strong><br>
<%= @campaign.customerlastname %></p>
</li>
<% end %>
<% unless @campaign.address.empty? %>
<% unless @campaign.address.blank? %>
<li>
<p><strong>Address</strong><br>
<%= @campaign.address %></p>
</li>
<% end %>
<% if @campaign.city.empty? || @campaign.state || @campaign.zip %>
<% if @campaign.city.blank? || @campaign.state || @campaign.zip %>
<li>
<p><strong>City, State, Zip</strong><br>
<%= @campaign.city %>, <%= us_states item: @campaign.state %>, <%= @campaign.zip %></p>
</li>
<% end %>
<% unless @campaign.awards %>.empty?
<% unless @campaign.awards.blank? %>
<li>
<p><strong>Awards</strong><br>
<%= @campaign.awards %></p>
</li>
<% end %>
<% unless @campaign.background.empty? %>
<% unless @campaign.background.blank? %>
<li>
<p><strong>Background</strong><br>
<%= @campaign.background %></p>
</li>
<% end %>
<% unless @campaign.categories.empty? %>
<% unless @campaign.categories.blank? %>
<li>
<p><strong>Industry Categories</strong><br>
<%= @campaign.categories %></p>
</li>
<% end %>
<% unless @campaign.companycolors.empty? %>
<% unless @campaign.companycolors.blank? %>
<li>
<p><strong>Company Colors</strong><br>
<%= @campaign.companycolors %></p>
</li>
<% end %>
<% unless @campaign.facebookurl.empty? %>
<% unless @campaign.facebookurl.blank? %>
<li>
<p><strong>Facebook URL</strong><br>
<%= @campaign.facebookurl %></p>
</li>
<% end %>
<% unless @campaign.targetaudience.empty? %>
<% unless @campaign.targetaudience.blank? %>
<li>
<p><strong>Target Audience</strong><br>
<%= @campaign.targetaudience %></p>
</li>
<% end %>
<% unless @campaign.tollfreephone.empty? %>
<% unless @campaign.tollfreephone.blank? %>
<li>
<p><strong>Tollfree Phone</strong><br>
<%= @campaign.tollfreephone %></p>
@ -137,7 +137,7 @@
<% @campaign.videolistings.each do |videolisting| %>
<li class="blue-box"><%= render 'videolisting', videolisting: videolisting %></li>
<% end %>
<% if @campaign.videolistings.empty? %>
<% if @campaign.videolistings.blank? %>
<li><p>No Video Listings for this Campaign.</p></li>
<% end %>
</ul>

View File

@ -11,8 +11,9 @@ Vidpush::Application.routes.draw do
resources :campaigns, param: :listingcode do
resources :videolistings, param: :videocode do
member do
get 'publish',:defaults => { :format => 'json' }
get 'publish', defaults: { :format => 'json' }
end
end
end
end

View File

@ -2,6 +2,5 @@ class ChangeFieldTypesVideolisting < ActiveRecord::Migration
def change
change_column :videolistings, :notes, :text
change_column :videolistings, :clientprovidedscript, :text
end
end

View File

@ -0,0 +1,5 @@
class ChangeFieldTypesCampaigns < ActiveRecord::Migration
def change
change_column :campaigns, :description, :text
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140425200716) do
ActiveRecord::Schema.define(version: 20140425201114) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -57,7 +57,7 @@ ActiveRecord::Schema.define(version: 20140425200716) do
t.string "background"
t.string "categories"
t.string "companycolors"
t.string "description"
t.text "description"
t.string "facebookurl"
t.string "productsandservices"
t.string "targetaudience"