[typo] Help with comment box in themes

Jason Burks jburks725 at gmail.com
Thu Aug 10 11:24:00 EDT 2006


Scott,

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 @@
   Element.cleanWhitespace('commentList');
   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.

Thanks,
Jason

On 8/9/06, Scott Laird <scott at sigkill.org> wrote:
> 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.
>
>
> Scott
>
> On 8/9/06, Jason Burks <jburks725 at gmail.com> wrote:
> > 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:
> >
> > /javascripts/cookies.js
> > /javascripts/prototype.js
> > /javascripts/effects.js
> > /javascripts/typo.js
> >
> > 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.
> >
> > -Jason
> >
> > On 8/9/06, Scott Laird <scott at sigkill.org> wrote:
> > > No idea.  Have you looked at Azure's Javascript?
> > >
> > >
> > > Scott
> > >
> > > On 8/9/06, Jason Burks <jburks725 at gmail.com> wrote:
> > > > 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.
> > > >
> > > > -Jason
> > > >
> > > > On 8/9/06, Jason Burks <jburks725 at gmail.com> wrote:
> > > > > 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.
> > > > >
> > > > > Regards,
> > > > > Jason
> > > > >
> > > > _______________________________________________
> > > > Typo-list mailing list
> > > > Typo-list at rubyforge.org
> > > > http://rubyforge.org/mailman/listinfo/typo-list
> > > >
> > > _______________________________________________
> > > Typo-list mailing list
> > > Typo-list at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/typo-list
> > >
> > _______________________________________________
> > Typo-list mailing list
> > Typo-list at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/typo-list
> >
> _______________________________________________
> Typo-list mailing list
> Typo-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/typo-list
>


More information about the Typo-list mailing list