From james.britt at gmail.com Tue Aug 14 16:53:59 2007 From: james.britt at gmail.com (James Britt) Date: Tue, 14 Aug 2007 13:53:59 -0700 Subject: [Masterview-users] Mastervew and Cruisecontrol.rb Message-ID: <46C21667.1000408@gmail.com> Hi. I've set up CruiseControl.rb with a Rails app using MasterView. CruiseControl.rb is unhappy with MasterView. I can shell in to the server where CruiseControl.rb lives, cd to the work directory for my project, and run 'rake', and it runs fine. But CruiseControl.rb executes things in a somewhat roundabout way, and when it loads vendor/plugins/masterview/lib/masterview/initializer.rb that code seems not to know anything about ActionController, raising uninitialized constant MasterView::Configuration::ActionController Has anyone experience with a Rails+MasterView project and CruiseControl.rb? Thanks, James Britt From james.britt at gmail.com Tue Aug 14 18:15:08 2007 From: james.britt at gmail.com (James Britt) Date: Tue, 14 Aug 2007 15:15:08 -0700 Subject: [Masterview-users] Placing mv directives as immediate children of the html element Message-ID: <46C2296C.4030806@gmail.com> I have views that use a number of partials. One partial defines the html "head" element, holding common meta elements, css links, and the title element. .... I want each page to have a distinct title, so the MasterView HTML has this: Fake Title However, for this to work I need to assign a value to the @title variable before it is processed. I'm stumped. I can set this in the corresponding action in the controller, but I'd prefer to set it in the view itself so that the designer can set the name. I've tried adding a directive right after the html element but before the call to " References: <46C21667.1000408@gmail.com> Message-ID: <19cda190708150405n3c66cf11we890226ce72ab319@mail.gmail.com> On 8/14/07, James Britt wrote: > > Hi. I've set up CruiseControl.rb with a Rails app using MasterView. > > CruiseControl.rb is unhappy with MasterView. I can shell in to the > server where CruiseControl.rb lives, cd to the work directory for my > project, and run 'rake', and it runs fine. But CruiseControl.rb > executes things in a somewhat roundabout way, and when it loads > > vendor/plugins/masterview/lib/masterview/initializer.rb > > that code seems not to know anything about ActionController, raising > > uninitialized constant MasterView::Configuration::ActionController > > > Has anyone experience with a Rails+MasterView project and CruiseControl.rb > ? That's strange, I'll have to see if I can figure out what is going on there. -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070815/548da4f7/attachment-0001.html From jeff.barczewski at gmail.com Wed Aug 15 07:08:21 2007 From: jeff.barczewski at gmail.com (Jeff Barczewski) Date: Wed, 15 Aug 2007 06:08:21 -0500 Subject: [Masterview-users] Placing mv directives as immediate children of the html element In-Reply-To: <46C2296C.4030806@gmail.com> References: <46C2296C.4030806@gmail.com> Message-ID: <19cda190708150408n534f58b9j6120b16794ee11c6@mail.gmail.com> On 8/14/07, James Britt wrote: > > I have views that use a number of partials. > > One partial defines the html "head" element, holding common meta > elements, css links, and the title element. > > > > .... > > > I want each page to have a distinct title, so the MasterView HTML has > this: > > > Fake Title > > However, for this to work I need to assign a value to the @title > variable before it is processed. > > I'm stumped. I can set this in the corresponding action in the > controller, but I'd prefer to set it in the view itself so that the > designer can set the name. > > I've tried adding a directive right after the html element but before > the call to " > but MasterView seems to ignore that; it never appears in the resulting > rhtml. > > The MasterView docs do not indicate passing of arguments to > mv:import_render; I played around but that does seem to be an option as > it would be with a direct rhtml partial reference where you can use a > hash to define partial variable values. > > > > Suggestions? I have typically always defined my titles and page specifc data in my controller, but I can see the benefit of what you are trying to do. I have a couple ideas which might solve the problem. I'll explore those this morning and let you know my findings. -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070815/f4e5a2c8/attachment.html From james at neurogami.com Wed Aug 15 12:09:40 2007 From: james at neurogami.com (James Britt) Date: Wed, 15 Aug 2007 09:09:40 -0700 Subject: [Masterview-users] Placing mv directives as immediate children of the html element In-Reply-To: <19cda190708150408n534f58b9j6120b16794ee11c6@mail.gmail.com> References: <46C2296C.4030806@gmail.com> <19cda190708150408n534f58b9j6120b16794ee11c6@mail.gmail.com> Message-ID: <46C32544.1020901@neurogami.com> Jeff Barczewski wrote: > > I have typically always defined my titles and page specifc data in my > controller, but I can see the benefit of what you are trying to do. I > have a couple ideas which might solve the problem. I'll explore those > this morning and let you know my findings. Thanks! James From jeff.barczewski at gmail.com Wed Aug 15 16:26:44 2007 From: jeff.barczewski at gmail.com (Jeff Barczewski) Date: Wed, 15 Aug 2007 15:26:44 -0500 Subject: [Masterview-users] Placing mv directives as immediate children of the html element In-Reply-To: <46C32544.1020901@neurogami.com> References: <46C2296C.4030806@gmail.com> <19cda190708150408n534f58b9j6120b16794ee11c6@mail.gmail.com> <46C32544.1020901@neurogami.com> Message-ID: <19cda190708151326y2a387352q2531da067748e448@mail.gmail.com> On 8/15/07, James Britt wrote: > > Jeff Barczewski wrote: > > > > > I have typically always defined my titles and page specifc data in my > > controller, but I can see the benefit of what you are trying to do. I > > have a couple ideas which might solve the problem. I'll explore those > > this morning and let you know my findings. > > Thanks! I worked through a couple ideas and believe that I have a approach that will work. I think it makes sense to be able to modify both the collection, object, and locals that are passed into the partial so that you can change what goes in from any page or even use multiple times on the same page. So the synchronization code will be updated to ignore those types of differences for the gen_partial and import_partial calls and it will keep the existing values when rebuilding. I think this will be a nice change giving much flexibility and it shouldn't break any existing code since they will have the same values already. I am partially through adding some tests and implementing. Will try to wrap this up by tomorrow if possible and will let you test it out to see if if solves your problems. I'll shoot you an email when it is ready to roll. Jeff -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070815/c5c3001e/attachment.html From james at neurogami.com Thu Aug 16 20:51:32 2007 From: james at neurogami.com (James Britt) Date: Thu, 16 Aug 2007 17:51:32 -0700 Subject: [Masterview-users] Placing mv directives as immediate children of the html element In-Reply-To: <19cda190708151326y2a387352q2531da067748e448@mail.gmail.com> References: <46C2296C.4030806@gmail.com> <19cda190708150408n534f58b9j6120b16794ee11c6@mail.gmail.com> <46C32544.1020901@neurogami.com> <19cda190708151326y2a387352q2531da067748e448@mail.gmail.com> Message-ID: <46C4F114.6090400@neurogami.com> Jeff Barczewski wrote: > already. > > I am partially through adding some tests and implementing. Will try to > wrap this up by tomorrow if possible and will let you test it out to see > if if solves your problems. > > I'll shoot you an email when it is ready to roll. Sweet! Thanks, James From jeff.barczewski at gmail.com Sat Aug 18 18:04:32 2007 From: jeff.barczewski at gmail.com (Jeff Barczewski) Date: Sat, 18 Aug 2007 17:04:32 -0500 Subject: [Masterview-users] Placing mv directives as immediate children of the html element In-Reply-To: <46C4F114.6090400@neurogami.com> References: <46C2296C.4030806@gmail.com> <19cda190708150408n534f58b9j6120b16794ee11c6@mail.gmail.com> <46C32544.1020901@neurogami.com> <19cda190708151326y2a387352q2531da067748e448@mail.gmail.com> <46C4F114.6090400@neurogami.com> Message-ID: <19cda190708181504r39a90961m7bbc341b4160969b@mail.gmail.com> On 8/16/07, James Britt wrote: > > Jeff Barczewski wrote: > > already. > > > > I am partially through adding some tests and implementing. Will try to > > wrap this up by tomorrow if possible and will let you test it out to see > > if if solves your problems. > > > > I'll shoot you an email when it is ready to roll. James, Well I finally was able to get the desired functionality with this. If you pull the trunk svn://rubyforge.org/var/svn/masterview/trunk/masterview then it should solve your issue with being able to specify different locals, collections, or objects between each use of gen_partial and import_render. It will also allow you to reuse a partial on the same page with different values. I had to adjust the rebuilding templates system so that it would retain the proper values as well but I like the result. I added some tests to verify operation and it seems to be doing what it should. With this version you should be able to do stuff like
on one template and in another
or even reuse the template with more import_renders on the same page. Let me know if this fixes things for you and/or causes any other problems. PS. I still need to look into the cruise control issue, will have to get that setup first to look into it. Jeff -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070818/652cd025/attachment.html From jeff.barczewski at gmail.com Mon Aug 20 17:48:11 2007 From: jeff.barczewski at gmail.com (Jeff Barczewski) Date: Mon, 20 Aug 2007 16:48:11 -0500 Subject: [Masterview-users] External CSS image URL In-Reply-To: <83C17710F5C2D34B99D76DC999774D5301341194@INTEXSRV.intermark.local> References: <83C17710F5C2D34B99D76DC999774D5301341194@INTEXSRV.intermark.local> Message-ID: <19cda190708201448x6fc93d69x6489fbc812b83711@mail.gmail.com> On 8/20/07, Jordan, Brian wrote: > > I read in a thread from rubyforge.org/pipermail/masterview-users I think > in a piece from you that there was a way to change the location of image URL > in external CSS using masterview directives. I figured out how to do this > for images on submit forms using mv:attr but not for external CSS image > URL. Could you let me know how this is done or point me to a URL that > explains how to do it? > Brian, We just added (in v0.3.3) the ability for MasterView to automatically copy images, css, and scripts from a local design location to the place appropriate when running rails (typically under /public/... ). Check out http://masterview.org/configuration.html and search down for auto_copy_file_entries What you can do is setup so that MasterView will automatically copy files from several locations and put them into other locations for runtime. You can have it filter by extension if you choose. So what people will typically do, is to have their templates, images, css setup so they can use them locally and then have MasterView copy to the proper directories so they will work at runtime. I believe this will solve things for you, once you setup the proper config. Let me know if you have additional questions. Blessings, Jeff -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070820/ea5ad130/attachment.html From jeff.barczewski at gmail.com Tue Aug 21 11:59:05 2007 From: jeff.barczewski at gmail.com (Jeff Barczewski) Date: Tue, 21 Aug 2007 10:59:05 -0500 Subject: [Masterview-users] External CSS image URL In-Reply-To: <83C17710F5C2D34B99D76DC999774D5301341196@INTEXSRV.intermark.local> References: <83C17710F5C2D34B99D76DC999774D5301341194@INTEXSRV.intermark.local> <19cda190708201448x6fc93d69x6489fbc812b83711@mail.gmail.com> <83C17710F5C2D34B99D76DC999774D5301341196@INTEXSRV.intermark.local> Message-ID: <19cda190708210859n64a8a57asdc68534a052c029d@mail.gmail.com> On 8/20/07, Jordan, Brian wrote: > > Hi Jeff, > > Thanks for the quick response. Let me make sure I understand. Also let > me explain my problem instead of asking for a solution and perhaps we can > find a more elegant solution. > > With our setup a designer (HTML/CSS artsy type) gives me (I'm a Rails > developer) HTML, CSS, and sometimes Javascript files (usually if we get > javascript it is common code like navigation) with all of the static content > for a site/project. I place the HTML in app/html/ in my Rails directory > structure for my project, e.g. full path is /projects/myapp/app/html. I > place the CSS in /projects/myapp/public/stylesheets. Likewise I place the > images in /projects/myapp/public/images, and the javascript in > /projects/myapp/public/javascripts/ > > Of course the original HTML and CSS files from the designer have URLs like > /stylesheets/x.css, /images/x.jpg, and /javascripts/x.js so I have to modify > the URLs so the designers can load them into a browser. I change the links > for images, stylesheets, and javascripts to ../../../public/xxxxx before > checking them in. It's no big deal since find/replace is your friend. > > The problem I am having is with external CSS with image URLs. One > solution would be to move the HTML to the public directory of the project so > that it renders correctly in the browser and at runtime but that gets messy > when you have numerous files and you need a script to remove the HTML at > runtime so we don't do this. > > The solution you are recommending seems to be to move the > /projects/myapp/public/xxxxx directories to /projects/myapp/xxxxx and use > auto copy to copy the files from /projects/myapp/xxxxx to > /projects/myapp/public/xxxxx at runtime. Is this right? > > I thought there would be something more elegant. Our designers often use > images for submit buttons, but I have an elegant solutions for that. > Whenever I see type="image", value="submit" and > src="../../../public/images/file.jpg" I just use a macro to add > mv:attr":src => /images/file.jpg" and now the file works for the designers > in the browser and at runtime for me. Auto copy seems like it could be > prone to failure if there is not enough space on the drive or the network is > flaky. It seems like we need an mv: tag to replace a CSS attribute. > > Am I missing something or is your solution the only one for this problem? > Thanks for providing some details, that always helps. -To have MasterView rewrite images you can use the mv:image_tag. -To rewrite css stylesheet links - mv:stylesheet_link -And like you mentioned for other situations mv:attr can do some runtime rewriting The problem you mentioned with links in the css needing to be rewritten is a little tricky since we don't have anything currently that processes and operates on the css files themselves, however with a little forethought the problem goes away like so... **If you organize things smartly you can use images in your css and have them work properly at design time and runtime. The key here is to use a relative path to the image which will match the relative path when running on the server. For instance: If your CSS file foo.css lives in app/public/stylesheets/ and it references an images ../images/bar.gif then things will work properly at runtime. In your CSS files the url('../images/bar.gif') is relative to where the stylesheet lives, so if css is in public/stylesheets and image in public/images since images is at same level the ../ gets us where we need to be. At runtime the stylesheet is served from http://servername/stylesheets/foo.css and the image is served via http://servername/images/bar.gif again at the same level so the ../ will be the correct relative path to the image from the css url. You don't want to use absolute urls if you want things to be portable. So if your main problem is getting the images to work properly from the css in both design and runtime, using the ../ relative approach should be all you need. You won't need to do anything else special other than using the mv:link_tag, mv:stylesheet_link and mv:attr things you are already doing. The image referenced in the css will just work via the nature of the relative path. As for the auto copy feature, it can be useful when you want to keep all of your html, css, and images together in one tree to make it easy for designers. For instance you may have a directory app/html where you keep the template files, and underneath that you might have a css, scripts, and images directories. This just makes it easy for the designer since everything is under one tree app/html (app/html/css, app/html/images, app/html/scripts) then the auto copy feature has MasterView copy things to the public directories. This is also great if you were given a prototype web application where everything was already in one tree or if you downloaded an web design template (which are typically structured with html at root and images, scripts, css as subdirectories). Without having to manually move things around, MasterView could copy things for you. The location of where this tree is at is totally configurable. So hopefully all that makes sense. All you need to do is use a relative path from your css file to the images, that will also work as relative path at runtime. Placing css in public/stylesheets and images in public/images will work great, just use url('../images/bar.gif') and you should be all set. If I am still missing something, just let me know, but I believe I understand the situation you have described. Blessings, Jeff -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070821/e707342a/attachment-0001.html From jeff.barczewski at gmail.com Tue Aug 28 11:11:36 2007 From: jeff.barczewski at gmail.com (Jeff Barczewski) Date: Tue, 28 Aug 2007 10:11:36 -0500 Subject: [Masterview-users] Changing end tags In-Reply-To: <19cda190708240847y2c2c161eqa428e444d93c3530@mail.gmail.com> References: <83C17710F5C2D34B99D76DC999774D530134119F@INTEXSRV.intermark.local> <19cda190708211506s57654eb6g4a2c982a9217843f@mail.gmail.com> <83C17710F5C2D34B99D76DC999774D53013411B1@INTEXSRV.intermark.local> <19cda190708230906m21111494oad35bc811ce14865@mail.gmail.com> <83C17710F5C2D34B99D76DC999774D53013411B3@INTEXSRV.intermark.local> <19cda190708231305k7f3f02cay1d956dfbaebed912@mail.gmail.com> <83C17710F5C2D34B99D76DC999774D53013411B5@INTEXSRV.intermark.local> <19cda190708240847y2c2c161eqa428e444d93c3530@mail.gmail.com> Message-ID: <19cda190708280811t3202f592jbe10b50effde1cfb@mail.gmail.com> Brian, I have resolved your collapsing of empty elements in rebuild issue and the code is checked into the trunk. I will summarize the issue here for the maling list. The issue is that if you have empty elements like in your templates (specifically in a layout or partial) and you invoke a rebuild (from admin screen or via rake mv:rebuild, mv:rebuild_all) rexml our parser and serializer collapses the empty elements so it would become