Yoji SHIDARA
null+****@clear*****
Tue Sep 25 15:50:50 JST 2012
Yoji SHIDARA 2012-09-25 15:50:50 +0900 (Tue, 25 Sep 2012) New Revision: 4a18c9a3941ff1891933aea74edfff9c1b7af9e0 https://github.com/groonga/gcs/commit/4a18c9a3941ff1891933aea74edfff9c1b7af9e0 Log: Decouple SearchController internals with App Modified files: public/js/gcs.js Modified: public/js/gcs.js (+5 -7) =================================================================== --- public/js/gcs.js 2012-09-25 15:47:36 +0900 (91a59e6) +++ public/js/gcs.js 2012-09-25 15:50:50 +0900 (699a1cc) @@ -24,6 +24,7 @@ App.SearchController = Ember.ArrayController.extend({ perPage: 5, start: 0, data: null, + domainBinding: 'App.currentDomain', numStart: function() { return this.get('start') + 1; }.property('start'), @@ -62,18 +63,16 @@ App.SearchController = Ember.ArrayController.extend({ return content; }.property('data'), searchEndpoint: function() { - var domain = App.currentDomain; - return 'http://' + domain.endpoint + '/2011-02-01/search'; - }.property('App.currentDomain'), + return 'http://' + this.get('domain').endpoint + '/2011-02-01/search'; + }.property('domain'), urlForRawRequest: function() { - var domain = App.currentDomain; var searchEndpoint = this.get('searchEndpoint'); var params = this.get('paramsForRequest'); var urlForRawRequest = searchEndpoint + '?' + jQuery.param(params); return urlForRawRequest; - }.property('paramsForRequest'), + }.property('paramsForRequest', 'searchEndpoint'), paramsForRequest: function() { - var domain = App.currentDomain; + var domain = this.get('domain'); var query = this.get('query'); var start = this.get('start'); var params = { @@ -85,7 +84,6 @@ App.SearchController = Ember.ArrayController.extend({ return params; }.property('query', 'perPage', 'start', 'searchEndpoint'), executeSearch: function(query) { - var domain = App.currentDomain; var searchEndpoint = this.get('searchEndpoint'); var params = this.get('paramsForRequest'); var self = this; -------------- next part -------------- HTML����������������������������...Download