Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10244 closed enhancement (fixed)

[Patch] Option for using JQuery from a CDN

Reported by: psuter <petsuter@…> Owned by: Peter Suter
Priority: normal Milestone: 1.0
Component: general Version:
Severity: normal Keywords: jquery
Cc: Branch:
Release Notes:

jQuery may now be served from a Content Delivery Network using jquery_location in TracIni

API Changes:

Description

Add the option [trac] jquery_location:

  • trac/web/chrome.py

    diff -r 00b3b14d466d trac/web/chrome.py
    a b  
    362362        will not be made available this way and additional rewrite
    363363        rules will be needed in the web server.""")
    364364
     365    jquery_location = Option('trac', 'jquery_location', '',
     366        """CDN URL for JQuery.
     367       
     368        It can be left empty, and the JQuery bundled with Trac will be used.
     369       
     370        Alternatively you can deliver JQuery from a CDN by setting it to a URL
     371        like http://code.jquery.com/jquery-1.5.1.min.js,
     372        http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.min.js or
     373        https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js.""")
     374
    365375    metanav_order = ListOption('trac', 'metanav',
    366376                               'login, logout, prefs, help, about', doc=
    367377        """Order of the items to display in the `metanav` navigation bar,
     
    605615        add_link(req, 'search', req.href.search())
    606616        add_link(req, 'help', req.href.wiki('TracGuide'))
    607617        add_stylesheet(req, 'common/css/trac.css')
    608         add_script(req, 'common/js/jquery.js')
     618        add_script(req, self.jquery_location or 'common/js/jquery.js')
    609619        # Only activate noConflict mode if requested to by the handler
    610620        if handler is not None and \
    611621           getattr(handler.__class__, 'jquery_noconflict', False):

as discussed by comment:16:ticket:9643 and comment:17:ticket:9643.

Attachments (1)

jquery-location-option.patch (1.7 KB ) - added by psuter <petsuter@…> 8 years ago.

Download all attachments as: .zip

Change History (8)

by psuter <petsuter@…>, 8 years ago

comment:1 by Remy Blank, 8 years ago

Milestone: 0.13
Owner: set to Remy Blank

Looks good. We should make sure the docstring always references the same version of jQuery as bundled with Trac.

comment:2 by Remy Blank, 8 years ago

Resolution: fixed
Status: newclosed

Patch applied in [10733] and [10734]. Thanks!

comment:3 by Remy Blank, 8 years ago

Owner: changed from Remy Blank to psuter <petsuter@…>

comment:4 by psuter <petsuter@…>, 8 years ago

I fell in the exact same trap with the formatting. Nice to know I'm in good company. :)

comment:5 by Peter Suter, 8 years ago

Owner: changed from psuter <petsuter@…> to Peter Suter

comment:6 by Alex Willmer <al.willmer@…>, 8 years ago

Release Notes: modified (diff)

comment:7 by Christian Boos, 8 years ago

Keywords: jquery added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Peter Suter to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.