I spent way too long trying to solve this problem. I was not having any
luck implementing any helpers or extensions in 2.3.2, and did not want
to set my database fields to "No data" or whatever to populate the blank
fields.
I therefore went with the old standby, dealing with the CSS through
javascript. Slightly hacky, but it works across browsers:
<body onload="fixElements();">
And the javascript:
function classes(cn, mom) { //from rnd_me at codingforums.com
if(!mom){mom=document;}
if(mom.getElementsByClassName){ return mom.getElementsByClassName(cn);
}
var rx = new RegExp("(?:^|\\s)" + cn+ "(?:$|\\s)");
var allT = mom.getElementsByTagName("*"), allCN = [], ac="", i = 0, a;
while (a = allT[i=i+1]) {
ac=a.className;
if ( ac && ac.indexOf(cn) !==-1) {
if(ac===cn){ allCN[allCN.length] = a; continue; }
rx.test(ac) ? (allCN[allCN.length] = a) : 0;
}
}
return allCN;
}
function fixElements() {
var emptyInlineEdits = classes("in_place_editor_field");
for (var i=0; i < emptyInlineEdits.length; i++) {
if (emptyInlineEdits[i].innerHTML=='') {
emptyInlineEdits[i].innerHTML='_';
}
}
}
I hope this can save someone some time!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---