Jump to content

Deface (Ruby on Rails Gem) is like ProcessWire MarkupRegions


Jonathan Lahijani
 Share

Recommended Posts

There is a module in Ruby called Deface which is widely used in an ecommerce system called Spree:
https://github.com/spree/deface

It's been around for a while.  "Deface is a library that allows you to customize HTML (ERB, Haml and Slim) views in a Rails application without editing the underlying view."

MarkupRegions essentially works in a similar way.  It's a bit of a shift in thinking but it's quite nice if you set things up the right way.  I'm experimenting with a site profile that takes this approach extensively.  How have you used MarkupRegions in creative ways?

  • Like 2
Link to comment
Share on other sites

I just recently started using markup regions and gotta say I'm starting to like it a lot,  but honestly I wouldn't think of anything actually "fancy", just really like working as if I were doing direct output, just like MarkupRegions proposes in its docs.

 

  • Like 2
Link to comment
Share on other sites

I've worked much more in the admin those days, but I also like markup regions a lot!

The only two "fancy" things I can think of are:

1) Remove the "boxed layout" (uk-container class) for some regions (eg when you have a boxed website in general but want the frontpage to be full width):

<region id="mainsection" class="-uk-container">...</region>

The nice thing is that this works completely without any if/else blabla as one would usually do it ? 

2) Region at the end of the body:

<body>
  ...
  <region id="bodyend"></region>
</body>

Then I can inject code from views where I need additional javascripts or the like, eg sliders or here using foxycart:

fXkp2Va.png

This example also shows how easy (and clean) it is to add FormBuilder to this "view" (just using pw-append on the head).

  • Like 3
Link to comment
Share on other sites

 Share

×
×
  • Create New...