Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #514 (closed enhancement: fixed)

Opened 13 years ago

Last modified 12 years ago

[PATCH] CalendarDateTime upgrade to new style widgets

Reported by: alberto@… Owned by: anonymous
Priority: normal Milestone: 0.9
Component: CherryPy Version:
Severity: normal Keywords:
Cc:

Description

This patch upgrades CalendarDatePicker? and CalendarDateTimePicker? to the new widget API

Attachments

calendarpicker.patch Download (6.3 KB) - added by anonymous 13 years ago.
calendarpicker.2.patch Download (5.6 KB) - added by anonymous 13 years ago.

Change History

Changed 13 years ago by anonymous

comment:1 Changed 13 years ago by anonymous

  • Type changed from defect to enhancement
  • Milestone set to 0.9

Javascript doesn't work because of #515 (at least on FF and Safari Mac). Saving the produced html file and manually removing spurious links fixes the problem (so the patch *should* work)

comment:2 Changed 13 years ago by michele

Thanks again Alberto.

I was just wondering, as Kevin said in a comment on newforms.py, should we move this calendar stuffs to calendar.py?

Same for the AutoCompleteField once ported, maybe we can start an ajax.py under widgets.

Opinions?

One thing I would like for sure is moving js/css stuff of the calendar to a subdirectory under widgets/static/calendar since there is are a lot of things there.

comment:3 Changed 13 years ago by alberto@…

Sure, it sounds like a good idea...

comment:4 Changed 13 years ago by michele

One other small thing (just to keep the logic out of widgets template ;-)), I think you can move:

    <?python 
        if hasattr(value, 'strftime'):
            strdate = value.strftime(format)
        else:
            strdate = value
        button_text = value_of('button_text', 'Choose')
    ?>

to the update_data method.

comment:5 Changed 13 years ago by alberto@…

Applied your suggestions plus taken advatage of the new template_vars class attribute. Looks prettier now! If Kevin (or another committer) decides to move it to another module just Copy&Paste® :)

NOTE: Needs patch at 515 to make javascript work properly

I'm going to try and port the rest oof the widgets (AutoCompleteFiled? + ListForm?) along this morning...

Changed 13 years ago by anonymous

comment:6 Changed 13 years ago by alberto@…

I've commited 2 at r654. Haven't moved all the calendar + ajax stuff to separate modules as I'll probably break the, for people still using the old API as paths in the static dir would change. I'll move it as soon as we switch over (then I'll close the ticket)

comment:7 Changed 13 years ago by anonymous

  • Status changed from new to closed
  • Resolution set to fixed

Moved all the calnedar stuff at r720

Note: See TracTickets for help on using tickets.