Jeff Barczewski
2006-Jun-26 05:22 UTC
[Masterview-devel] MasterView generation from existing rhtml
Sergey, I haven''t come up with a way to take existing rhtml and create xhtml from them. However you can co-exist with existing rhtml nicely. You can have some thing in masterview templates and other things in simple rhtml and use both interchangeably in your project. If you want to view the generated rhtml files simply to see what masterview is generating behind the scenes then simply do rake mv:view_rhtml RHTML=store/list.html and it will output to stdout. If you want to generate the files to the filesystem so that they will be loaded from there then you can change the setting in config/masterview/setting.rb like so config.generate_rhtml_files = true When this setting is set it will generate rhtml to the file system and it will be loaded from there just like your existing rhtml. Refreshing the browser will reparse the template (and regenerate the rhtml). You can also kick off rhtml generation from the command line using rake mv:parse Let me know if this all makes sense and answers your questions. All the best, Jeff On 6/25/06, Sergey Shalatskiy <sshalatskiy at guerillaviralmarketing.com> wrote:> > Hi Jeff, > > MasterView is excellent! Just a couple of questions: > > Is it possible to generate (x)html from existing rhtml etc. ? > It is very important if someone wants to switch to masteview from regular > rails apps. > Possibly, it would be also convenient to have an option to use existing > files without regeneration, as you mentioned in one of your messages on > forum. > Also, I was not able to generate rhtml files from masterview templates. > How do I do that? It looks like in order to smoothly upgrade existing > projects, > we need roundtrip options. It will help a lot to understand the framework > better and switch to MasterView quickly. Complex applications will require a > lot of manual > work if there is no such options. > > Thanks > > Sergey Shalatskiy >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060626/c3f35ce5/attachment-0001.html
Jeff Barczewski
2006-Jun-26 16:30 UTC
[Masterview-devel] 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. 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. I will put it on the todo list. Thanks for the idea and approach. Jeff 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 > > > ----- Original Message ----- > *From:* Jeff Barczewski <jeff.barczewski at gmail.com> > *To:* Sergey Shalatskiy <sshalatskiy at guerillaviralmarketing.com> > *Sent:* Monday, June 26, 2006 1:22 AM > *Subject:* Re: MasterView generation from existing rhtml > > Sergey, > > I haven''t come up with a way to take existing rhtml and create xhtml from > them. However you can co-exist with existing rhtml nicely. You can have some > thing in masterview templates and other things in simple rhtml and use both > interchangeably in your project. > > If you want to view the generated rhtml files simply to see what > masterview is generating behind the scenes then simply do rake mv:view_rhtml > RHTML=store/list.html and it will output to stdout. > > If you want to generate the files to the filesystem so that they will be > loaded from there then you can change the setting in > config/masterview/setting.rb like so > config.generate_rhtml_files = true > When this setting is set it will generate rhtml to the file system and it > will be loaded from there just like your existing rhtml. > > Refreshing the browser will reparse the template (and regenerate the > rhtml). > > You can also kick off rhtml generation from the command line using rake > mv:parse > > Let me know if this all makes sense and answers your questions. > > All the best, > > Jeff > > > On 6/25/06, Sergey Shalatskiy <sshalatskiy at guerillaviralmarketing.com> > wrote: > > > > Hi Jeff, > > > > MasterView is excellent! Just a couple of questions: > > > > Is it possible to generate (x)html from existing rhtml etc. ? > > It is very important if someone wants to switch to masteview from > > regular rails apps. > > Possibly, it would be also convenient to have an option to use existing > > files without regeneration, as you mentioned in one of your messages on > > forum. > > Also, I was not able to generate rhtml files from masterview templates. > > How do I do that? It looks like in order to smoothly upgrade existing > > projects, > > we need roundtrip options. It will help a lot to understand the > > framework better and switch to MasterView quickly. Complex applications will > > require a lot of manual > > work if there is no such options. > > > > Thanks > > > > Sergey Shalatskiy > > > > ------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.394 / Virus Database: 268.9.4/375 - Release Date: 6/25/2006 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060626/1f4168c3/attachment-0001.html
Jeff Barczewski
2006-Jun-26 22:17 UTC
[Masterview-devel] MasterView generation from existing rhtml
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... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060626/cf3f36ed/attachment.html
Jeff Barczewski
2006-Jul-07 15:05 UTC
[Masterview-devel] MasterView generation from existing rhtml
Wonderful! Thanks I will take a look at your directives and incorporate them. We are in the process of simplifying the directive API so it will be easier and more intuitive as well as working on documentation and such. Will be looking at the reverse engineering feature after that. I appreciate your time and for submitting your code! Thanks, Jeff On 7/6/06, Sergey Shalatskiy <sshalatskiy at mdlogix.com> wrote:> > Hi Jeff, > > I gave MasterView a try, and understood much more about it, IMHO. > Also, I fixed a couple of bugs and wrote some extra directives (mainly by > blatantly cutting and pasting your code). > I''ve tested it with Ajax components, and it works fine, so I am sending > you the units, if you are interested in the feedback (haven''t written any > tests, though). > How is the new development going? > > Thanks, > > Sergey Shalatskiy > > ----- Original Message ----- > *From:* Jeff Barczewski <jeff.barczewski at gmail.com> > *To:* Sergey Shalatskiy <sshalatskiy at mdlogix.com> > *Sent:* Monday, June 26, 2006 7:18 PM > *Subject:* Re: MasterView generation from existing rhtml > > I just got through chatting with the other main developer and she agrees > with you, so it will be something that I will move up higher on the todo > list :-) It will be a big help if people can pull in their existing site in > addition to creating new pages. Make adoption easy. > > Thanks again for the suggestion! > > > > On 6/26/06, Sergey Shalatskiy <sshalatskiy at mdlogix.com > wrote: > > > > > > 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. > > > > > ------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.394 / Virus Database: 268.9.4/375 - Release Date: 6/25/2006 > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20060707/01c572e1/attachment.html
Jeff Barczewski
2006-Aug-27 18:02 UTC
[Masterview-devel] MasterView generation from existing rhtml
Sergey, Well I finally got the directive api refactoring done after a detour with the rails security fix and other things. So once I was done, I took a look at your code that you submitted and incorporated the bug fix and other directives into the code base. I rewrote them using hte new api. A couple of them namely text_area_tag and text_field_tag I left out since I thought by adding them would be confusing to people about which to use text_area or text_area_tag ... and I think that you can get the same effect of text_area_tag by simply using a mv:content directive and text_field_tag can be achieved by using mv:attr=":value => ''foo''". I also created an eval directive based off your idea with the silent directive, though I changed it a bit so that it puts the <% foo %> before the start of the elemnt and leaves the rest alone. I have credited your fix and ideas to you in the source. Anyway, thanks again for the submission. Sorry for merging it in, things should pick up now. All this is in subversion head and will go out with next gem/plugin release. Jeff> On 7/6/06, Sergey Shalatskiy <sshalatskiy at mdlogix.com> wrote: > > Also, I fixed a couple of bugs and wrote some extra directives (mainly by > blatantly cutting and pasting your code). > > > >