[Masterview-devel] MasterView generation from existing rhtml

Jeff Barczewski
Mon, 26 Jun 2006 22:17:48 -0000

On 6/26/06, Sergey Shalatskiy <sshalatskiy at mdlogix.com>
wrote:
>
> >>----- Original Message -----
> >>From: Jeff Barczewski
> >>To: Sergey Shalatskiy
> >>Sent: Monday, June 26, 2006 12:30 PM
> >>Subject: Re: MasterView generation from existing rhtml
>
>
> >>Yes, I think what you mentioned could work but the only when I was
> >>thinking through this a while back I was >>having trouble
figuring out
> how
> >>to know what all pieces (rhtml partials and layouts) to pull in.
>
> It looks like erb will do the heavy lifting for you in this case, and
> possibly all you need would be just to pick up an rhtml file to parse and
> convert it to html by passing to erb with all the proxies I mentioned
> loaded
> instead of original Rails helpers (just don''t load helpers).
>
>
>
> >>Honestly I didn''t spend much time looking at it but it did
seem like it
> >>would be a nice thing to do if possible.
>
> IMHO, this feature will be the deciding factor for marketing MasterView.
> The
> idea and original implementation are
> escellent, but the ability to create html from existing files in the
> application will be crucial to success of the project.
>
> >>I will put it on the todo list.
>
> >>Thanks for the idea and approach.
>
> You are very welcome.
>
> Sergey
>
> P.S.  I don''t quite understand how the masterview template is
used. It
> seems
> like it duplicates the contents of the view html files, but I
don''t see
> the
> purpose of it.


Might just be misundersting of terminology. We call the masterview html
files masterview templates in that they create a bunch of other rhtml files
under the covers.

For instance in the default generator, the list.html file generates the
layout/foo.rhtml, foo/list.rhtml and other partials. The other files like
edit.html creates edit.rhtml and imports the layout/foo.rhtml and any other
partials they need to allow you to see a full page view when designing. So
there is duplication only so that you can get a full page view of what
everything will look like. If you change the layout section in
list.htmlthen you can have MasterView rebuild the other files to get
the layout part
sync''d up so that you''ll have a consistent view when working
with that file
in your editor (otherwise it doesn''t really matter).

The generator can generate a version of file that is a single page
containing all the other views, so there is no duplication. However this has
drawbacks in that it is a single page that keeps getting bigger and bigger
(hard to have multiple people working at once), and it is more difficult to
switch between views when desiging, have to change which css is on to hide
other sections, etc. So it appeared that having a small amount of
duplication made things work easier.


Can you tell me a couple of words about it? - It would give me an insight
on
> what''s going on, and then I could possibly try to help you with
> implementing
> the idea I coined. (It shows my lazyness perhaps, but we all have too
> little time to spend on something that we are not paid for...)
> Also, how can I add new views? It is not quite clear to me. The
> documentation is focused on the CRUD set of actions, and it would be nice
> to
> have a few words how to work with new actions and views.


Yes, I was even planning to do a little video on this. Basically you can
either create a new file manually or I have streamlined it so that you can
copy an existing action and it will automatically pull in the layout and
such, saving one a little trouble in getting things setup. We will document
and get the video out shortly.


________________________________________________________
> On 6/26/06, Sergey Shalatskiy < sshalatskiy at
guerillaviralmarketing.com>
> wrote:
> Jeff,
>
> Thanks for a quick answer. It helped a lot.
> Regarding the issue with generating html from rhtml, I don''t see
why it
> can
> be difficult. If the difficulty you see is in converting the erb
> statements,
> you could use erb itself, I believe, by replacing standard rails methods
> for
> things like
> error_messages_for, or any other methods that have equivalents in
> MasterView
> directives, by masterview proxies that generate its own output by
> converting
> them into directives. Basically, it seems to me, you just need a reverse
> method for every directive. The rest is to combine everything in a
> template
> and generate html per every rhtml.
> Not sure, though, what to do with rjs files, if anything.
> Although, maybe I oversimplify things here.
> Does it make sense to you?
>
> Thanks,
>
> Sergey Shalatskiy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...