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
end end
private private
def authenticate_user_from_token! 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 user_email = params[:user_email].presence
token = params[:user_token] token = params[:user_token]
end
log_it_in(token, user_email)
end
def log_it_in(token, user_email)
user = user_email && User.find_by_email(user_email) user = user_email && User.find_by_email(user_email)
if user && Devise.secure_compare(user.authentication_token, token) if user && Devise.secure_compare(user.authentication_token, token)
sign_in user, store: false sign_in user, store: false

View File

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

View File

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

View File

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

View File

@ -2,6 +2,5 @@ class ChangeFieldTypesVideolisting < ActiveRecord::Migration
def change def change
change_column :videolistings, :notes, :text change_column :videolistings, :notes, :text
change_column :videolistings, :clientprovidedscript, :text change_column :videolistings, :clientprovidedscript, :text
end end
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. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -57,7 +57,7 @@ ActiveRecord::Schema.define(version: 20140425200716) do
t.string "background" t.string "background"
t.string "categories" t.string "categories"
t.string "companycolors" t.string "companycolors"
t.string "description" t.text "description"
t.string "facebookurl" t.string "facebookurl"
t.string "productsandservices" t.string "productsandservices"
t.string "targetaudience" t.string "targetaudience"