change form around. fix styles to fit bootstrap.

This commit is contained in:
Tyrel Souza 2014-04-09 17:39:48 -04:00
parent defa655392
commit dedc9b782e
4 changed files with 63 additions and 49 deletions

View File

@ -4,7 +4,6 @@ $medgray: #666;
.videolisting {
label {
color: #fff;
float: left;
}
input {border: 2px inset;}

View File

@ -20,13 +20,14 @@ class CampaignsController < ApplicationController
def edit
end
def create
@campaign = Campaign.new campaign_params
if @campaign.save
respond_to do |format|
format.json { render json: @campaign }
format.html { redirect_to @campaign, notice: 'Campaign was successfully created.' }
format.html { redirect_to campaign_path(@campaign.clientid), notice: 'Campaign was successfully created.' }
end
else
render action: 'new'

View File

@ -1,54 +1,68 @@
<%= simple_form_for(@campaign, html: {class: 'form-horizontal'}) do |frm| %>
<% if @campaign.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@campaign.errors.count, "error") %> prohibited this campaign from being saved:</h2>
<ul>
<% @campaign.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="row">
<div class="col-md-1"></div>
<%= frm.input :clientid, label: 'Client ID' %>
<%= frm.input :listingcode, label: 'Listing Code' %>
<%= frm.input :websiteurl, label: 'Website URL'%>
<%= frm.input :advertisername, label: 'Advertiser Name' %>
<%= frm.input :billingcode, label: 'Billing Code' %>
<%= frm.input :emailaddress, label: 'Email Address' %>
<%= frm.input :salesrep, label: 'Sales Rep' %>
<%= frm.input :salesrepemail, label: 'Sales Rep Email' %>
<%= frm.input :businessphone, label: 'Business Phone' %>
<%= frm.input :contactphone, label: 'Contact Phone' %>
<%= frm.input :customerfirstname, label: 'Customer First Name' %>
<%= frm.input :customerlastname, label: 'Customer Last Name' %>
<%= frm.input :address1, label: 'Address Line 1' %>
<%= frm.input :address2, label: 'Address Line 2' %>
<%= frm.input :city, label: 'City' %>
<%= frm.input :state, label: 'State' %>
<%= frm.input :zip, label: 'ZIP' %>
<div class="videolisting">
<%= frm.simple_fields_for(:videolistings, html: {class: 'form-horizontal'}) do |vidlist| %>
<div class="<%= cycle('odd','even') %>">
<%= vidlist.input :videocode, label: 'Video Code' %>
<%= vidlist.input :producttypeid, label: 'Product Type ID' %>
<%= vidlist.input :remoteassetsarchive, label: 'Remote Assets Archive' %>
<%= vidlist.input :voiceoverselection, label: 'Voiceover Selection' %>
<%= vidlist.input :musicselection, label: 'Music Selection' %>
<%= vidlist.input :clientprovidedscript, label: 'Client Provided Script' %>
<%= vidlist.input :keywords, label: 'Keywords' %>
<%= vidlist.input :focus, label: 'Focus' %>
<%= vidlist.input :notes, label: 'Notes' %>
<%= vidlist.input :asseturls, label: 'Asset Urls' %>
</div>
<% end %>
<div class="col-md-10">
<% if @campaign.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@campaign.errors.count, "error") %> prohibited this campaign from being saved:</h2>
<ul>
<% @campaign.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
</div>
<div class="col-md-1"></div>
</div>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-5">
<%= frm.input :clientid, label: 'Client ID' %>
<%= frm.input :listingcode, label: 'Listing Code' %>
<%= frm.input :websiteurl, label: 'Website URL'%>
<%= frm.input :advertisername, label: 'Advertiser Name' %>
<%= frm.input :billingcode, label: 'Billing Code' %>
<%= frm.input :emailaddress, label: 'Email Address' %>
<%= frm.input :salesrep, label: 'Sales Rep' %>
<%= frm.input :salesrepemail, label: 'Sales Rep Email' %>
<%= frm.input :businessphone, label: 'Business Phone' %>
<%= frm.input :contactphone, label: 'Contact Phone' %>
<%= frm.input :customerfirstname, label: 'Customer First Name' %>
<%= frm.input :customerlastname, label: 'Customer Last Name' %>
<%= frm.input :address1, label: 'Address Line 1' %>
<%= frm.input :address2, label: 'Address Line 2' %>
<%= frm.input :city, label: 'City' %>
<%= frm.input :state, label: 'State' %>
<%= frm.input :zip, label: 'ZIP' %>
</div>
<div class="col-md-5">
<div class="videolisting">
<%= frm.simple_fields_for(:videolistings, html: {class: 'form-horizontal'}) do |vidlist| %>
<div class="<%= cycle('odd','even') %>">
<%= vidlist.input :videocode, label: 'Video Code' %>
<%= vidlist.input :producttypeid, label: 'Product Type ID' %>
<%= vidlist.input :remoteassetsarchive, label: 'Remote Assets Archive' %>
<%= vidlist.input :voiceoverselection, label: 'Voiceover Selection' %>
<%= vidlist.input :musicselection, label: 'Music Selection' %>
<%= vidlist.input :clientprovidedscript, label: 'Client Provided Script' %>
<%= vidlist.input :keywords, label: 'Keywords' %>
<%= vidlist.input :focus, label: 'Focus' %>
<%= vidlist.input :notes, label: 'Notes' %>
<%= vidlist.input :asseturls, label: 'Asset Urls' %>
</div>
<% end %>
</div>
</div>
<div class="col-md-1"></div>
</div>
<div class="actions">
<%= frm.submit %>

View File

@ -1,5 +1,5 @@
<h1>Listing campaigns</h1>
<table>
<table class="table table-striped">
<thead>
<tr>
<th>Clientid</th>