Giter Site home page Giter Site logo

Comments (2)

acetinick avatar acetinick commented on August 10, 2024 13

I have a workaround here that I ended up using for layout methods,

class TestController < ApplicationController
  layout -> { turbo_frame_request? ? false : "custom" }
end

This similar logic exists in Turbo::Frames::FrameRequest

from turbo-rails.

stgm avatar stgm commented on August 10, 2024

We discussed at https://discuss.hotwire.dev/t/turbo-response-always-using-layout-from-controller/1713/

Let me mention my use case, which does require the availability of layouts, so it doesn't get lost in the discussion.

In my application there are a lot of settings/administration screens that are presented in an easy-to-dismiss modal dialog. All of these screens have their own controllers and they are loaded on demand. To clean up the views, I have actually put all of the boilerplate into a layout and assigned this layout to each of the relevant controllers.

<turbo-frame id="modal">
<div class="modal-content">
    <% if content_for?(:title) %>
    <div id="modal-browser-header">
        <%= yield(:title) %>
    </div>
    <% end %>
    <div id="modal-browser-body">
        <%= yield %>
    </div>
    <% if content_for?(:footer) %>
    <div id="modal-browser-footer">
        <%= yield(:footer) %>
    </div>
    <% end %>
</div>
</turbo-frame>

from turbo-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.