Sha256: 906e3a7a8b5369f8d37087010e4c4d43dafe5f006058dd0c665a5ad3700b0de2

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

<%
p = @product
%>
<h1>New Category</h1>

<form action='/admin/categories' method='post' id='new_form'>
<select name='parent_id'>
  <option value=''>-- Parent Category --</option>
  <%= raw categories_options(@top_category) %>
</select>
<input type='hidden' name='authenticity_token' value="<%= form_authenticity_token %>" />
<p><input type='text' name='name' value='' placeholder='Category Name' style='width: 400px;' /></p>
<div id='message'></div>
<p>
<input type='button' value='< Back' onclick="window.location='/admin/categories';" />
<input type='submit' value='Add Category' onclick='add_category(); return false' />
</p>
</form>

<% content_for :caboose_js do %>
<%= javascript_include_tag "caboose/model/all" %>
<script type='text/javascript'>

function add_category()
{
  modal.autosize("<p class='loading'>Adding category...</p>");
  $.ajax({
    url: '/admin/categories',
    type: 'post',
    data: $('#new_form').serialize(),
    success: function(resp) {
      if (resp.error)
        modal.autosize("<p class='note error'>" + resp.error + "</p>");
      if (resp.redirect)
        window.location = resp.redirect    
    }
  });
}

var modal = false;
$(window).load(function() {
  modal = new CabooseModal(800);
});
</script>
<% end %>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
caboose-store-0.0.10 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.9 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.8 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.7 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.6 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.5 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.4 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.3 app/views/caboose_store/categories/admin_new.html.erb
caboose-store-0.0.2 app/views/caboose_store/categories/admin_new.html.erb