khusnetdinov / Phoenix_routes_js
Licence: mit
Phoenix routes helpers in JavaScript code.
Stars: ✭ 17
Programming Languages
javascript
184084 projects - #8 most used programming language
elixir
2628 projects
Projects that are alternatives of or similar to Phoenix routes js
Cercle
Cercle is a CRM+Project Manager for your organization - Phoenix Framework & Vuejs
Stars: ✭ 284 (+1570.59%)
Mutual labels: phoenix-framework
Phauxth
Authentication library for Phoenix, and other Plug-based, web applications
Stars: ✭ 418 (+2358.82%)
Mutual labels: phoenix-framework
Phoenix Battleship
The Good Old game, built with Elixir, Phoenix, React and Redux
Stars: ✭ 503 (+2858.82%)
Mutual labels: phoenix-framework
Easy.common
A set of useful utilities and helpers used across Easy.* projects.
Stars: ✭ 306 (+1700%)
Mutual labels: helpers
Laravel Helpers
An extensive set of Laravel framework helper functions and collection macros.
Stars: ✭ 407 (+2294.12%)
Mutual labels: helpers
Canary
🐣 Elixir authorization and resource-loading library for Plug applications.
Stars: ✭ 450 (+2547.06%)
Mutual labels: phoenix-framework
Godello
Trello inspired kanban board made with the Godot Engine and GDScript, powered by an online real-time collaborative backend (Elixir and Phoenix Channels)
Stars: ✭ 273 (+1505.88%)
Mutual labels: phoenix-framework
Elixir Phoenix Realworld Example App
Exemplary real world application built with Elixir + Phoenix
Stars: ✭ 764 (+4394.12%)
Mutual labels: phoenix-framework
Awesome Phoenix
🔥 Collection of awesome open-source apps made with Phoenix Framework
Stars: ✭ 481 (+2729.41%)
Mutual labels: phoenix-framework
Kahelpers
Kotlin Extensions (Android extensions) and Helpers for smoother Android development
Stars: ✭ 382 (+2147.06%)
Mutual labels: helpers
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+2658.82%)
Mutual labels: phoenix-framework
Microwebsrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
Stars: ✭ 295 (+1635.29%)
Mutual labels: routes
Fun with flags
Feature Flags/Toggles for Elixir
Stars: ✭ 554 (+3158.82%)
Mutual labels: phoenix-framework
React Phoenix
Make rendering React.js components in Phoenix easy
Stars: ✭ 426 (+2405.88%)
Mutual labels: phoenix-framework
Logging Helpers
Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.
Stars: ✭ 5 (-70.59%)
Mutual labels: helpers
Styled Map
A super simple way to map props to styles with Styled Components ✨
Stars: ✭ 582 (+3323.53%)
Mutual labels: helpers
Remote retro
Free, world-class retrospectives
Stars: ✭ 474 (+2688.24%)
Mutual labels: phoenix-framework
PhoenixRoutesJs
Phoenix routes helpers in javascript code
Installation
If available in Hex, the package can be installed
by adding phoenix_routes_js
to your list of dependencies in mix.exs
:
def deps do
[{:phoenix_routes_js, "~> 0.1.1"}]
end
Usage
Two steps configuration:
- Add possibility to use view helper by adding
use PhoenixRoutesJs.View
in template**_web/views/layout_view.ex
file:
defmodule Project.LayoutView do
...
import PhoenixRoutesJs.View
...
end
- Add helper
render_routes_script
to you layout in**_web/templates/layout/app.html.eex
before main javascript file:
...
<%= render_routes_script(@conn) %>
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>
...
Examples
render_routes_script(@conn)
render_routes_script(Project.Router)
Now you can use phoenix routes helpers in browser console and javascript code.
Helpers
user_path GET /users UserController :index Routes.user_path('index')
user_path GET /users/:id/edit UserController :edit Routes.user_path('edit', ':id')
user_path GET /users/new UserController :new Routes.user_path('new')
user_path GET /users/:id UserController :show Routes.user_path('show', ':id')
user_path POST /users UserController :create Routes.user_path('create')
user_path PATCH /users/:id UserController :update Routes.user_path('update', ':id')
PUT /users/:id UserController :update
user_path DELETE /users/:id UserController :delete Routes.user_path('delete', ':id')
JavaScript
Routes object is kept in window
.
Browser
Now you can access to you helpers in console:
// browser console
Routes.user_path('edit', 1)
//=> /users/1/edit
JavaScript assets
// Somewhere in javascript modules
window.Routes.user_path('edit', 1)
//=> /users/1/edit
JavaScript options:
Routes options:
-
format
- Add '.format' to request path string. -
params
- Add query string to request path.
Routes.user_path('index', {format: 'json', params: {filter: 'query', sort: 'acs'}})
//=> "/users.json?filter=query&sort=acs"
License
The library is available as open source under the terms of the MIT License.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].