ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - gutschilla/elixir-navigation-tree: A navigation tree representation with helpers to generate HTML out of it - depending of userroles
A navigation tree representation with helpers to generate HTML out of it - depending of userroles - gutschilla/elixir-navigation-tree
Visit Site

GitHub - gutschilla/elixir-navigation-tree: A navigation tree representation with helpers to generate HTML out of it - depending of userroles

GitHub - gutschilla/elixir-navigation-tree: A navigation tree representation with helpers to generate HTML out of it - depending of userroles

NavigationTree.Agent

An agent represing a navigation tree. The agent holds transformed configuration state.

Provides convenience wrappers to generate Twitter/bootstrap-freindly userrole-aware HTML out of this state through NavigationTree.Helper and NavigationTree.Bootstrap.

Navigation tree nodes are to be configured as NavigationTree.Node structs.

Terminology

node: A configuration struct looking like this:

%NavigationTree.Node{
    name: string, # the node's name, like "About Us"
    url: nil or string, # will be set on startup, but may be overridden
    controller: nil or string, # would be set to about-us, but may be overridden
    children:, nil or list of child nodes
    roles: nil or list of strings # role names a user must have to see this navigation item
}

path: A list of node names, e.g. ["Home", "Admin"]

url: Every node gets a url on start_link setup constructed out of its ancestors' url concatenated with "/" whereas is either a safe_string version of the node's name or the specified controller namde in this node's config

Basic usage

  • create a config module or just use NavigationTree.Example
  • Startup Agent possibly in your application setup
  • create you HTML generator or use the shipped NavigationTree.Bootstrap module
  • enjoy!
# startup
NavigationTree.Agent.start_link NavigationTree.Example.config

# getters
NavigationTree.Agent.get.tree
NavigationTree.Agent.get.paths
NavigationTree.Agent.get.root_node (initoal config)

# methods
NavigationTree.Agent.node_of ["Home","Admin"]
# same as
NavigationTree.Agent.node_of "/admin"
# the inverse of node_of is path_of
NavigationTree.Agent.path_of "/admin" # returns ["Home","Admin"]

# parent node
NavigationTree.Agent.parent of ["Home","Admin", "Users"]

# returns next/previous node after "Users" in "Amind"
NavigationTree.Agent.next_sibling ["Home","Admin", "Users"]
NavigationTree.Agent.previous_sibling ["Home","Admin", "Users"]
 

# HTML
NavigationTree.Agent.as_html [], :bootstrap
# returns HTML for unauthenticated user

NavigationTree.Agent.as_html ["admin", "customer"], :bootstrap 
# returns HTML for user with admin and customer role

# or your tree_to_html implementation:
MyApp.NavigationTree.Sidenav.tree_to_html NavigationTree.Agent.get.tree

Documentation

Can be found here.

Basics

Add this project both to your dependecies and to your app list (including configuration). [..]

LICENSE

M.I.T.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory