Add helpers for convering simple_form collection to a hash and getting it back. clean up styling for show

This commit is contained in:
Tyrel Souza 2014-04-22 13:44:49 -04:00
parent 6e76c4d480
commit 466141adad
6 changed files with 194 additions and 68 deletions

View File

@ -45,4 +45,15 @@ textarea {
select {
width:100%;
}
.campaign-item, .videolisting-item {
display:block;
strong {
display:block;
}
span {
padding-left: 2em;
}
}

View File

@ -1,21 +1,32 @@
module ApplicationHelper
def producttypeid_list
def producttypeid_list(options={})
producttypeids = []
producttypeids << ["720 - Basic Montage", 720]
producttypeids << ["721 - Advanced Montage", 721]
producttypeids << ["722 - Basic Video Shoot", 722]
producttypeids << ["723 - Repurposed", 723]
producttypeids << ["724 - Repurposed Edit", 724]
if options.empty?
return producttypeids
else
convert_to_hash(producttypeids)[options[:item]]
end
end
def voiceoverselection_list
def voiceoverselection_list(options={})
voiceoverselections = []
voiceoverselections << ["1 - Male", 1]
voiceoverselections << ["2 - Female", 2]
voiceoverselections << ["3 - No Preference", 3]
if options.empty?
return voiceoverselections
else
convert_to_hash(voiceoverselections)[options[:item]]
end
end
def musicselection_list
def musicselection_list(options={})
musicselections = []
musicselections << ["0 - No Preference", 0]
musicselections << ["1 - Easy", 1]
@ -24,5 +35,77 @@ module ApplicationHelper
musicselections << ["4 - New Age", 4]
musicselections << ["5 - Positive", 5]
musicselections << ["6 - Rock", 6]
if options.empty?
return musicselections
else
convert_to_hash(musicselections)[options[:item]]
end
end
def us_states
[
['Alabama', 'AL'],
['Alaska', 'AK'],
['Arizona', 'AZ'],
['Arkansas', 'AR'],
['California', 'CA'],
['Colorado', 'CO'],
['Connecticut', 'CT'],
['Delaware', 'DE'],
['District of Columbia', 'DC'],
['Florida', 'FL'],
['Georgia', 'GA'],
['Hawaii', 'HI'],
['Idaho', 'ID'],
['Illinois', 'IL'],
['Indiana', 'IN'],
['Iowa', 'IA'],
['Kansas', 'KS'],
['Kentucky', 'KY'],
['Louisiana', 'LA'],
['Maine', 'ME'],
['Maryland', 'MD'],
['Massachusetts', 'MA'],
['Michigan', 'MI'],
['Minnesota', 'MN'],
['Mississippi', 'MS'],
['Missouri', 'MO'],
['Montana', 'MT'],
['Nebraska', 'NE'],
['Nevada', 'NV'],
['New Hampshire', 'NH'],
['New Jersey', 'NJ'],
['New Mexico', 'NM'],
['New York', 'NY'],
['North Carolina', 'NC'],
['North Dakota', 'ND'],
['Ohio', 'OH'],
['Oklahoma', 'OK'],
['Oregon', 'OR'],
['Pennsylvania', 'PA'],
['Puerto Rico', 'PR'],
['Rhode Island', 'RI'],
['South Carolina', 'SC'],
['South Dakota', 'SD'],
['Tennessee', 'TN'],
['Texas', 'TX'],
['Utah', 'UT'],
['Vermont', 'VT'],
['Virginia', 'VA'],
['Washington', 'WA'],
['West Virginia', 'WV'],
['Wisconsin', 'WI'],
['Wyoming', 'WY']
]
end
private
def convert_to_hash(list)
list.map!{|x| x= x[1],x[0]}
return Hash[*list.flatten]
end
end

View File

@ -26,9 +26,11 @@
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-5">
<%= frm.input :advertisername,
label: 'Advertiser Name',
hint: "The name of the company." %>
<%= frm.input :clientid,
label: 'Client ID',
label: 'Client ID',
hint: 'An identifier provided by BetterVideo.' %>
<%= frm.input :listingcode,
label: 'Listing Code',
@ -36,9 +38,7 @@
<%= frm.input :websiteurl,
label: 'Website URL',
hint: "Used for script research and may be used in the video if they are including websites in the video graphics." %>
<%= frm.input :advertisername,
label: 'Advertiser Name',
hint: "The name of the company." %>
<%= frm.input :vpa,
label: 'Client Service Rep',
hint: "This is the full name of the client services representative, as entered in the BetteVideo system associated with this order. This feature is designed for sales reps that are well known to the system. This feature is typically used for automated communication." %>
@ -61,7 +61,8 @@
<%= frm.input :city,
label: 'City' %>
<%= frm.input :state,
label: 'State' %>
label: 'State',
collection: us_states%>
<%= frm.input :zip,
label: 'ZIP' %>
@ -80,6 +81,7 @@
placeholder: "ex: red, white, blue" %>
<%= frm.input :description,
label: 'Description',
as: 'text',
hint: "Used for script research." %>
<%= frm.input :facebookurl,
label: 'Facebook URL',

View File

@ -1,38 +1,38 @@
<li>
<p>
<span class="videolisting-item">
<strong>videocode</strong>
<%= videolisting.videocode %>
</p>
<p>
<span><%= videolisting.videocode %></span>
</span>
<span class="videolisting-item">
<strong>producttypeid</strong>
<%= videolisting.producttypeid %>
</p>
<p>
<span><%= producttypeid_list item:videolisting.producttypeid %></span>
</span>
<span class="videolisting-item">
<strong>voiceoverselection</strong>
<%= videolisting.voiceoverselection %>
</p>
<p>
<span><%= voiceoverselection_list item:videolisting.voiceoverselection %></span>
</span>
<span class="videolisting-item">
<strong>musicselection</strong>
<%= videolisting.musicselection %>
</p>
<p>
<span><%= musicselection_list item:videolisting.musicselection %></span>
</span>
<span class="videolisting-item">
<strong>clientprovidedscript</strong>
<%= videolisting.clientprovidedscript %>
</p>
<p>
<span><%= videolisting.clientprovidedscript %></span>
</span>
<span class="videolisting-item">
<strong>keywords</strong>
<%= videolisting.keywords %>
</p>
<p>
<span><%= videolisting.keywords %></span>
</span>
<span class="videolisting-item">
<strong>focus</strong>
<%= videolisting.focus %>
</p>
<p>
<span><%= videolisting.focus %></span>
</span>
<span class="videolisting-item">
<strong>notes</strong>
<%= videolisting.notes %>
</p>
<p>
<span><%= videolisting.notes %></span>
</span>
<span class="videolisting-item">
<strong>asseturls</strong>
<%= videolisting.asseturls %>
</p>
<span><%= videolisting.asseturls %></span>
</span>
</li>

View File

@ -1,6 +1,6 @@
<%= link_to 'Show', @campaign %> |
<%= link_to 'Show', campaign_path(@campaign.listingcode) %> |
<%= link_to 'Back', campaigns_path %>
<h1>Editing campaign</h1>
<h1>Editing <%= @campaign.advertisername %></h1>
<%= render 'form' %>
<%= render 'form' %>

View File

@ -12,48 +12,78 @@
<div class="col-md-8">
<div class="col-md-2"></div>
<div class="col-md-4">
<strong>Clientid:</strong>
<%= @campaign.clientid %>
<span class="campaign-item">
<strong>Clientid</strong>
<span><%= @campaign.clientid %></span>
</span>
<strong>Listingcode:</strong>
<%= @campaign.listingcode %>
<span class="campaign-item">
<strong>Listingcode</strong>
<span><%= @campaign.listingcode %></span>
</span>
<strong>Billingcode:</strong>
<%= @campaign.billingcode %>
<span class="campaign-item">
<strong>Billingcode</strong>
<span><%= @campaign.billingcode %></span>
</span>
<strong>Address1:</strong>
<%= @campaign.address %>
<span class="campaign-item">
<strong>Address1</strong>
<span><%= @campaign.address %></span>
</span>
<strong>City:</strong>
<%= @campaign.city %>
<span class="campaign-item">
<strong>City</strong>
<span><%= @campaign.city %></span>
</span>
<strong>State:</strong>
<%= @campaign.state %>
<span class="campaign-item">
<strong>State</strong>
<span><%= @campaign.state %></span>
</span>
<strong>Zip:</strong>
<%= @campaign.zip %>
<span class="campaign-item">
<strong>Zip</strong>
<span><%= @campaign.zip %></span>
</span>
<strong>Email Address:</strong>
<%= @campaign.emailaddress %>
<span class="campaign-item">
<strong>Email Address</strong>
<span><%= @campaign.emailaddress %></span>
</span>
<strong>Customer First Name:</strong>
<%= @campaign.customerfirstname %>
<span class="campaign-item">
<strong>Customer First Name</strong>
<span><%= @campaign.customerfirstname %></span>
</span>
<strong>Customer Last Name:</strong>
<%= @campaign.customerlastname %>
<span class="campaign-item">
<strong>Customer Last Name</strong>
<span><%= @campaign.customerlastname %></span>
</span>
<strong>Businessphone:</strong>
<%= @campaign.businessphone %>
<span class="campaign-item">
<strong>Businessphone</strong>
<span><%= @campaign.businessphone %></span>
</span>
<strong>Description:</strong>
<%= @campaign.description %>
<strong>Contactphone:</strong>
<%= @campaign.contactphone %>
<span class="campaign-item">
<strong>Description</strong>
<span><%= @campaign.description %></span>
</span>
<strong>Websiteurl:</strong>
<%= @campaign.websiteurl %>
</div>
<span class="campaign-item">
<strong>Contactphone</strong>
<span><%= @campaign.contactphone %></span>
</span>
<span class="campaign-item">
<strong>Websiteurl</strong>
<span><%= @campaign.websiteurl %></span>
</span>
</div>
<div class="col-md-4">
<ul>
<% @campaign.videolistings.each do |videolisting| %>