Jeff Barczewski
2007-Jan-27 18:32 UTC
[Masterview-users] Does anyone use mv:link_to specifying the optional name (which gets discarded anyway)? This is an undocumented usage form
MasterView users,
I have a quick question. Do any of you use the mv:link_to directive and
specify the name (which normally gets discarded anyway)? The reason I ask is
that I am wanting to upgrade the functionality of this directive and the
optional name argument will cause some headaches.
Here is what I mean
Most people do this
---------------------------------------
<a href="foo.html" mv:link_to=":action =>
:bar">Cat</a>
which will render
<%= link_to( ''Cat'', :action => :bar) %>
However to make things easy for new MasterView users we also allowed the
name to be specified in the link_to directive so that it would have
identical signature as the rails helper link_to.
Optionally this was supported so you could do this
-------------------------------------------------------------------------------
<a href="foo.html" mv:link_to="''discard me'',
:action => :bar">Cat</a>
which will also render (it just discards the name and picks it up from the
element content)
<%= link_to( ''Cat'', :action => :bar) %>
* It is this usage that I am asking whether people are using. Normally I
wouldn''t think people would use this since you are passing in an
argument
that isn''t used anywhere, but it was there for syntax compatibility
with
Rails helpers.
The reason I am asking is that I would like to do away with the optional
name argument so that I can upgrade the directive to also allow a string url
to be specified. Rails link_to allows the options argument to be a hash like
{:action => :new} or it can be a string in which case it is used directly.
So to support this, I need to get rid of the optional name argument (and
discarding code) so that if a string is specified we use it as the url.
Note: we can''t simply check for a hash since you can specify an
optional
additional hash in either case.
I don''t believe our docs mention using the optional name argument and
neither does the generator, so I am thinking maybe no one was using that
form.
So if no one is using it then, I can easily upgrade this without too much
worry. We have ideas for doing syntax checks and upgrading compatibility,
but these will take some work to implement and if no one is really using
this optional form of calling the directive, it would be easier to simply
drop that form to allow for the new string url functionality.
Thanks,
Jeff
--
Jeff Barczewski, MasterView core team
Inspired Horizons Ruby on Rails Training and Consultancy
Next Ruby on Rails plus JRuby workshop Feb 22-24 St. Louis, MO
http://inspiredhorizons.com/training/rails/index.html
Limited seating, register now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/masterview-users/attachments/20070127/8167da85/attachment-0001.html
Ed Howland
2007-Jan-29 17:20 UTC
[Masterview-users] Does anyone use mv:link_to specifying the optional name (which gets discarded anyway)? This is an undocumented usage form
Fine by us, if you drop the optional argument. Ed On 1/27/07, Jeff Barczewski <jeff.barczewski at gmail.com> wrote:> MasterView users, > > I have a quick question. Do any of you use the mv:link_to directive and > specify the name (which normally gets discarded anyway)? The reason I ask is > that I am wanting to upgrade the functionality of this directive and the > optional name argument will cause some headaches. > > Here is what I mean > > Most people do this > --------------------------------------- > <a href="foo.html" mv:link_to=":action => :bar">Cat</a> > > which will render > > <%= link_to( ''Cat'', :action => :bar) %> > > > However to make things easy for new MasterView users we also allowed the > name to be specified in the link_to directive so that it would have > identical signature as the rails helper link_to. > > Optionally this was supported so you could do this > ------------------------------------------------------------------------------- > <a href="foo.html" mv:link_to="''discard me'', :action => :bar">Cat</a> > > which will also render (it just discards the name and picks it up from the > element content) > > <%= link_to( ''Cat'', :action => :bar) %> > > * It is this usage that I am asking whether people are using. Normally I > wouldn''t think people would use this since you are passing in an argument > that isn''t used anywhere, but it was there for syntax compatibility with > Rails helpers. > > > The reason I am asking is that I would like to do away with the optional > name argument so that I can upgrade the directive to also allow a string url > to be specified. Rails link_to allows the options argument to be a hash like > {:action => :new} or it can be a string in which case it is used directly. > > So to support this, I need to get rid of the optional name argument (and > discarding code) so that if a string is specified we use it as the url. > > Note: we can''t simply check for a hash since you can specify an optional > additional hash in either case. > > > I don''t believe our docs mention using the optional name argument and > neither does the generator, so I am thinking maybe no one was using that > form. > > So if no one is using it then, I can easily upgrade this without too much > worry. We have ideas for doing syntax checks and upgrading compatibility, > but these will take some work to implement and if no one is really using > this optional form of calling the directive, it would be easier to simply > drop that form to allow for the new string url functionality. > > Thanks, > > Jeff > > -- > Jeff Barczewski, MasterView core team > Inspired Horizons Ruby on Rails Training and Consultancy > Next Ruby on Rails plus JRuby workshop Feb 22-24 St. Louis, MO > http://inspiredhorizons.com/training/rails/index.html > Limited seating, register now! > _______________________________________________ > Masterview-users mailing list > Masterview-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/masterview-users > >-- Ed Howland http://greenprogrammer.blogspot.com