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