{"id":13507316,"url":"https://github.com/gutschilla/elixir-navigation-tree","last_synced_at":"2026-02-22T10:32:38.901Z","repository":{"id":62429996,"uuid":"39192254","full_name":"gutschilla/elixir-navigation-tree","owner":"gutschilla","description":"A navigation tree representation with helpers to generate HTML out of it - depending of userroles","archived":false,"fork":false,"pushed_at":"2015-09-08T16:24:55.000Z","size":596,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-22T01:28:57.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gutschilla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-16T11:03:24.000Z","updated_at":"2021-04-20T22:44:12.000Z","dependencies_parsed_at":"2022-11-01T19:47:28.822Z","dependency_job_id":null,"html_url":"https://github.com/gutschilla/elixir-navigation-tree","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/gutschilla/elixir-navigation-tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gutschilla%2Felixir-navigation-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gutschilla%2Felixir-navigation-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gutschilla%2Felixir-navigation-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gutschilla%2Felixir-navigation-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gutschilla","download_url":"https://codeload.github.com/gutschilla/elixir-navigation-tree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gutschilla%2Felixir-navigation-tree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29709365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T05:59:28.568Z","status":"ssl_error","status_checked_at":"2026-02-22T05:58:46.208Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:30.992Z","updated_at":"2026-02-22T10:32:38.881Z","avatar_url":"https://github.com/gutschilla.png","language":"Elixir","funding_links":[],"categories":["Algorithms and Data structures"],"sub_categories":[],"readme":"# NavigationTree.Agent\nAn agent represing a navigation tree. The agent holds transformed configuration\nstate. \n\nProvides convenience wrappers to generate Twitter/bootstrap-freindly\nuserrole-aware HTML out of this state through NavigationTree.Helper and\nNavigationTree.Bootstrap.\n\nNavigation tree nodes are to be configured as NavigationTree.Node structs.\n\n## Terminology\n\n__node__: A configuration struct looking like this:\n```\n%NavigationTree.Node{\n    name: string, # the node's name, like \"About Us\"\n    url: nil or string, # will be set on startup, but may be overridden\n    controller: nil or string, # would be set to about-us, but may be overridden\n    children:, nil or list of child nodes\n    roles: nil or list of strings # role names a user must have to see this navigation item\n}\n```\n\n__path__: A list of node names, e.g. [\"Home\", \"Admin\"]\n\n__url__: Every node gets a url on start_link setup constructed out of its ancestors' url \nconcatenated with \"/\u003ccontroller\u003e\" whereas \u003ccontroller\u003e is either a safe_string version of\nthe node's name or the specified controller namde in this node's config\n\n\n# Basic usage\n- create a config module or just use NavigationTree.Example\n- Startup Agent possibly in your application setup\n- create you HTML generator or use the shipped NavigationTree.Bootstrap module\n- enjoy!\n\n```\n# startup\nNavigationTree.Agent.start_link NavigationTree.Example.config\n\n# getters\nNavigationTree.Agent.get.tree\nNavigationTree.Agent.get.paths\nNavigationTree.Agent.get.root_node (initoal config)\n\n# methods\nNavigationTree.Agent.node_of [\"Home\",\"Admin\"]\n# same as\nNavigationTree.Agent.node_of \"/admin\"\n# the inverse of node_of is path_of\nNavigationTree.Agent.path_of \"/admin\" # returns [\"Home\",\"Admin\"]\n\n# parent node\nNavigationTree.Agent.parent of [\"Home\",\"Admin\", \"Users\"]\n\n# returns next/previous node after \"Users\" in \"Amind\"\nNavigationTree.Agent.next_sibling [\"Home\",\"Admin\", \"Users\"]\nNavigationTree.Agent.previous_sibling [\"Home\",\"Admin\", \"Users\"]\n \n\n# HTML\nNavigationTree.Agent.as_html [], :bootstrap\n# returns HTML for unauthenticated user\n\nNavigationTree.Agent.as_html [\"admin\", \"customer\"], :bootstrap \n# returns HTML for user with admin and customer role\n\n# or your tree_to_html implementation:\nMyApp.NavigationTree.Sidenav.tree_to_html NavigationTree.Agent.get.tree\n\n```\n\n# Documentation \n[Can be found here.](http://hexdocs.pm/navigation_tree/0.4.0/NavigationTree.Agent.html)\n\n# Basics\n\nAdd this project both to your dependecies and to your app list (including configuration). [..]\n\n# LICENSE\nM.I.T.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgutschilla%2Felixir-navigation-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgutschilla%2Felixir-navigation-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgutschilla%2Felixir-navigation-tree/lists"}