{"id":18000117,"url":"https://github.com/kaquadu/nav_ex","last_synced_at":"2025-04-04T07:43:58.201Z","repository":{"id":166583524,"uuid":"641114850","full_name":"Kaquadu/nav_ex","owner":"Kaquadu","description":"Navigation history package for Phoenix Framework","archived":false,"fork":false,"pushed_at":"2023-05-23T17:13:27.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T07:43:55.596Z","etag":null,"topics":["dependencies","elixir","history-tracking","navigation-history","package","phoenix","phoenix-framework","user-navigation"],"latest_commit_sha":null,"homepage":"","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/Kaquadu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-15T20:10:06.000Z","updated_at":"2023-05-18T19:07:39.000Z","dependencies_parsed_at":"2023-05-28T15:00:14.784Z","dependency_job_id":null,"html_url":"https://github.com/Kaquadu/nav_ex","commit_stats":null,"previous_names":["kaquadu/nav_ex"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaquadu%2Fnav_ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaquadu%2Fnav_ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaquadu%2Fnav_ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaquadu%2Fnav_ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kaquadu","download_url":"https://codeload.github.com/Kaquadu/nav_ex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142043,"owners_count":20890652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["dependencies","elixir","history-tracking","navigation-history","package","phoenix","phoenix-framework","user-navigation"],"created_at":"2024-10-29T23:09:41.899Z","updated_at":"2025-04-04T07:43:58.178Z","avatar_url":"https://github.com/Kaquadu.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *WORK IN PROGRESS - NOT TESTED YET*.\nThis project is in progress. It is just created and it needs a lot of polishing. Feel free to provide any kind of feedback in issues.\n\n# NavEx\nNavEx is the navigation history package for Elixir/Phoenix Framework. It uses adapter pattern and lets you choose between a few adapters to keep your users navigation history.\n\n## Adapters\n\n### NavEx.Adapters.ETS\nKeeps user's navigation history in the ETS. It saves user's identity in his cookies.\n\n### NavEx.Adapters.Session\nKeeps user's navigation history in session. Might lead to cookies overflow error when navigation history config or links are too long.\n\n## Installation\nNavEx can be installed by adding `nav_ex` as a dependency in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:nav_ex, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nIt might be added to HexDependencies once I feel that it is ready enough for it :D\n\n## Configuration:\n### NavEx\n```\n  config :nav_ex,\n    tracked_methods: [\"GET\"], # what methods to track\n    history_length: 10, # what is the history list length per user\n    adapter: NavEx.Adapters.ETS # adapter used by NavEx to save data\n```\n### Adapters\n```\n  config NavEx.Adapters.ETS,\n    identity_key: \"nav_ex_identity\", # name of the key in cookies where the user's identity is saved\n    table_name: :navigation_history # name of the ETS table\n```\n\n```\n  config NavEx.Adapters.Session,\n    history_key: \"nav_ex_history\" # name of the key in session where navigation history is saved\n```\n\n## Usage\n\n```\ndefmodule MyApp.Router do\n  ...\n  pipeline :browser do\n    ...\n    NavEx.Plug\n  end\n  ...\nend\n```\n\n**NavEx.last_path/1**\\\nIt returns 2nd last path.\n```\n# for existing user\niex(1)\u003e NavEx.last_path(conn)\n{:ok, \"/sample/path\"}\n\n# for existing user, but without 2 paths\niex(2)\u003e NavEx.last_path(conn)\n{:ok, nil}\n\n# for not existing user\niex(3)\u003e NavEx.last_path(conn)\n{:error, :not_found}\n```\n\n**NavEx.path_at/2**\\\nIt returns Nth path counted from 0.\n```\n# for existing user\niex(1)\u003e NavEx.path_at(conn, 5)\n{:ok, \"/sample/path\"}\n\n# for existing user but exceeding paths number\niex(2)\u003e NavEx.path_at(conn, 5)\n{:ok, nil}\n\n# for not existing user\niex(3)\u003e NavEx.path_at(conn, 5)\n{:error, :not_found}\n\niex(4)\u003e NavEx.path_at(conn, 999)\n** (ArgumentError) Max history depth is 10 counted from 0 to 9. You asked for record number 999.\n```\n\n**NavEx.list/1**\\\nLists user's paths. Older paths have higher indexes.\n```\n# for existing user\niex(1)\u003e NavEx.list(conn)\n{:ok, [\"/sample/path/2\", \"sample/path/1]}\n\n# for not existing user\niex(2)\u003e NavEx.list(conn)\n{:error, :not_found}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaquadu%2Fnav_ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaquadu%2Fnav_ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaquadu%2Fnav_ex/lists"}