This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- correct --> | |
{{#if isEditing}} | |
{{partial 'product/edit'}} | |
<button {{action 'doneEditing'}} class="btn btn-default" >Save</button> | |
{{else}} | |
{{partial 'product/view'}} | |
<button {{action 'edit'}} class="btn btn-default" >Edit</button> | |
{{/if}} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = App.Router.map(function() { | |
this.resource("companies", function() { | |
this.resource("company", {path: 'view/:company_id'}, function () { | |
this.route('edit'); | |
}); | |
this.route("new"); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DS.ElasticAdapter = DS.RESTAdapter.extend({ | |
ajax: function(url, type, hash) { | |
var adapter = this; | |
if (type == 'GET') { | |
url = url + "/_search" | |
} else { | |
hash.data = hash.data['company']; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.ArrayTransform = DS.Transform.extend({ | |
deserialize: function(serialized) { | |
return serialized; | |
}, | |
serialize: function(deserialized) { | |
return deserialized; | |
} | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = App.CompaniesRoute = Ember.Route.extend({ | |
/* model: function() { | |
var result = this.store.find('company'); | |
return result; | |
} */ | |
setupController: function(controller, model) { | |
controller.set('company', model); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = App.CompaniesRoute = Ember.Route.extend({ | |
model: function() { | |
var result = {companies: this.store.find('company'), productgroups: this.store.find('product.group')}; | |
return result; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* results are returned as a promise */ | |
promiseThen = function (httpPromise, successcb, errorcb) { | |
return httpPromise.then(function (response) { | |
(successcb || angular.noop)(response.data); | |
return response.data; | |
}, function (response) { | |
(errorcb || angular.noop)(response.data); | |
return response.data; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller('CompaniesCtrl', [ | |
'$scope' | |
'$timeout' | |
'ejsResource' | |
($scope, $timeout, ejsResource) -> | |
ejs = ejsResource("http://localhost:9200") | |
client = ejs.Request().indices("emarket").types("companies") | |
$scope.search = -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.init = function() { | |
$scope.ejs = ejsResource('http://localhost:9200'); | |
$scope.client = $scope.ejs.Request().indices('emarket').types('companies'); | |
$scope.client.doSearch().then( function(d) { | |
$scope.companies = d.hits.hits; | |
console.log(d); | |
}); | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.state('companies', { | |
url: '/companies', | |
templateUrl: 'views/companies.html', | |
controller: 'CompaniesCtrl', | |
resolve: { | |
companies : function(ejsserver, ejsResource) { | |
var ejs = ejsResource(ejsserver); | |
var client = ejs.Request().indices('emarket').types('companies'); | |
return client.doSearch(); | |
} |
OlderNewer