Yes, you can directly replace MailerExtension's tag definition with
something in the line of:

   class MailerExtension
      desc {
         -> you will need to duplicate the original desc here, or if you
don't care just don't put it (you won't get docs)
      }
      tag "r:mailer:option" do |tag|
         -> your new code here
      end
    end

    Be sure to define the tag inside the MailerExtension class so it can
access that context.  Your tag definition will replace the original one.

    The best of Rails is Ruby...

    /AITOR

On 10/12/07, Will Green <[EMAIL PROTECTED]> wrote:
>
> I use svn:externals for my extensions, so directly editing the
> MailerPage class is out. I understand that Ruby classes are open, but
> the Pages in radiant use a DSL for tags, containing a desc, tag pair.
> This is whats throwing me off.
>
> It sounds like you're saying I can create an extension that loads after
> Mailer, and that defines a radius tag that is named the same as the one
> whose functionality I am looking to replace (r:mailer:option), and it
> will override the one defined in the Mailer extension. Do I understand
> you correctly? Could it be that simple?
>
> (Sorry, c# .Net puts food on the table right now, so I've grown
> accustomed to be skeptical of simple solutions, because there are none
> in .Net, not that I've found, anyway).
>
> ==
> Will Green
>
> Aitor Garay-Romero wrote:
> >   One of the main features of Ruby is that it's "open" in the sense that
> > your code can modify any other loaded coded as desired.
> >
> >    In your case, make an extension that loads after the mailer extension
> and
> > patches the MailerPage class as desired.
> >
> >    Other option is to patch your local mailer extension directly.
> >
> >     /AITOR
> >
> > On 10/12/07, Will Green <[EMAIL PROTECTED]> wrote:
> >> Perhaps more a Ruby question than a Radiant question, but...
> >>
> >> I'd like to alter the html that the Mailer Extension outputs for
> >> <r:mailer:option> tags within a <r:mailer:radiogroup>.  Rather than
> have
> >> the Label tag follow the Input tag, I want to wrap in Input tag in the
> >> Label tag (with the label text inside a span). This way, you can have
> >> the action of clicking on the label activate the associated control
> >> (even in IE 6, which for some reason, doesn't do it with just the for
> >> attribute).
> >>
> >> Is there an easy way to "monkey patch" MailerPage to alter the tag
> >> 'mailer:option' method?
> >>
> >> So, instead of:
> >>
> >> <input type="radio" value="Yes" id="have_children_1" class="radio"
> >> name="mailer[have_children]"/><label for="have_children_1">Yes</label>
> >>
> >> <input type="radio" value="No" id="have_children_2" class="radio"
> >> checked="checked" name="mailer[have_children]"/><label
> >> for="have_children_2">No</label>
> >>
> >> I'd like to instead output:
> >>
> >> <label for="have_children_1">
> >>    <input type="radio" value="Yes" id="have_children_1" class="radio"
> >> name="mailer[have_children]"/><span>Yes</span>
> >> </label>
> >> <label for="have_children_2">
> >> <input type="radio" value="No" id="have_children_2" class="radio"
> >> checked="checked" name="mailer[have_children]"/><span>No</span></label>
> >>
> >> --
> >> Will Green
> >> _______________________________________________
> >> Radiant mailing list
> >> Post:   [email protected]
> >> Search: http://radiantcms.org/mailing-list/search/
> >> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
> >>
> > _______________________________________________
> > Radiant mailing list
> > Post:   [email protected]
> > Search: http://radiantcms.org/mailing-list/search/
> > Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
> _______________________________________________
> Radiant mailing list
> Post:   [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to