Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#6246 closed enhancement (fixed)

[PATCH] Generalized date fields for use elsewhere

Reported by: terje Owned by: doki_pen
Priority: normal Component: DateFieldPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

  • Configurable request match (for using datepicker elsewhere)
  • Instead of attaching a separate datepicker to explicit fields, attach to class=datepicker + use a stream filter to set the class attribute of input elements
  • (Limited) support for using datepicker for milestone due/completed (default=off)

Not really tested, Works For Me..

Attachments (2)

generalized.diff (3.9 KB) - added by terje 5 years ago.
Generalized a litte, plus new features
generalized2.diff (4.1 KB) - added by terje 5 years ago.
Fixed request match to handle webadmin, and dont assign anything to data.ids

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by terje

Generalized a litte, plus new features

Changed 5 years ago by terje

Fixed request match to handle webadmin, and dont assign anything to data.ids

comment:1 Changed 5 years ago by doki_pen

  • Status changed from new to assigned

comment:2 follow-up: Changed 5 years ago by anonymous

Will

 attr('class', 'datepick') 

cause problems if the sites template uses a class already? Is there a way we can append the class?

comment:3 Changed 5 years ago by doki_pen

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

(In [7192]) generalize datepicker

Now kinda works with milestones. Uses a class name instead for future enhancements. fixes #6246. thanks terje!

comment:4 in reply to: ↑ 2 Changed 5 years ago by terje

Replying to anonymous:

Will

 attr('class', 'datepick') 

cause problems if the sites template uses a class already? Is there a way we can append the class?

Yes I think it will cause trouble. Not sure what is the best solution. Maybe leave the class alone if it is set already by default? (override option)

Ultimately I think we can solve it by attaching to IDs _and_ classes (so we'd be able to have H:M:S for milestone fields etc), akin to:

[datefield]
class=ticket_due,milestone_due,milestone_comp
id=special_field1,special2
ticket_due.format = ymd
milestone_comp.format = ymdhis

And use this config to create a list of .classes and #fields to attach datepicker to. This is actually what I do in production, but it's very messy.

On a sidenote, I notice this doc= change in [7192] "(..) you must use MM/DD/YYYY for the date format. Set format to mdy and separator to / (..)".

This depends on locale - I use DD-MM-YYYY for milestones.

Add Comment

Modify Ticket

Action
as closed The owner will remain doki_pen.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.