Hi, I got it working. I found the missing pieces in /sw/lib/python2.5/site-packages/django/views/i18n.py. Cheers, Alan
On Tue, Feb 17, 2009 at 15:36, Alan <alanwil...@gmail.com> wrote: > Hi There, > I am still working on CollapsedFieldsets.js and with help of Safari for > developer I got this error for the javascript: > > Can't find variable: gettext > file:///Users/alan/Desktop/CollapsedFieldsets.js (line 34) > > Line 34: > collapse_link.innerHTML = gettext('Show'); > > I don't know javascript enough to say if *gettext* is a built-in javascript > function or it is declared elsewhere. > > Any help here would be very appreciated. > > Alan > > > On Tue, Feb 17, 2009 at 11:25, Alan <alanwil...@gmail.com> wrote: > >> So, I tried a lot and narrowed as much as I could from the django admin >> pages and got almost all from CollapsedFieldsets.js except one thing: >> - If CollapsedFieldsets.js is generating " (<a id="fieldsetcollapser3" >> class="collapse-toggle" href="#">Show</a>)" then it's not showing in my >> browser, i.e., I don't the (Hide) or (Show) link. >> >> I know the javascript is working (although I am learning javascript on the >> fly here, I have no idea how to the debug this more properly) and I have the >> minimum css. I am posting here what I have (besides the originals core.js >> and CollapsedFieldsets.js scripts from django): >> >> html test code: >> >> <html><head> >> <link rel="stylesheet" type="text/css" href="forms.css" /> >> <script type="text/javascript" src="core.js"></script> >> <script type="text/javascript" src="CollapsedFieldsets.js"></script> >> </head> >> <body> >> <fieldset class="collapse"> >> <h2>Job Details</h2> >> <div class="form-row jdate "> >> <div> >> <label for="id_jdate" class="required">Jdate:</label><input >> name="jdate" value="Tue Feb 10 20:37:52 2009" class="vTextField" >> maxlength="30" type="text" id="id_jdate" /> >> </div> >> </div> >> </fieldset> >> </body></html> >> >> forms.css file: >> /* COLLAPSED FIELDSETS */ >> fieldset.collapsed * { display:none; } >> fieldset.collapsed h2, fieldset.collapsed { display:block !important; } >> fieldset.collapsed h2 { background-image:url(../img/admin/nav-bg.gif); >> background-position:bottom left; color:#999; } >> fieldset.collapsed .collapse-toggle { padding:3px 5px !important; >> background:transparent; display:inline !important;} >> >> It seems to me that only this part from CollapsedFieldsets.js code is not >> working: >> >> var collapse_link = document.createElement('a'); >> collapse_link.className = 'collapse-toggle'; >> collapse_link.id = 'fieldsetcollapser' + i; >> collapse_link.onclick = new >> Function('CollapsedFieldsets.show('+i+'); return false;'); >> collapse_link.href = '#'; >> collapse_link.innerHTML = gettext('Show'); >> var h2 = fs.getElementsByTagName('h2')[0]; >> h2.appendChild(document.createTextNode(' (')); >> h2.appendChild(collapse_link); >> h2.appendChild(document.createTextNode(')')); >> >> Everything else seems to be working (like class with "errors" will expand >> collapsed fields, CollapsedFieldsets.show(0); and so on). >> >> I am using Firefox with Firebug plugin to help me here. >> >> Well, I hope someone else can give an idea why I am missing this very last >> point. >> >> Many thanks in advance. >> >> Alan >> >> >> On Fri, Feb 13, 2009 at 13:37, Alan <alanwil...@gmail.com> wrote: >> >>> Gosh, you're right. From the source of admin: >>> <script type="text/javascript" >>> src="/media/js/admin/CollapsedFieldsets.js"></script> >>> >>> Thanks a lot, >>> >>> Alan >>> >>> On Fri, Feb 13, 2009 at 12:51, Daniel Roseman < >>> roseman.dan...@googlemail.com> wrote: >>> >>>> >>>> On Feb 13, 11:23 am, Alan <alanwil...@gmail.com> wrote: >>>> > Indeed, I have been looking athttp:// >>>> docs.djangoproject.com/en/dev/intro/tutorial02/#s-customize-th... >>>> > used 'classes': ['collapse'] in my admin page to see how it works and >>>> > I >>>> > don't see any javascript there and I don't believe page is been >>>> reloaded. >>>> >>>> You won't get anywhere without at least some javascript. The admin >>>> loads the CollapsedFieldsets.js script from contrib/admin/media/js/ >>>> admin/ to make the show/hide functionality work whenever there's at >>>> least one collapsible fieldset in the form. >>>> -- >>>> DR. >>>> >>>> >>>> >>> >>> >>> -- >>> Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate >>> Department of Biochemistry, University of Cambridge. >>> 80 Tennis Court Road, Cambridge CB2 1GA, UK. >>> >>http://www.bio.cam.ac.uk/~awd28<< >>> >> >> >> >> -- >> Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate >> Department of Biochemistry, University of Cambridge. >> 80 Tennis Court Road, Cambridge CB2 1GA, UK. >> >>http://www.bio.cam.ac.uk/~awd28<< >> > > > > -- > Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate > Department of Biochemistry, University of Cambridge. > 80 Tennis Court Road, Cambridge CB2 1GA, UK. > >>http://www.bio.cam.ac.uk/~awd28<< > -- Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. >>http://www.bio.cam.ac.uk/~awd28<< --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---