Hi Paul,

These are very good questions :)

El 12-08-2015 a las 07:02, Paul Howson escribió:
> Hi Ignacio and others,
> 
> I'm a bit confused about how the Dryml <extend> tag works. The
> documentation is rather brief.
> 
> This has arisen in trying to understand what's going on with Hobo Bootstrap.
> 
> Hobo Bootstrap /extends/ the <index-page> tag to replace the default
> card listing with a table, and to re-locate the "New" button, etc.
> 
> The questions which have arisen after grappling with this are:
> 
>   * Extend seems to be a bit like aliasing a method in Ruby and
>     replacing it with a new definition which calls the old method
>     definition. When there are polymorphic page tags (e.g. <index-page
>     for…>), what exactly is the sequence of overriding?

>From what I understand, this would be the order of code execution.

- 1. hobo_rapid (index-page is first defined as polymorphic)
- 2. pages.dryml (automatically generated file in app/views/taglibs).
Different index-pages are created depending on the models
- 3. hobo_bootstrap extends it

>   * Can you chain a series of extends? i.e. if a tag is already extended
>     (e.g. the <index-page> tag extended by Hobo Bootstrap) can you add
>     another extend? I had trouble getting this to work. What determines
>     the order in which a series of extends are applied?

I'm not 100% sure, but I believe you can extend again. If it doesn't
work for you, can you share some code? I'd love to play with it.

>   * If a tag has been extended (e.g. <index-page> by Hobo Bootstrap) and
>     you don't like what the extension to the original tag does, can you
>     "undo" or neutralise an extended tag to get back to the original
>     un-extended tag?

Nope, I don't think this is possible :S.

>   * If you can chain extends and there is a series of them (it gets
>     complicated!) can you somehow "reach back" to an earlier version of
>     the tag in the sequence.

I don't think Dryml keeps in memory all the versions.

> 
> The Hobo Bootstrap example is pertinent because the Bootstrap extensions
> are in a gem and it's not easy to modify them (the mods would get
> overwritten when the gem is updated), so there needs to be a way of
> selectively undoing the Bootstrap extensions. The simplest thing would
> be to just disable the Hobo Bootstrap extension of the <index-page> tag,
> but I can't see a way to do that without modifying the gem.

Having your own gem/template should not be too hard. You can download
the hobo bootstrap gem to a local directory (for example in
vendor/gems), edit it, and then change your Gemfile like this:

gem 'hobo_boostrap', path: 'vendor/gems/hobo_bootstrap'


Alternatively, you could "override" the hobo_bootstrap changes by
creating your own tag. I would start with the generated code in
pages.dryml, and then edit it like this:


front_site.dryml
----------------

<def tag="my-index-page">
  <page merge title="#{ht 'model.index.title',
:default=>[model.model_name.human(:count=>100)] }">
    <body: class="index-page model" param/>

    <content-header: param>
      Hello
    </content-header:>

    <content-body: param>
      World
    </content-body:>
  </page>
</def>


app/views/models/index.dryml
----------------------------
<my-index-page/>



Warm regards,
Ignacio

> 
> Thanks, Paul Howson
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to