[ckan-changes] commit/ckanjs: rgrp: [config][s]: ensure endpoint has no trailing slash and handle situation where localConfig not defined.

Bitbucket commits-noreply at bitbucket.org
Fri May 13 18:04:25 UTC 2011


1 new changeset in ckanjs:

http://bitbucket.org/okfn/ckanjs/changeset/f8607772d3d9/
changeset:   r68:f8607772d3d9
user:        rgrp
date:        2011-05-13 20:04:16
summary:     [config][s]: ensure endpoint has no trailing slash and handle situation where localConfig not defined.
affected #:  2 files (192 bytes)

--- a/app/index.html	Thu May 12 02:19:58 2011 +0100
+++ b/app/index.html	Fri May 13 19:04:16 2011 +0100
@@ -35,7 +35,9 @@
 
   <script type="text/javascript">
     jQuery(document).ready(function($) {
-      // localConfig
+      if(window.localConfig === undefined) {
+        window.localConfig = undefined;
+      }
       CKAN.UI.initialize({
         config: localConfig
         });


--- a/lib/model.js	Thu May 12 02:19:58 2011 +0100
+++ b/lib/model.js	Fri May 13 19:04:16 2011 +0100
@@ -8,6 +8,9 @@
   // Update model configuration with cfg
   // cfg is hash with endpoint and api_key
   my.configure = function(cfg) {
+    if(cfg.endpoint.length > 0 && cfg.endpoint.slice(-1) == '/') {
+      cfg.endpoint = cfg.endpoint.slice(0,-1);
+    }
     my.url = cfg.endpoint;
     my.api = my.url + '/api';
     my.apiSearch = my.api + '/search';

Repository URL: https://bitbucket.org/okfn/ckanjs/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list