Modify

Opened 7 months ago

Closed 6 months ago

#10655 closed enhancement (fixed)

[Patch] Use jQuery UI provided by Trac in 1.0 and later

Reported by: rjollos Owned by: nonplus
Priority: normal Component: AdminEnumListPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

Trac 1.0 provides jQuery UI. The attached patch uses jQuery UI from Trac when the Trac version is >= 1.0.

Attachments (2)

t10655-r7112-1.patch (1.3 KB) - added by rjollos 7 months ago.
t10655-r7112-2.diff (1.4 KB) - added by jun66j5 7 months ago.
Use hasattr(Chrome, 'add_jquery_ui')

Download all attachments as: .zip

Change History (7)

Changed 7 months ago by rjollos

comment:1 Changed 7 months ago by rjollos

I have repository-wide commit access, so I'd be happy to push this change if you approve.

Changed 7 months ago by jun66j5

Use hasattr(Chrome, 'add_jquery_ui')

comment:2 Changed 7 months ago by jun66j5

IMO, it would be better to check Chrome.add_jquery_ui attribute instead of Trac version, t10655-r7112-2.diff.

comment:3 Changed 7 months ago by rjollos

Yeah, I agree that Jun's patch is the better approach. I'm glad you brought this up, because after I made the first patch, I started thinking one day of a similar approach:

try:
    Chrome(self.env).add_jquery_ui(req)
except AttributeError:
    add_script(req, 'adminenumlistplugin/jquery-ui-custom.js')

I'm not sure of any advantages of try/except vs hasattr; I've seen both patterns used in code quite a bit and I'm fairly new to Python. From reading the docs though, it looks like hasattr effectively does the same behind the scenes by calling getattr in a try/except, so the approach taken in the patch is probably cleaner and more readable.

comment:4 Changed 7 months ago by rjollos

Btw, I'll just go ahead and push this change in 2 weeks (per guidelines in AdoptingHacks), if we don't hear from nonplus by then.

comment:5 Changed 6 months ago by rjollos

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

(In [12413]) Fixes #10655: (1.1dev) Use jQuery UI bundled with Trac core when available (1.0 and later). Thanks to Jun Omae for improving the patch. Removed some uncessary imports.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
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.