Jeff Barczewski
2006-Jul-17 19:38 UTC
[Masterview-devel] Should MV assume a generate destination if none is provided in the template?
I was thinking that for beginning users that the mv:generate thing is a brand new concept from all of the other templating systems so if they write some templates and don''t include those directives (mv:generate or mv:gen_partial) they won''t get any output and will be thinking it is broken. So much like rails assumes that if you don''t specify a render call in your controller that it should use the default render view, maybe MV should assume that if you don''t specify any mv:generate or mv:gen_partial calls that we should assume a mv:generate="*". And if their root is <html> then we would assume that they want the content of the body for this output so we would do essentially put this in the body tag <body mv:generate="*" mv:omit_tag="">, since typically this will be wrapped with a layout. If they don''t lead with <html> then we''d put the mv:generate="*" at the root and leave out the omit_tag.. This would make it easier for people that are starting out, to get something working especially if they have tried other similar template libs. The only issue I see with this is that if people have other non mv html files in their tree (not sure why they would though since they typically would be in public) then those would potentially generate rhtml as well. We could make the directive configurable as to whether it is enabled, but maybe that is overkill. If we make the assumption that either they won''t have non mv html files in their view dirs or that it doesnt matter if some extra rhtml files are created then we it should work fine. Ideas or thoughts? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060717/88265330/attachment.html
Deb Lewis
2006-Jul-18 16:42 UTC
[Masterview-devel] Should MV assume a generate destination if none is provided in the template?
I think that''s a good default, tho let''s think through the
wrinkles a bit
more just to make sure we aren''t missing something about being able to
reliably do the "right" thing.
I think it''s ok to assume that .html in the app/view directory is
intended
by be used w/in the rendering framework. If you don''t want any
processing,
you should have put that file in your app/public.
But let''s allow for exceptions by an "ignore me entirely"
attribute: e.g.,
<body mv:ignore="">
....
</body>
means "buzz off and leave me alone, I don''t want no processing on
me".
But then, yes, agree with your proposal: if a .html file in app/views which
is truly <html> contains no output generation directives (no mv:generate
or
mv:gen_partial), then mv assumes default as if you had written:
<body mv:generate="{template_path}" mv:omit_tag="">
....
</body>
That''s nice, gives you an easy way to pour chunks of basic content into
your
site to leverage a page framing layout without any extra work.
BTW, if we don''t already, suggest we interpret both
mv:generate="" and
mv:generate="*" as shorthand for mv:generate={template_path}".
(can''t
remember if we''re doing that, need to recheck the subst. code)
~ Deb
_____
From: Jeff Barczewski [mailto:jeff.barczewski at gmail.com]
Sent: Monday, July 17, 2006 12:39 PM
To: masterview-devel at rubyforge.org; djlewis at acm.org
Subject: Should MV assume a generate destination if none is provided in the
template?
I was thinking that for beginning users that the mv:generate thing is a
brand new concept from all of the other templating systems so if they write
some templates and don''t include those directives (mv:generate or
mv:gen_partial) they won''t get any output and will be thinking it is
broken.
So much like rails assumes that if you don''t specify a render call in
your
controller that it should use the default render view, maybe MV should
assume that if you don''t specify any mv:generate or mv:gen_partial
calls
that we should assume a mv:generate="*". And if their root is
<html> then we
would assume that they want the content of the body for this output so we
would do essentially put this in the body tag <body
mv:generate="*"
mv:omit_tag="">, since typically this will be wrapped with a
layout. If they
don''t lead with <html> then we''d put the
mv:generate="*" at the root and
leave out the omit_tag..
This would make it easier for people that are starting out, to get something
working especially if they have tried other similar template libs.
The only issue I see with this is that if people have other non mv html
files in their tree (not sure why they would though since they typically
would be in public) then those would potentially generate rhtml as well. We
could make the directive configurable as to whether it is enabled, but maybe
that is overkill. If we make the assumption that either they won''t have
non
mv html files in their view dirs or that it doesnt matter if some extra
rhtml files are created then we it should work fine.
Ideas or thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/masterview-devel/attachments/20060718/da910b8d/attachment.html
Jeff Barczewski
2006-Jul-18 19:20 UTC
[Masterview-devel] Should MV assume a generate destination if none is provided in the template?
Sounds good. I think we had the generate="*" in there but would have to double check. On 7/18/06, Deb Lewis <djlewis at acm.org> wrote:> > I think that''s a good default, tho let''s think through the wrinkles a bit > more just to make sure we aren''t missing something about being able to > reliably do the "right" thing. > > I think it''s ok to assume that .html in the app/view directory is intended > by be used w/in the rendering framework. If you don''t want any processing, > you should have put that file in your app/public. > > But let''s allow for exceptions by an "ignore me entirely" attribute: e.g., > > <body mv:ignore=""> > .... > </body> > > means "buzz off and leave me alone, I don''t want no processing on me". > > But then, yes, agree with your proposal: if a .html file in app/views > which is truly <html> contains no output generation directives (no > mv:generate or mv:gen_partial), then mv assumes default as if you had > written: > > <body mv:generate="{template_path}" mv:omit_tag=""> > .... > </body> > > That''s nice, gives you an easy way to pour chunks of basic content into > your site to leverage a page framing layout without any extra work. > > BTW, if we don''t already, suggest we interpret both mv:generate="" and > mv:generate="*" as shorthand for mv:generate={template_path}". (can''t > remember if we''re doing that, need to recheck the subst. code) > > ~ Deb >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060718/07436e5e/attachment.html