Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow usage of external jquery-ui #16

Open
alexbodn opened this issue Nov 5, 2016 · 0 comments
Open

allow usage of external jquery-ui #16

alexbodn opened this issue Nov 5, 2016 · 0 comments

Comments

@alexbodn
Copy link

alexbodn commented Nov 5, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant