Help with comment box in themes

I’ve noticed that the Scribbish theme doesn’t support some of the
slick comment functionality that Azure does. Namely, it doesn’t seem
to have the admin “buttons” for nuking or editing, and it doesn’t seem
to slide the comments into place. I’ve managing to hack both of those
in pretty easily, but I’m stumped on one final piece. When I submit a
comment, it does not clear the comment_body textarea.

I’ve looked at the default view code for _comment_box.rhtml in Azure,
and I’ve compared it to what I’ve got for my hacked up Scribbish, and
I cannot see why it’s not working. The textareas in both are created
with <%= text_area ‘comment’, ‘body’ %> tags. The form id and name
are both the same. I’ve modified the Submit button code so it matches
Azure (that was the key to getting the comment to slide into place),
but I cannot for the life of me find the piece that will clear that
textarea. Any help would be greatly appreciated, and I’ll happily
submit my diffs once I get it working.


Hmm…I did a little more testing when I got home from work and
discovered that, for some very odd reason, the textarea clearing seems
to work for Scribbish in Safari, but not in Flock or Firefox on my
Mac. In my testing at work, Azure seemed to work in Firefox and
Flock, but not Scribbish. Now I’m thoroughly confused. Anyone got
any suggestions?

Btw, this is with latest svn trunk, including the Rails 1.1.5 push.


No idea. Have you looked at Azure’s Javascript?


Yeah, but all of these have been developed using Azure. Look in
typo.js–I seem to recall that there are some comment-specific
functions in there.


Err, correct me if I’m wrong, but Azure has no theme-specific
Javascript. The scripts in public/javascripts should be available to
all themes in Typo, right? As far as I can tell (and I’m still trying
to learn my way around in the codebase), these scripts are what
provide the effects for the Azure theme. Looking at the html source
for my site rendered with Azure and with Scribbish, I see the same
four javascript files being loaded in each:


I’m actually thinking that there’s a possible difference in the DOM
representation that’s causing the problem. Azure renders the form in
a table; Scribbish renders it in a fieldset. Perhaps this is causing
the problem? I’ll try pulling the form out of the fieldset in
Scribbish and see what happens.

Any other suggestions that any might have would be appreciated.


I will be possibly running a system of typo blogs, so I was just
how can I replace the default azure theme with lucid or some other theme

No, I am not talking about, user option of going to theme tab and
the theme.I want to change the default theme.One option I can see, is
blogs table and put theme = “lucid” or something like that.

But, where does typo picks the default theme from?


Thanks for the nudge in the right direction. I think I’ve got it
working now. The problem was in typo.js, as you suggested. It clears
the textarea by element number in the form rather than element id. A
simple fix:

Index: typo.js

— typo.js (revision 1208)
+++ typo.js (working copy)
@@ -45,8 +45,8 @@
new Effect.BlindDown($(‘commentList’).lastChild);
if ($(‘dummy_comment’)) { Element.remove(‘dummy_comment’); }

  • $(‘commentform’).elements[3].value = ‘’;
  • $(‘commentform’).elements[3].focus();
  • $(‘commentform’).elements[‘comment_body’].value = ‘’;
  • $(‘commentform’).elements[‘comment_body’].focus();

This should then make the function work for any script that uses <%=
text_area ‘comment’, ‘body’ %> to create the comment text area. I
tested it using Azure and it doesn’t break it, so I’d recommend the
patch be committed to svn.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs