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 { .videolisting {
label { label {
color: #fff; color: #fff;
float: left;
} }
input {border: 2px inset;} input {border: 2px inset;}

View File

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

View File

@ -1,54 +1,68 @@
<%= simple_form_for(@campaign, html: {class: 'form-horizontal'}) do |frm| %> <%= simple_form_for(@campaign, html: {class: 'form-horizontal'}) do |frm| %>
<% if @campaign.errors.any? %> <div class="row">
<div id="error_explanation"> <div class="col-md-1"></div>
<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="col-md-10">
<%= frm.input :clientid, label: 'Client ID' %> <% if @campaign.errors.any? %>
<%= frm.input :listingcode, label: 'Listing Code' %> <div id="error_explanation">
<%= frm.input :websiteurl, label: 'Website URL'%> <h2><%= pluralize(@campaign.errors.count, "error") %> prohibited this campaign from being saved:</h2>
<%= frm.input :advertisername, label: 'Advertiser Name' %> <ul>
<%= frm.input :billingcode, label: 'Billing Code' %> <% @campaign.errors.full_messages.each do |msg| %>
<%= frm.input :emailaddress, label: 'Email Address' %> <li><%= msg %></li>
<%= frm.input :salesrep, label: 'Sales Rep' %> <% end %>
<%= frm.input :salesrepemail, label: 'Sales Rep Email' %> </ul>
<%= frm.input :businessphone, label: 'Business Phone' %> </div>
<%= frm.input :contactphone, label: 'Contact Phone' %> <% end %>
</div>
<%= frm.input :customerfirstname, label: 'Customer First Name' %> <div class="col-md-1"></div>
<%= 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> </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"> <div class="actions">
<%= frm.submit %> <%= frm.submit %>

View File

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