Sha256: 19b7e5efe3712ea3645066250bfed622f14111f7552c5e185b5f66c89f589bf6

Contents?: true

Size: 1.12 KB

Versions: 384

Compression:

Stored size: 1.12 KB

Contents

<h1>New role</h1>

<form action='/admin/roles' method='post' id='new_role_form'>
<input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' /> 
<p><select name='parent_id'>
  <option value=''>-- Select a parent role --</option>
  <% Caboose::Role.flat_tree(' - ').each do |r| %>
    <option value='<%= r.id %>'><%= r.name %></option>
  <% end %>
</select></p>
<p><input type='text' name='name' id='name' placeholder='Name' value='' style='width: 200px;' /></p>
<div id='message'></div>
<p><input type='submit' value='Add Role' /></p>
</form>

<% content_for :caboose_js do %>
<script type='text/javascript'>

$(document).ready(function() {
  $('#new_role_form').submit(function() { add_role(); return false; });
});

function add_role()
{
  $('#message').html("<p class='loading'>Adding role...</p>");
  $.ajax({
    url: '/admin/roles',
    type: 'post',
    data: $('#new_role_form').serialize(),
    success: function(resp) {
      if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
      if (resp.redirect) window.location = resp.redirect;    
    }
  });
}

</script>
<% end %>

Version data entries

384 entries across 384 versions & 1 rubygems

Version Path
caboose-cms-0.5.213 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.212 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.211 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.210 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.209 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.208 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.207 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.206 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.205 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.204 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.203 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.202 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.201 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.200 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.199 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.198 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.197 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.196 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.195 app/views/caboose/roles/new.html.erb
caboose-cms-0.5.194 app/views/caboose/roles/new.html.erb