When it comes to HTML... it's kind of hard to not... hard-code it. Either you end up having some dictionary that is a pain to manage or you just have good conventions.
This is what we do at Planet Argon to keep things a bit more organized. * http://www.robbyonrails.com/articles/2007/08/01/designers-developers-and-the-x_-factor Good luck! Robby On Tue, Oct 21, 2008 at 10:32 AM, Nick <[EMAIL PROTECTED]> wrote: > > Should HTML DOM IDs be hard-coded throughout a Rails app, or stored > within..an appropriate model or helper or ..? > > Here's an example problem: > > /neighbourhoods/1/map/ has a form: > # map.html.erb > <% form_remote_tag ... :html => {:id => 'map-filter-form'} do %> > > When the page loads, the form needs to be submitted: > # public/javascript/submit_map_filter_form.js > Event.observe(window, 'load', function() { > $('map-filter-form').onsubmit(); > }); > > Thus, I include the Javascript file mentioned above: > # map.html.erb > <%= javascript_include_tag 'submit_map_filter_form' %> > > This feels wrong because the form's DOM ID ("map-filter-form") is hard- > coded in multiple locations (the view, and the Javascript file). As I > add functionality that uses the form, the number of places where the > form's DOM ID is hardcoded will increase. > > Does anyone have suggestions or comments for how to deal with this? > > Cheers, > Nick > > > -- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting http://www.planetargon.com/ http://www.robbyonrails.com/ aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

