Skip to content

Commit

Permalink
[lib/ui][s]: use config pass to UI.initialize (if provided).
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrp committed Jul 25, 2011
1 parent 5ddf390 commit 9010420
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ CKAN.UI = function($) {
var self = this;
var defaultConfig = {
endpoint: 'http://ckan.net',
api_key: ''
apiKey: ''
};

this.client = new CKAN.Client(defaultConfig);
var config = options.config || defaultConfig;
this.client = new CKAN.Client(config);

var newPkg = this.client.createDataset();
var newCreateView = new CKAN.View.DatasetCreateView({model: newPkg, el: $('#add-page')});
Expand All @@ -38,13 +39,13 @@ CKAN.UI = function($) {

var searchView = this.searchView = new CKAN.View.DatasetSearchView({
client: this.client,
domain: defaultConfig.endpoint,
domain: config.endpoint,
el: $('#search-page')
});

var configView = new CKAN.View.ConfigView({
el: $('#config-page'),
config: defaultConfig
config: config
});
$(document).bind('config:update', function(e, cfg) {
self.client.configure(cfg);
Expand Down

0 comments on commit 9010420

Please sign in to comment.