Sha256: 451518ab85f330500d6253133a73419b379cffbb3b393e5bab29cf37ae5964a6

Contents?: true

Size: 1.35 KB

Versions: 23

Compression:

Stored size: 1.35 KB

Contents

angular.module('AgileProxy').factory('StubService', function ($modal, $q, $rootScope, RequestSpecModel) {
    return {
        addStub: function (scope) {
            var stub;
            stub = scope.requestSpecs.$build({httpMethod: 'GET', urlType: "url", response: {contentType: 'text/html', statusCode: 200}});
            return this.openEditor(stub, scope);
        },
        editStub: function (stub, scope) {
            return this.openEditor(stub, scope);
        },
        openEditor: function (stub, scope) {
            var modalInstance, localScope, deferred;
            function closeEditor() {
                modalInstance.close();
            }
            localScope = scope ? scope.$new() : $rootScope.$new();
            deferred = $q.defer();
            angular.extend(localScope, {
                stub: stub,
                onOk: function (stub) {
                    deferred.resolve({stub: stub, close: closeEditor});
                },
                onCancel: function (stub) {
                    closeEditor();
                    deferred.reject('User Cancelled', stub);
                }
            });
            modalInstance = $modal.open({
                templateUrl: '/ui/app/view/stubs/edit.html',
                size: 'lg',
                scope: localScope
            });
            return deferred.promise;
        }
    };
});

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
agile-proxy-0.1.26 assets/ui/app/service/Stub.js
agile-proxy-jruby-0.1.26-jruby assets/ui/app/service/Stub.js
agile-proxy-jruby-0.1.25-jruby assets/ui/app/service/Stub.js
agile-proxy-0.1.25 assets/ui/app/service/Stub.js
agile-proxy-0.1.24 assets/ui/app/service/Stub.js
agile-proxy-0.1.23 assets/ui/app/service/Stub.js
agile-proxy-0.1.22 assets/ui/app/service/Stub.js
agile-proxy-0.1.21 assets/ui/app/service/Stub.js
agile-proxy-0.1.20 assets/ui/app/service/Stub.js
agile-proxy-0.1.19 assets/ui/app/service/Stub.js
agile-proxy-0.1.18 assets/ui/app/service/Stub.js
agile-proxy-0.1.13 assets/ui/app/service/Stub.js
agile-proxy-0.1.12 assets/ui/app/service/Stub.js
agile-proxy-0.1.11 assets/ui/app/service/Stub.js
agile-proxy-0.1.10 assets/ui/app/service/Stub.js
agile-proxy-0.1.9 assets/ui/app/service/Stub.js
agile-proxy-0.1.8 assets/ui/app/service/Stub.js
agile-proxy-0.1.7 assets/ui/app/service/Stub.js
agile-proxy-0.1.6 assets/ui/app/service/Stub.js
agile-proxy-0.1.5 assets/ui/app/service/Stub.js