Sha256: 90ebe0010c9a34a33119123072b684d5c775fd73ec8eb364729e25bec1d7bf16

Contents?: true

Size: 1.32 KB

Versions: 455

Compression:

Stored size: 1.32 KB

Contents

<h1>New Category</h1>

<form action="/admin/categories" method="post" id="new_form">
  <input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />
	<p><input type="text" name="name" id='name' placeholder="Category Name" /></p>
	<div id="message"></div>	
	<input type="button" value="< Back" onclick="window.location='/admin/post-categories';" />
	<input type="submit" value="Add Category"  onclick="add_category(); return false" />
</form>

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

function add_category() {
  $('#message').html("<p class='loading'>Adding category...</p>");
	var stay = $('#stay').prop('checked');
	
	$.ajax({
		url: '/admin/post-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)
			{
			  if (stay)
        {
          $('#name').val('');          
          get_category_options();
          $('#message').html("<p class='note succes'>The category has been added successfully.</p>");
          setTimeout(function() { $('#message').empty(); }, 2000);
        }
        else if (resp.redirect)
          window.location = resp.redirect;
      }
		}
	});
}


</script>
<% end %>

Version data entries

455 entries across 455 versions & 1 rubygems

Version Path
caboose-cms-0.6.31 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.30 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.29 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.28 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.27 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.26 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.25 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.24 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.23 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.22 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.21 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.20 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.19 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.18 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.17 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.16 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.15 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.14 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.13 app/views/caboose/post_categories/admin_new.html.erb
caboose-cms-0.6.12 app/views/caboose/post_categories/admin_new.html.erb