Sha256: 132d0e811239a14c5ccbe1a2d447c58de2529f5462177fb1c81195ed0f0c1b8f

Contents?: true

Size: 1.13 KB

Versions: 456

Compression:

Stored size: 1.13 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(@site.id, ' - ').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

456 entries across 456 versions & 1 rubygems

Version Path
caboose-cms-0.9.170 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.169 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.168 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.167 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.166 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.165 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.164 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.163 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.162 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.161 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.160 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.159 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.158 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.157 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.156 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.155 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.154 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.153 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.152 app/views/caboose/roles/new.html.erb
caboose-cms-0.9.151 app/views/caboose/roles/new.html.erb