Skip to content

allow usage of external jquery-ui #16

@alexbodn

Description

@alexbodn

hello friends,

this patch will allow usage of jquery-ui from google apis,
even versions not installed locally.

diff --git a/tw2/jqplugins/ui/base.py b/tw2/jqplugins/ui/base.py
index 6a26a9d..59d6473 100644
--- a/tw2/jqplugins/ui/base.py
+++ b/tw2/jqplugins/ui/base.py
@@ -16,6 +16,8 @@ class jQueryUIMixin(jQueryPluginLinkMixin):
     basename='jquery-ui'
     modname = 'tw2.jqplugins.ui'
 
+    url_base = defaults._url_base_
+
 class jQueryUIJSLink(twc.JSLink, jQueryUIMixin):
     subdir = 'js'
 
@@ -31,6 +33,12 @@ class jQueryUIThemeCSSLink(jQueryUIMixin, twc.CSSLink):
         self.name = get_ui_theme_name()
         super(jQueryUIThemeCSSLink, self).prepare()
 
+    @property
+    def external_link(self):
+        link = '/'.join((
+            self.url_base, 'themes', self.name, self.core_filename))
+        return link
+
 def set_ui_theme_name(ui_theme_name):
     """ Set the jquery ui theme on a request/thread local basis 
 
diff --git a/tw2/jqplugins/ui/defaults.py b/tw2/jqplugins/ui/defaults.py
index 4a8b723..1a8e373 100644
--- a/tw2/jqplugins/ui/defaults.py
+++ b/tw2/jqplugins/ui/defaults.py
@@ -3,3 +3,5 @@ _ui_theme_name_     = 'smoothness'
 _ui_dirname_        = 'jquery/ui/%(version)s/%(subdir)s'
 _ui_basename_       = 'jquery_ui'
 _ui_version_        = '1.8.17'
+
+_url_base_ = 'http://ajax.googleapis.com/ajax/libs/jqueryui/%(version)s/'

please submit and enjoy
alex

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions