Added UI under lib/static/web. Updated README.md

This commit is contained in:
chouseknecht
2013-05-06 14:26:49 -04:00
parent ef92fe3960
commit c1cc2a1e0b
125 changed files with 75282 additions and 41 deletions

View File

@@ -0,0 +1,40 @@
/*********************************************
* Copyright (c) 2013 AnsibleWorks, Inc.
*
* RefreshRelatedHelper
*
* Used to refresh a related set whenever pagination or filter options change.
*
* RefreshRelated({
* scope: <current scope>,
* set: <model>,
* iterator: <model name in singular form (i.e. organization),
* url: <the api url to call>
* });
*
*/
angular.module('RefreshRelatedHelper', ['RestServices', 'Utilities'])
.factory('RefreshRelated', ['Alert', 'Rest', function(Alert, Rest) {
return function(params) {
var scope = params.scope;
var set = params.set;
var iterator = params.iterator;
var url = params.url;
Rest.setUrl(url);
Rest.get()
.success( function(data, status, headers, config) {
scope[set] = data['results'];
scope[iterator + 'NextUrl'] = data.next;
scope[iterator + 'PrevUrl'] = data.previous;
scope[iterator + 'Count'] = data.count;
scope[iterator + 'SearchSpin'] = false;
})
.error ( function(data, status, headers, config) {
scope[iterator + 'SearchSpin'] = true;
Alert('Error!', 'Failed to retrieve related set: ' + set + '. GET returned status: ' + status);
});
}
}]);