Sha256: 7bbdbfafe13ba8abe356ff4b00e1fc87832fd0dbb0ce81e5777f86727c966f76

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

<% javascript_tag do %>
    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()" %><br/>
<object id="graph" data="" type="image/svg+xml" style="max-width:100%"/>
</div>

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
stffn-declarative_authorization-0.3.1 app/views/authorization_rules/_show_graph.erb
stffn-declarative_authorization-0.3.2.1 app/views/authorization_rules/_show_graph.erb
stffn-declarative_authorization-0.3.2.2 app/views/authorization_rules/_show_graph.erb
stffn-declarative_authorization-0.3.2 app/views/authorization_rules/_show_graph.erb
tma-declarative_authorization-0.3.2.1 app/views/authorization_rules/_show_graph.erb
tma-declarative_authorization-0.3.2.2 app/views/authorization_rules/_show_graph.erb
uhees-declarative_authorization-0.3.1 app/views/authorization_rules/_show_graph.erb