[ckan-changes] [okfn/ckan] 693eeb: fix js strings to use dump_json()

GitHub noreply at github.com
Mon Apr 30 12:49:10 UTC 2012


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: 693eebbf3867001c0450c1e7bc54e4c496223be6
      https://github.com/okfn/ckan/commit/693eebbf3867001c0450c1e7bc54e4c496223be6
  Author: Toby <toby.junk at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/lib/helpers.py
    M ckan/templates/js_strings.html

  Log Message:
  -----------
  fix js strings to use dump_json()


diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py
index 78924b4..ea8a4fe 100644
--- a/ckan/lib/helpers.py
+++ b/ckan/lib/helpers.py
@@ -676,8 +676,8 @@ def group_link(group):
     url = url_for(controller='group', action='read', id=group['name'])
     return link_to(group['name'], url)
 
-def dump_json(obj):
-    return json.dumps(obj)
+def dump_json(obj, **kw):
+    return json.dumps(obj, **kw)
 
 def auto_log_message(*args):
     # auto_log_message() used to need c passing as the first arg
diff --git a/ckan/templates/js_strings.html b/ckan/templates/js_strings.html
index a22ea2f..1b757bb 100644
--- a/ckan/templates/js_strings.html
+++ b/ckan/templates/js_strings.html
@@ -14,7 +14,7 @@
    * Used in application.js.
    */
   CKAN.Strings = ${
-    h.json.dumps(dict(
+    h.dump_json(dict(
       checking = _('Checking...'),
       urlIsTooShort = _('Type at least two characters...'),
       urlIsUnchanged = _('This is the current URL.'),


================================================================
  Commit: 010066dd0a7e3ae439c1677b8ad4e9386135517a
      https://github.com/okfn/ckan/commit/010066dd0a7e3ae439c1677b8ad4e9386135517a
  Author: Toby <toby.junk at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/templates/layout_base.html

  Log Message:
  -----------
  fix 404 tracking error


diff --git a/ckan/templates/layout_base.html b/ckan/templates/layout_base.html
index a983d4b..8913814 100644
--- a/ckan/templates/layout_base.html
+++ b/ckan/templates/layout_base.html
@@ -251,9 +251,11 @@ <h3 class="widget-title">Meta</h3>
     CKAN.plugins.push('storage');
     </py:if>
     CKAN.SITE_URL = '${h.url('/')}';
+    CKAN.SITE_URL_NO_LOCALE = '${h.url('/', locale='default')}';
     CKAN.LANG = '${h.lang()}';
     // later use will add offsets with leading '/' so ensure no trailing slash
     CKAN.SITE_URL = CKAN.SITE_URL.replace(/\/$/, '');
+    CKAN.SITE_URL_NO_LOCALE = CKAN.SITE_URL_NO_LOCALE.replace(/\/$/, '');
     $(document).ready(function() {
         var ckan_user = '${c.user}';
         if (ckan_user) {
@@ -272,13 +274,13 @@ <h3 class="widget-title">Meta</h3>
 				 var url = location.pathname;
 				 // remove any site root from url
 				 url = url.substring(CKAN.SITE_URL.length, url.length - 1);
-				 $.ajax({url : CKAN.SITE_URL + '/_tracking',
+				 $.ajax({url : CKAN.SITE_URL_NO_LOCALE + '/_tracking',
 						 type : 'POST',
 						 data : {url:url, type:'page'},
 						 timeout : 300 });
                  $('a.resource-url-analytics').click(function (e){
                          var url = $(e.target).closest('a').attr('href');
-						 $.ajax({url : CKAN.SITE_URL + '/_tracking',
+						 $.ajax({url : CKAN.SITE_URL_NO_LOCALE + '/_tracking',
 							     data : {url:url, type:'resource'},
 								 type : 'POST',
 								 complete : function () {location.href = url;},


================================================================
Compare: https://github.com/okfn/ckan/compare/ded67ed...010066d


More information about the ckan-changes mailing list