<%= navigation %>
<%= render 'show_graph' %> <% javascript_tag do %> function suggest_changes (refresh) { if (!refresh) $("suggest-result").innerHTML = "Searching..."; $("suggest-result").show(); new Ajax.Updater({success: 'suggest-result'}, '<%= suggest_change_authorization_rules_path %>', { method: 'get', onFailure: function(request) { $("suggest-result").innerHTML = "Error while searching." }, parameters: $H($('change').down('form').serialize(true)).merge(refresh ? {show_all: "true"} : {}).toQueryString() }); if (!refresh) location.hash = 'suggest-result'; } function show_suggest_graph (changes, filter_roles_params, filter_context, user_ids) { var params = {changes: changes, highlight_privilege: $F('privilege')}; if (filter_context) params['filter_contexts'] = filter_context; if (user_ids) params['user_ids[]'] = user_ids; show_graph_with_params('suggest-graph', params); } document.observe('dom:loaded', function() { install_change_observers(); }); function install_change_observers () { $$('#change select').each(function (el) { el.observe('change', function (event) { new Ajax.Updater({success: 'change'}, '<%= url_for %>', { parameters: { context: $F('context'), privilege: $F('privilege') }, method: 'get', onComplete: function () { install_change_observers(); if ($('graph-container').visible()) show_current_permissions(); } }); }); }); $('prohibited_actions').observe('click', function (event) { var target = event.findElement(); if (target.hasClassName('remove')) { target.up().remove(); if ($('prohibited_actions').childElements().length == 0) $('prohibited_actions').previous().hide(); suggest_changes(); } }); } function show_current_permissions () { show_graph($F('privilege'), $F('context')/*, relevant_user_ids()*/); } function relevant_user_ids () { return $$('#change .user_id').collect(function (el) { return el.innerHTML; }).reject(function (id) { return $('user_' + id + '_permission_undetermined').checked; }); } var prohibited_action_template = new Template('