Packages
A navigation tree representation with helpers to generate HTML out of it - depending of userroles. Also creates nice HTML navbars for Bootstrap. Implemented as Agent to hold config state.
Current section
Files
Jump to
Current section
Files
doc/NavigationTree.Helper.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>NavigationTree.Helper</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/elixir.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="row row-offcanvas row-offcanvas-left">
<section id="sidebar" class="col-xs-6 col-sm-3 sidebar-offcanvas">
<p class="pull-right visible-xs">
<button type="button" class="btn btn-default btn-sm" data-toggle="offcanvas">
<span class="glyphicon glyphicon-search"></span>
</button>
</p>
<h1 id="full_list_header">
navigation_tree v0.3.0
</h1>
<h2 id="sub_list_header">
<a href="overview.html">Overview</a>
</h2>
<div class="nav">
<span><a id="modules_list" href="#full_list">Modules</a></span>
<span role="presentation" class="disabled">Exceptions</span>
<span role="presentation" class="disabled">Protocols</span>
</div>
<div id="search" class="row">
<div class="col-xs-10">
<div class="input-group input-group-sm">
<label for="search_field" class="sr-only">Search</label>
<input type="text" id="search_field" class="form-control" placeholder="Search" autocomplete="off" autofocus="autofocus" results="0">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div><!-- /input-group -->
</div><!-- /.col-xs-10 -->
<div class="col-xs-2" id="spinning">
<span></span>
</div><!-- /.col-xs-2 -->
</div><!-- /#search .row -->
<script src="sidebar_items.js" defer></script>
<ul id="full_list">
</ul>
<div id="no_results"></div>
</section><!--/.sidebar-offcanvas -->
<section id="content" class="col-xs-12 col-sm-9">
<div class="breadcrumbs">
<button type="button" class="btn btn-default btn-sm" data-toggle="offcanvas">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</button>
navigation_tree v0.3.0 → <a href="overview.html">Overview</a> → <a href="NavigationTree.html#content">NavigationTree</a> → <a href="NavigationTree.Helper.html#content">Helper</a>
</div>
<h1>
NavigationTree.Helper
</h1>
<ul class="summary_links">
<li><a href="#summary_details">Summary</a></li>
<li><a href="#functions_details">Functions</a></li>
</ul>
<section id="summary_details" class="details_list">
<h1>Summary</h1>
<table class="summary">
<tr>
<td class="summary_signature"><a href="#allowed_tree/2">allowed_tree(node, roles)</a></td>
<td class="summary_synopsis"><p>Recursivly walks the tree, removing all nodes that given roles do not satisfy</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#at/2">at(node, list)</a></td>
<td class="summary_synopsis"><p>Traverses the tree searching for the names given in list</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#at2/2">at2(node, list2)</a></td>
<td class="summary_synopsis"></td>
</tr>
<tr>
<td class="summary_signature"><a href="#join_slash/2">join_slash(parent \\ "", child \\ "")</a></td>
<td class="summary_synopsis"></td>
</tr>
<tr>
<td class="summary_signature"><a href="#safe_name/1">safe_name(name)</a></td>
<td class="summary_synopsis"><p>Replaces German Umlauts äöü and ß with ae oe ue,
downcases the string and replaces all nonword sequences to “-“</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#thaw/1">thaw(node)</a></td>
<td class="summary_synopsis"></td>
</tr>
<tr>
<td class="summary_signature"><a href="#thaw/5">thaw(node, parent_url, parent_name_path, parent_roles, paths_acc)</a></td>
<td class="summary_synopsis"></td>
</tr>
</table>
</section>
<section id="functions_details" class="details_list">
<h1>Functions</h1>
<section class="detail">
<div class="detail_header" id="allowed_tree/2">
<span class="signature"><strong>allowed_tree(node, roles)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#allowed_tree/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<section class="docstring">
<p>Recursivly walks the tree, removing all nodes that given roles do not satisfy.</p>
<h2>Examples</h2>
<pre><code class="iex elixir">iex> alias NavigationTree.Node, as: Node
nil
iex> NavigationTree.Agent.start_link %Node{name: "A", children: [%Node{name: "B", roles: ["b"], children: [%Node{name: "C", roles: ["c"]}]}]}
{:ok, pid }
iex> NavigationTree.Helper.allowed_tree NavigationTree.Agent.get.tree, ["a"]
%{children: [], controller: nil, name: "A", roles: [], url: "/a"}
iex> NavigationTree.Helper.allowed_tree NavigationTree.Agent.get.tree, ["b"]
%{children: [%{children: [], controller: nil, name: "B", roles: ["b"], url: "/a/b"}], controller: nil, name: "A", roles: [], url: "/a"}
iex> NavigationTree.Helper.allowed_tree NavigationTree.Agent.get.tree, ["c","b"]
%{children: [%{children: [%{children: [], controller: nil, name: "C", roles: ["b", "c"], url: "/a/b/c"}], controller: nil, name: "B", roles: ["b"], url: "/a/b"}], controller: nil, name: "A", roles: [], url: "/a"}</code></pre>
</section>
</section>
<section class="detail">
<div class="detail_header" id="at/2">
<span class="signature"><strong>at(node, list)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#at/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<section class="docstring">
<p>Traverses the tree searching for the names given in list.</p>
</section>
</section>
<section class="detail">
<div class="detail_header" id="at2/2">
<span class="signature"><strong>at2(node, list2)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#at2/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<section class="docstring">
</section>
</section>
<section class="detail">
<div class="detail_header" id="join_slash/2">
<span class="signature"><strong>join_slash(parent \\ "", child \\ "")</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#join_slash/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<section class="docstring">
</section>
</section>
<section class="detail">
<div class="detail_header" id="safe_name/1">
<span class="signature"><strong>safe_name(name)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#safe_name/1" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>safe_name(<a href="http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0">String.t</a>) :: <a href="http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0">String.t</a></li>
</ul>
<section class="docstring">
<p>Replaces German Umlauts äöü and ß with ae oe ue,
downcases the string and replaces all nonword sequences to “-“</p>
<h2>Example</h2>
<p> iex> NavigationTree.Helper.safe_name “Hane Büchener Unsinn”
“hane-buechener-unsinn”</p>
</section>
</section>
<section class="detail">
<div class="detail_header" id="thaw/1">
<span class="signature"><strong>thaw(node)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#thaw/1" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<section class="docstring">
</section>
</section>
<section class="detail">
<div class="detail_header" id="thaw/5">
<span class="signature"><strong>thaw(node, parent_url, parent_name_path, parent_roles, paths_acc)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#thaw/5" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<section class="docstring">
</section>
</section>
</section>
</section> <!--/content -->
</div><!--/row -->
<!-- Scripts -->
<script>
relpath = '';
if (relpath != '') relpath += '/';
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery.js"><\/script>')</script>
<script src="js/highlight.pack.js"></script>
<script src="js/app.js"></script>
</body>
</html>