Sha256: 0bbd5e0f642866d422068698d80b49687b728be5e6c064490a9d559285a31e53

Contents?: true

Size: 1.59 KB

Versions: 9

Compression:

Stored size: 1.59 KB

Contents

<% javascript_tag do %>
    if (typeof Prototype != 'object') {
       //load up prototype... it's needed here
       var s = document.createElement('script');
       s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js');
       document.getElementsByTagName('body')[0].appendChild(s);
    }

    function show_graph (privilege, context, user_ids) {
        var params = {
          privilege_hierarchy: 1,
          highlight_privilege: privilege,
          filter_contexts: context
        };
        if (user_ids)
          params['user_ids[]'] = user_ids;
        show_graph_with_params('graph', params);
    }

    var graph_params = {};
    function show_graph_with_params (graph_id, params) {
        graph_params[graph_id] = params;
        base_url = "<%= graph_authorization_rules_path('svg') %>";
        $(graph_id).data = base_url + '?' + Object.toQueryString(params);
        $(graph_id).up().show();
    }

    function update_graph_params (graph_id, params) {
        show_graph_with_params(graph_id,
            $H(graph_params[graph_id] || {}).merge(params).toObject());
    }

    function toggle_graph_params (graph_id) {
        var opts = {}
        $A(arguments).slice(1).each(function (param) {
          opts[param] = graph_params[graph_id][param] ? null : '1';
        });
        update_graph_params(graph_id, opts)
    }
<% end %>
<div id="graph-container" style="display:none">
<%= link_to_function "Hide", "$('graph-container').hide()", :class => 'important' %><br/>
<object id="graph" data="" type="image/svg+xml" style="max-width:100%;margin-top: 0.5em"/>
</div>

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
declarative_authorization-0.5.7 app/views/authorization_rules/_show_graph.erb
declarative_authorization-0.5.6 app/views/authorization_rules/_show_graph.erb
declarative_authorization-0.5.5 app/views/authorization_rules/_show_graph.erb
declarative_authorization-0.5.4 app/views/authorization_rules/_show_graph.erb
declarative_authorization-0.5.3 app/views/authorization_rules/_show_graph.erb
graylog2-declarative_authorization-0.5.2 app/views/authorization_rules/_show_graph.erb
declarative_authorization-0.5.2 app/views/authorization_rules/_show_graph.erb
declarative_authorization-dta-0.1.3 app/views/authorization_rules/_show_graph.erb
declarative_authorization-0.5.1 app/views/authorization_rules/_show_graph.erb