Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for inertiaui/modal #25

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add support for inertiaui/modal #25

wants to merge 1 commit into from

Conversation

skryukov
Copy link
Owner

@skryukov skryukov commented Oct 28, 2024

InertiaRailsContrib provides support for InertiaUI Modal in the Rails application.

With InertiaUI Modal, you can easily open any route in a Modal or Slideover without having to change anything about your existing routes or controllers.

By default, InertiaUI Modal doesn't require anything from the Inertia Server Adapters, since it just opens modals without changing the URL.
However, InertiaUI Modal also supports updating the URL when opening a modal (see the docs on why you might want that: https://inertiaui.com/inertia-modal/docs/base-route-url).

Setup

  1. Follow the NPM installation instructions from the InertiaUI Modal documentation.

  2. Enable InertiaUI Modal, turn on the enable_inertia_ui_modal option in the inertia_rails_contrib.rb initializer:

InertiaRailsContrib.configure do |config|
  config.enable_inertia_ui_modal = true
end

This will add a new render method inertia_modal that can be used in the controller actions:

class PostsController < ApplicationController
  def new
    render inertia_modal: 'Post/New', props: { post: Post.new }, base_url: posts_path
  end
end

TODO:

  • Implement the inertia_modal renderer
  • Add patch to support redirect back
  • Add tests
  • Write a cookbook article

Copy link

netlify bot commented Oct 28, 2024

Deploy Preview for inertia-rails canceled.

Name Link
🔨 Latest commit 1aa792b
🔍 Latest deploy log https://app.netlify.com/sites/inertia-rails/deploys/6721e2c066449f0008bf61e7

@chasegiunta
Copy link

@skryukov Hi there! I was wondering if you have any plans to bring this over the finish line or was it just an idea? Sorry to pester!

@skryukov
Copy link
Owner Author

skryukov commented Jan 9, 2025

Hey, @chasegiunta! Yup, I plan to bring it in, hope to find some time next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants