update form, prevent removal of all videolistings

This commit is contained in:
Tyrel Souza 2014-04-25 17:14:09 -04:00
parent fc0d96e481
commit 3b784fb493
4 changed files with 19 additions and 5 deletions

View File

@ -2,4 +2,9 @@ Vidpush
=======
[![Build Status](https://circleci.com/gh/propelmarketing/vidpush.png?circle-token=46474007c0807cf4b467fb96d7736422b2fa58a7)](https://circleci.com/gh/propelmarketing/vidpush)
[![Code Climate](https://codeclimate.com/repos/535a76efe30ba01da902dc6b/badges/f1bfeadbed33f25ef547/gpa.png)](https://codeclimate.com/repos/535a76efe30ba01da902dc6b/feed)
Vidpush is the middleman between Intake Forms and BetterVideo(vendor).

View File

@ -0,0 +1,9 @@
/**
* Created by tsouza on 4/25/14.
*/
/* Prevent the user from removing the last videolisting. Requires one at all times.*/
$("body").on('click',"a.remove_fields",function() {
return $(".videolisting_field").length > 1;
});

View File

@ -4,16 +4,15 @@
file: :vertical_file_input,
boolean: :vertical_boolean
}) do |frm| %>
<!-- <% if @campaign.errors.any? %>
<!--<% if @campaign.errors.any? %>
<div class="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>
<li class="alert alert-danger"><%= msg %></li>
<% end %>
</ul>
</div>
<% end %> -->
<% end %>-->
<div class="row">
<div class="col-md-8">
@ -84,6 +83,7 @@
</div>
<div class="col-md-4 videolisting">
<%= frm.simple_fields_for(:videolistings, html: {class: 'form-horizontal'}) do |videolisting| %>
<%= render 'videolisting_fields', :f => videolisting %>
<% end %>

View File

@ -1,4 +1,4 @@
<div class="nested-fields">
<div class="nested-fields videolisting_field">
<%= f.input :voiceoverselection,
label: 'Voiceover Selection',
collection: voiceoverselection_list,