Skip to content

haikyuu/imba-inertia-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Imba Inertia Adapter

Install

  • npm: npm install imba-inertia-adapter
  • pnpm: pnpm add imba-inertia-adapter
  • yarn : yarn add imba-inertia-adapter

Ping CRM implementation

https://github.com/haikyuu/perfect-stack

Full API docs

For more documentation, please refer to inertia.js website. As the frontend adapters are quite similar in usage.

Usage

This will be the entry point for your app

import { createInertiaApp } from 'imba-inertia-adapter'

createInertiaApp
	resolve: do(name) name
	setup: do({ el, App, props })
		imba.mount <{App} props=props>

inertia-link and inertia-button-link

Those two components are automatically registered when you import from the main entry point. They have the same attributes as their react/vue counterparts except as which is currently unsupported. Instead use the inertia-button-link.

<inertia-button-link href="/login" method="delete"> "Logout"
<inertia-link href="/users"> "users"

Form Helper

import { Form } from 'imba-inertia-adapter'

tag edit-contacts-page
	prop props
	def setup
		const {last_name = "", first_name = ""} = props.contact;
		self.form = new Form
			first_name: first_name
			last_name: last_name
	def render
		const {contact} = props
		<self>
			"Loading" if form.processing
			<form @submit.prevent=form.put("/contacts/{contact.id}")>
				<input bind=form.data.first_name error=form.errors.first_name>
				<button type="submit"> "Submit"

Access the page object from deep down the tree

#context.currentPage.page.props

Flash messages

If your backend adapter supports them, they can be accessed like regular props

#context.currentPage.page.props.flash

#or

props.flash

Notes

  • You can change forms by simple assignment: form.data.name = "Abdellah"

License

MIT License.

About

Inertia adapter for Imba.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •