Sha256: 31d24ca693be2138079e693ab496d0c402ab1a0d5cdf8259d4ce8ef8f579cb84
Contents?: true
Size: 1.46 KB
Versions: 401
Compression:
Stored size: 1.46 KB
Contents
<h1>New Vendor</h1> <form id="new-vendor" action="/admin/vendors" method="post"> <input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" /> <p><input id="name" name="name" id='name' type="text" placeholder="Vendor Name" style="width: 400px" /></p> <p><input type='checkbox' name='stay' id='stay' value='1' /> Stay here so I can add another vendor</p> <div id='message'></div> <p> <input type="button" value="< Back" onclick="window.location='/admin/vendors';" /> <input type="submit" value="Add Vendor" /> </p> </form> <% content_for :caboose_js do %> <script> $(document).ready(function() { $('#new-vendor').on('submit', function(event) { event.preventDefault(); var stay = $('#stay').prop('checked'); $('#message').html("<p class='loading'>Adding vendor...</p>"); $.ajax({ url: '/admin/vendors', type: 'post', data: $('#new-vendor').serialize(), success: function(resp) { if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>"); else { if (stay) { $('#name').val(''); $('#message').html("<p class='note succes'>The vendor has been added successfully.</p>"); setTimeout(function() { $('#message').empty(); }, 2000); } else if (resp.redirect) window.location = resp.redirect; } } }); }); }); </script> <% end %>
Version data entries
401 entries across 401 versions & 1 rubygems