#512 open
Matt Jones

Help standard Rails plugins behave better in Hobo

Reported by Matt Jones | October 24th, 2009 @ 10:49 PM | in Hobo 1.1

Ran into this with the Smerf_forms plugin (before I ditched it for a custom Hobo solution - stay tuned for that...).

"Engine-like" plugins that contain and/or generate views typically expect that the application will define a layout; a Hobo app obviously doesn't. There should be a way to tweak the template rendering in Rails to allow non-DRYML views (and the corresponding content_for stuff) to behave like they usually would.

I tried this (in app/views/layouts/application.dryml):

<page>
  <content:>
    <%= yield %>
  </content:>
</page>

Which worked for the plugin, but made normal Hobo pages crash. The solution may be as simple as passing :layout => false to the code that's rendering DRYML (AFAIK, there may even be a template-class-wide option to do this).

Comments and changes to this ticket

  • Matt Jones

    Matt Jones October 24th, 2009 @ 10:51 PM

    Well, that's some special Markdown formatting. Bizarre that it only double-escaped the ERB brackets...

  • Bryan Larsen

    Bryan Larsen October 29th, 2009 @ 11:03 PM

    • Tag set to dryml, enhancement

    fixed that for you.

    I notice you tagged this as Hobo 1.0. Does that mean you're volunteering to do it? :)

  • hamann_paul (at yahoo)

    hamann_paul (at yahoo) November 3rd, 2009 @ 05:00 PM

    Hi there. I'm attempting to integrate Community Engine with Hobo. I was wondering about the same issue. Is there a workaround for this? Could I [ a la example above ] subclass page [ce_page?] to get both to play nicely together? Pls advise. I wouldn't figure this out in a million years.

    Cheers! P

  • Matt Jones

    Matt Jones November 3rd, 2009 @ 06:16 PM

    • Assigned user set to “Matt Jones”

    @Brian - it's been a few point releases since I last tore into the Rails template stuff, but I'd be glad to take care of it. I think it's an essential feature before we go 1.0.

    @paul - if you can get the community engine pages to use a different layout (with the layout directive in the controller, for instance) you should be able to at least get the pages wrapped in the regular page tag with the trick above. The problem is that if you put the trick in application.dryml, the regular Hobo pages blow up. :(

    However, I'm not sure if trying to glue a giant plugin like CE to Hobo is the best idea; there's a lot of overlap between the two. That scale of integration is likely to be tricky no matter how much we smooth things out.

  • hamann_paul (at yahoo)

    hamann_paul (at yahoo) November 10th, 2009 @ 04:47 PM

    Thanks for the advice. It's a bit of a toy project. I really like the CE features, and would prefer to not have to re-write so much code. I would argue that the two do very different things. Hobo is a toolkit [ rapid application builder ]. CE is an application with a very specific focus => social communities. I could use hobo to write CE, and would if that was my only choice. The scope is huge.

    My background is actually integration [ and skunk works ]. I definitely appreciate the challenges. I've integrated multiple apps before by using LDAP, cas-client, and rubycas-server to handle the user model and login part. I essentially embedded the rest of the apps in frames in the most central app [Sugarcrm]. Sugar has a portal feature that helps with that. I also used a RESTful integration server[Snaplogic] to pull together some data. Most apps these days have a REST API. This time around, I'm looking at a plugin called has_remote.

    In theory, engines are supposed to make it easier to do these kinds of mashups. If you look at the amount of freely available software, this approach could be powerful. For example, look at the sunk costs of things like Redmine, SugarCRM, KnowledgeTree or Liferay. Clearly, there's a business process that spans them.

    Ultimately, I think I'm up for the challenge. If it can't be done, I'll have to do more with hobo. I'll also have to dial back my ambition. What I really like about hobo, btw, is that it gives me a chance to put a "There" there in the middle.

    I'll let you know how it goes.

    Cheers! Paul

  • Tom Locke

    Tom Locke November 17th, 2009 @ 03:58 PM

    • State changed from “new” to “open”
    • Milestone changed from Hobo 1.0 - Final to Beyond Hobo 1.0

    Marking this as post 1.0, as it's a bit distant from the Hobo sweet-spot. I definitely agree that it needs fixing though, and post 1.0 is not at all far off

  • Matt Jones

    Matt Jones November 22nd, 2009 @ 06:59 AM

    • Tag cleared.

    I just committed a partial solution to this; it marks DRYML files as exempt from layout, which avoids the nasty messes otherwise caused by an application layout.

    Note that the rendering context is still somewhat messed up, so standard Rails stuff like 'yield :foo' may not behave correctly. The older deprecated content_for accessors (@content_for_*) still work correctly; they are deprecated and may not exist in 3.0, but that's a whole other mess...

    At a minimum, dropping this in app/views/layouts/application.dryml will wrap standard ERB pages in your DRYML page tag:

    <page>
      <content:>
        <%= @content_for_layout %>
      </content:>
    </page>
    
  • Bryan Larsen
  • Bryan Larsen

    Bryan Larsen February 19th, 2010 @ 07:18 PM

    • Tag set to dryml, enhancement
    • Milestone changed from Beyond Hobo 1.0 to Hobo 1.1

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Referenced by

Pages