Commit 949f493494390dbc40cb0af46d74369d3c0db02a
Exists in
master
and in
30 other branches
merge
Showing
14 changed files
with
407 additions
and
3 deletions
Show diff stats
| @@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
| 1 | +import {Component, Inject, provide} from 'ng-forward'; | ||
| 2 | +import {EnvironmentService} from "../../lib/ng-noosfero-api/http/environment.service"; | ||
| 3 | +import {NotificationService} from "../shared/services/notification.service"; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @ngdoc controller | ||
| 7 | + * @name environment.Environment | ||
| 8 | + * @description | ||
| 9 | + * This is the environment controller. | ||
| 10 | + */ | ||
| 11 | +@Component({ | ||
| 12 | + selector: 'environment-home', | ||
| 13 | + templateUrl: "app/environment/environment-home.html", | ||
| 14 | + providers: [ | ||
| 15 | + provide('environmentService', { useClass: EnvironmentService }), | ||
| 16 | + provide('notificationService', { useClass: NotificationService }) | ||
| 17 | + ] | ||
| 18 | +}) | ||
| 19 | +@Inject(EnvironmentService, "$log", "$sce") | ||
| 20 | +export class EnvironmentHomeComponent { | ||
| 21 | + | ||
| 22 | + environment: noosfero.Environment; | ||
| 23 | + | ||
| 24 | + constructor(private environmentService: EnvironmentService, private $sce: ng.ISCEService) { | ||
| 25 | + environmentService.getByIdentifier("default").then((result: noosfero.Environment) => { | ||
| 26 | + this.environment = result; | ||
| 27 | + }); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + getEnvironmentDescription() { | ||
| 31 | + if(this.environment && this.environment.settings && this.environment.settings.description){ | ||
| 32 | + return this.$sce.trustAsHtml(this.environment.settings.description); | ||
| 33 | + } | ||
| 34 | + else { | ||
| 35 | + return ""; | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | +} | ||
| 0 | \ No newline at end of file | 39 | \ No newline at end of file |
| @@ -0,0 +1,60 @@ | @@ -0,0 +1,60 @@ | ||
| 1 | +import {quickCreateComponent} from "../../spec/helpers"; | ||
| 2 | +import {EnvironmentComponent} from "./environment.component"; | ||
| 3 | + | ||
| 4 | +describe("Components", () => { | ||
| 5 | + describe("Environment Component", () => { | ||
| 6 | + | ||
| 7 | + let $rootScope: ng.IRootScopeService; | ||
| 8 | + let $q: ng.IQService; | ||
| 9 | + let environmentServiceMock: any; | ||
| 10 | + let notificationMock: any; | ||
| 11 | + let $state: any; | ||
| 12 | + | ||
| 13 | + beforeEach(inject((_$rootScope_: ng.IRootScopeService, _$q_: ng.IQService) => { | ||
| 14 | + $rootScope = _$rootScope_; | ||
| 15 | + $q = _$q_; | ||
| 16 | + })); | ||
| 17 | + | ||
| 18 | + beforeEach(() => { | ||
| 19 | + $state = jasmine.createSpyObj("$state", ["transitionTo"]); | ||
| 20 | + environmentServiceMock = jasmine.createSpyObj("environmentServiceMock", ["getByIdentifier", "getBoxes"]); | ||
| 21 | + notificationMock = jasmine.createSpyObj("notificationMock", ["error"]); | ||
| 22 | + | ||
| 23 | + let environmentResponse = $q.defer(); | ||
| 24 | + environmentResponse.resolve({ id: 1 }); | ||
| 25 | + let getBoxesResponse = $q.defer(); | ||
| 26 | + getBoxesResponse.resolve({ data: { boxes: [{ id: 2 }] } }); | ||
| 27 | + | ||
| 28 | + environmentServiceMock.getByIdentifier('default').and.returnValue(environmentResponse.promise); | ||
| 29 | + environmentServiceMock.getBoxes = jasmine.createSpy("getBoxes").and.returnValue(getBoxesResponse.promise); | ||
| 30 | + }); | ||
| 31 | + | ||
| 32 | + it("get the default environment", done => { | ||
| 33 | + let component: EnvironmentComponent = new EnvironmentComponent(environmentServiceMock, $state, notificationMock); | ||
| 34 | + $rootScope.$apply(); | ||
| 35 | + expect(component.environment).toEqual({ id: 1 }); | ||
| 36 | + done(); | ||
| 37 | + }); | ||
| 38 | + | ||
| 39 | + it("get the environment boxes", done => { | ||
| 40 | + let component: EnvironmentComponent = new EnvironmentComponent(environmentServiceMock, $state, notificationMock); | ||
| 41 | + $rootScope.$apply(); | ||
| 42 | + expect(environmentServiceMock.getBoxes).toHaveBeenCalled(); | ||
| 43 | + expect(component.boxes).toEqual([{ id: 3 }]); | ||
| 44 | + done(); | ||
| 45 | + }); | ||
| 46 | + | ||
| 47 | + it("display notification error when the environment wasn't found", done => { | ||
| 48 | + let environmentResponse = $q.defer(); | ||
| 49 | + environmentResponse.reject(); | ||
| 50 | + | ||
| 51 | + let component: EnvironmentComponent = new EnvironmentComponent(environmentServiceMock, $state, notificationMock); | ||
| 52 | + $rootScope.$apply(); | ||
| 53 | + | ||
| 54 | + expect(notificationMock.error).toHaveBeenCalled(); | ||
| 55 | + expect(component.environment).toBeUndefined(); | ||
| 56 | + done(); | ||
| 57 | + }); | ||
| 58 | + | ||
| 59 | + }); | ||
| 60 | +}); |
| @@ -0,0 +1,51 @@ | @@ -0,0 +1,51 @@ | ||
| 1 | +import {StateConfig, Component, Inject, provide} from 'ng-forward'; | ||
| 2 | +import {EnvironmentService} from "../../lib/ng-noosfero-api/http/environment.service"; | ||
| 3 | +import {NotificationService} from "../shared/services/notification.service"; | ||
| 4 | +import {EnvironmentHomeComponent} from "./environment-home.component"; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @ngdoc controller | ||
| 8 | + * @name environment.Environment | ||
| 9 | + * @description | ||
| 10 | + * This is the environment controller. | ||
| 11 | + */ | ||
| 12 | +@Component({ | ||
| 13 | + selector: 'environment', | ||
| 14 | + templateUrl: "app/environment/environment.html", | ||
| 15 | + providers: [ | ||
| 16 | + provide('environmentService', { useClass: EnvironmentService }), | ||
| 17 | + provide('notificationService', { useClass: NotificationService }) | ||
| 18 | + ] | ||
| 19 | +}) | ||
| 20 | +@StateConfig([ | ||
| 21 | + { | ||
| 22 | + name: 'main.environment.home', | ||
| 23 | + url: "", | ||
| 24 | + component: EnvironmentHomeComponent, | ||
| 25 | + views: { | ||
| 26 | + "mainBlockContent": { | ||
| 27 | + templateUrl: "app/environment/environment-home.html", | ||
| 28 | + controller: EnvironmentHomeComponent, | ||
| 29 | + controllerAs: "vm" | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | +]) | ||
| 34 | +@Inject(EnvironmentService, "$state") | ||
| 35 | +export class EnvironmentComponent { | ||
| 36 | + | ||
| 37 | + boxes: noosfero.Box[]; | ||
| 38 | + environment: noosfero.Environment; | ||
| 39 | + | ||
| 40 | + constructor(environmentService: EnvironmentService, $state: ng.ui.IStateService, notificationService: NotificationService) { | ||
| 41 | + let boxesPromisse = environmentService.getByIdentifier("default").then((environment: noosfero.Environment) => { | ||
| 42 | + this.environment = environment; | ||
| 43 | + return environmentService.getBoxes(this.environment.id); | ||
| 44 | + }).then((boxes: noosfero.Box[]) => { | ||
| 45 | + this.boxes = boxes; | ||
| 46 | + }).catch(() => { | ||
| 47 | + $state.transitionTo('main'); | ||
| 48 | + notificationService.error({ message: "notification.environment.not_found" }); | ||
| 49 | + }); | ||
| 50 | + } | ||
| 51 | +} |
src/app/layout/blocks/communities-block/communities-block.component.ts
0 → 100644
| @@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
| 1 | +import {Input, Inject, Component} from "ng-forward"; | ||
| 2 | +import {CommunityService} from "../../../../lib/ng-noosfero-api/http/community.service"; | ||
| 3 | + | ||
| 4 | +@Component({ | ||
| 5 | + selector: "noosfero-communities-block", | ||
| 6 | + templateUrl: 'app/layout/blocks/communities-block/communities-block.html', | ||
| 7 | +}) | ||
| 8 | +@Inject(CommunityService) | ||
| 9 | +export class CommunitiesBlockComponent { | ||
| 10 | + | ||
| 11 | + @Input() block: noosfero.Block; | ||
| 12 | + @Input() owner: noosfero.Profile; | ||
| 13 | + | ||
| 14 | + profiles: any = []; | ||
| 15 | + | ||
| 16 | + constructor(private communityService: CommunityService) { } | ||
| 17 | + | ||
| 18 | + ngOnInit() { | ||
| 19 | + let limit = ((this.block && this.block['settings']) ? this.block['settings'].limit : null) || 5; | ||
| 20 | + | ||
| 21 | + this.communityService.list(null, { limit: limit }).then((result: noosfero.RestResult<noosfero.Community[]>) => { | ||
| 22 | + this.profiles = result.data; | ||
| 23 | + }); | ||
| 24 | + } | ||
| 25 | +} |
src/app/layout/blocks/communities-block/communities-block.html
0 → 100644
src/app/layout/blocks/communities-block/communities-block.scss
0 → 100644
| @@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
| 1 | +.communities-block { | ||
| 2 | + .profile { | ||
| 3 | + margin: 10px; | ||
| 4 | + img, i.profile-image { | ||
| 5 | + width: 60px; | ||
| 6 | + } | ||
| 7 | + img { | ||
| 8 | + display: inline-block; | ||
| 9 | + vertical-align: top; | ||
| 10 | + } | ||
| 11 | + i.profile-image { | ||
| 12 | + text-align: center; | ||
| 13 | + font-size: 4.5em; | ||
| 14 | + } | ||
| 15 | + } | ||
| 16 | +} |
src/app/main/main.component.ts
| @@ -6,12 +6,16 @@ import {ArticleViewComponent} from "./../article/article-default-view.component" | @@ -6,12 +6,16 @@ import {ArticleViewComponent} from "./../article/article-default-view.component" | ||
| 6 | import {ProfileComponent} from "../profile/profile.component"; | 6 | import {ProfileComponent} from "../profile/profile.component"; |
| 7 | import {BoxesComponent} from "../layout/boxes/boxes.component"; | 7 | import {BoxesComponent} from "../layout/boxes/boxes.component"; |
| 8 | import {BlockComponent} from "../layout/blocks/block.component"; | 8 | import {BlockComponent} from "../layout/blocks/block.component"; |
| 9 | +import {EnvironmentComponent} from "../environment/environment.component"; | ||
| 10 | +import {EnvironmentHomeComponent} from "../environment/environment-home.component"; | ||
| 11 | + | ||
| 9 | import {LinkListBlockComponent} from "./../layout/blocks/link-list/link-list.component"; | 12 | import {LinkListBlockComponent} from "./../layout/blocks/link-list/link-list.component"; |
| 10 | import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents.component"; | 13 | import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents.component"; |
| 11 | import {ProfileImageBlockComponent} from "../layout/blocks/profile-image-block/profile-image-block.component"; | 14 | import {ProfileImageBlockComponent} from "../layout/blocks/profile-image-block/profile-image-block.component"; |
| 12 | import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html.component"; | 15 | import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html.component"; |
| 13 | 16 | ||
| 14 | import {MembersBlockComponent} from "./../layout/blocks/members-block/members-block.component"; | 17 | import {MembersBlockComponent} from "./../layout/blocks/members-block/members-block.component"; |
| 18 | +import {CommunitiesBlockComponent} from "./../layout/blocks/communities-block/communities-block.component"; | ||
| 15 | import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; | 19 | import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; |
| 16 | import {DateFormat} from "../shared/pipes/date-format.filter"; | 20 | import {DateFormat} from "../shared/pipes/date-format.filter"; |
| 17 | 21 | ||
| @@ -35,7 +39,7 @@ import {MainBlockComponent} from "../layout/blocks/main-block/main-block.compone | @@ -35,7 +39,7 @@ import {MainBlockComponent} from "../layout/blocks/main-block/main-block.compone | ||
| 35 | * This controller actually contains the main content of Noosfero Angular Theme: | 39 | * This controller actually contains the main content of Noosfero Angular Theme: |
| 36 | * - the navbar | 40 | * - the navbar |
| 37 | * - the {@link Main} view content | 41 | * - the {@link Main} view content |
| 38 | - * | 42 | + * |
| 39 | */ | 43 | */ |
| 40 | @Component({ | 44 | @Component({ |
| 41 | selector: 'main-content', | 45 | selector: 'main-content', |
| @@ -49,6 +53,15 @@ export class MainContentComponent { | @@ -49,6 +53,15 @@ export class MainContentComponent { | ||
| 49 | } | 53 | } |
| 50 | } | 54 | } |
| 51 | 55 | ||
| 56 | +@Component({ | ||
| 57 | + selector: 'environment-content', | ||
| 58 | + templateUrl: "app/main/main.html", | ||
| 59 | + providers: [AuthService, SessionService] | ||
| 60 | +}) | ||
| 61 | +export class EnvironmentContent { | ||
| 62 | + | ||
| 63 | +} | ||
| 64 | + | ||
| 52 | /** | 65 | /** |
| 53 | * @ngdoc controller | 66 | * @ngdoc controller |
| 54 | * @name main.Main | 67 | * @name main.Main |
| @@ -67,7 +80,9 @@ export class MainContentComponent { | @@ -67,7 +80,9 @@ export class MainContentComponent { | ||
| 67 | selector: 'main', | 80 | selector: 'main', |
| 68 | template: '<div ng-view></div>', | 81 | template: '<div ng-view></div>', |
| 69 | directives: [ | 82 | directives: [ |
| 70 | - ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent, LinkListBlockComponent, | 83 | + ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent, |
| 84 | + EnvironmentComponent, | ||
| 85 | + LinkListBlockComponent, CommunitiesBlockComponent, | ||
| 71 | MainBlockComponent, RecentDocumentsBlockComponent, Navbar, ProfileImageBlockComponent, | 86 | MainBlockComponent, RecentDocumentsBlockComponent, Navbar, ProfileImageBlockComponent, |
| 72 | MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent | 87 | MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent |
| 73 | ], | 88 | ], |
| @@ -75,11 +90,25 @@ export class MainContentComponent { | @@ -75,11 +90,25 @@ export class MainContentComponent { | ||
| 75 | }) | 90 | }) |
| 76 | @StateConfig([ | 91 | @StateConfig([ |
| 77 | { | 92 | { |
| 78 | - url: '/', | 93 | + url: '', |
| 79 | component: MainContentComponent, | 94 | component: MainContentComponent, |
| 95 | + abstract: true, | ||
| 80 | name: 'main', | 96 | name: 'main', |
| 81 | }, | 97 | }, |
| 82 | { | 98 | { |
| 99 | + url: '/', | ||
| 100 | + component: EnvironmentComponent, | ||
| 101 | + name: 'main.environment', | ||
| 102 | + abstract: true, | ||
| 103 | + views: { | ||
| 104 | + "content": { | ||
| 105 | + templateUrl: "app/environment/environment.html", | ||
| 106 | + controller: EnvironmentComponent, | ||
| 107 | + controllerAs: "vm" | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + }, | ||
| 111 | + { | ||
| 83 | url: "^/:profile", | 112 | url: "^/:profile", |
| 84 | abstract: true, | 113 | abstract: true, |
| 85 | component: ProfileComponent, | 114 | component: ProfileComponent, |
| @@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
| 1 | +import {CommunityService} from "./community.service"; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +describe("Services", () => { | ||
| 5 | + | ||
| 6 | + describe("Community Service", () => { | ||
| 7 | + | ||
| 8 | + let $httpBackend: ng.IHttpBackendService; | ||
| 9 | + let communityService: CommunityService; | ||
| 10 | + | ||
| 11 | + beforeEach(angular.mock.module("noosferoApp", ($translateProvider: angular.translate.ITranslateProvider) => { | ||
| 12 | + $translateProvider.translations('en', {}); | ||
| 13 | + })); | ||
| 14 | + | ||
| 15 | + beforeEach(inject((_$httpBackend_: ng.IHttpBackendService, _CommunityService_: CommunityService) => { | ||
| 16 | + $httpBackend = _$httpBackend_; | ||
| 17 | + communityService = _CommunityService_; | ||
| 18 | + })); | ||
| 19 | + | ||
| 20 | + describe("Succesfull requests", () => { | ||
| 21 | + | ||
| 22 | + it("should list communities", (done) => { | ||
| 23 | + $httpBackend.expectGET(`/api/v1/communities`).respond(200, { communities: [{ name: "community1" }] }); | ||
| 24 | + communityService.list().then((result: noosfero.RestResult<noosfero.Community[]>) => { | ||
| 25 | + expect(result.data).toEqual([{ name: "community1" }]); | ||
| 26 | + done(); | ||
| 27 | + }); | ||
| 28 | + $httpBackend.flush(); | ||
| 29 | + }); | ||
| 30 | + }); | ||
| 31 | + | ||
| 32 | + }); | ||
| 33 | +}); |
| @@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
| 1 | +import { Injectable, Inject } from "ng-forward"; | ||
| 2 | +import {RestangularService} from "./restangular_service"; | ||
| 3 | + | ||
| 4 | +@Injectable() | ||
| 5 | +@Inject("Restangular", "$q", "$log") | ||
| 6 | +export class CommunityService extends RestangularService<noosfero.Community> { | ||
| 7 | + | ||
| 8 | + constructor(Restangular: restangular.IService, $q: ng.IQService, $log: ng.ILogService) { | ||
| 9 | + super(Restangular, $q, $log); | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + getResourcePath() { | ||
| 13 | + return "communities"; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + getDataKeys() { | ||
| 17 | + return { | ||
| 18 | + singular: 'community', | ||
| 19 | + plural: 'communities' | ||
| 20 | + }; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | +} |
| @@ -0,0 +1,92 @@ | @@ -0,0 +1,92 @@ | ||
| 1 | +import { Injectable, Inject } from "ng-forward"; | ||
| 2 | + | ||
| 3 | +@Injectable() | ||
| 4 | +@Inject("Restangular", "$q") | ||
| 5 | +export class EnvironmentService { | ||
| 6 | + | ||
| 7 | + private _currentEnvironmentPromise: ng.IDeferred<noosfero.Environment>; | ||
| 8 | + | ||
| 9 | + constructor(private restangular: restangular.IService, private $q: ng.IQService) { | ||
| 10 | + | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + getEnvironmentPeople(params: any) : ng.IPromise<noosfero.Person[]> { | ||
| 14 | + let p = this.restangular.one('people').get(params); | ||
| 15 | + let deferred = this.$q.defer<noosfero.Person[]>(); | ||
| 16 | + p.then(this.getHandleSuccessFunctionKeyArray<noosfero.Person[]>("people", deferred)); | ||
| 17 | + p.catch(this.getHandleErrorFunction<noosfero.Person[]>(deferred)); | ||
| 18 | + return deferred.promise; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + getByIdentifier(identifier: string): ng.IPromise<noosfero.Environment> { | ||
| 22 | + let p = this.restangular.one('environment').customGET(identifier); | ||
| 23 | + let deferred = this.$q.defer<noosfero.Environment>(); | ||
| 24 | + p.then(this.getHandleSuccessFunction<noosfero.Environment>(deferred)); | ||
| 25 | + p.catch(this.getHandleErrorFunction<noosfero.Environment>(deferred)); | ||
| 26 | + return deferred.promise; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + getBoxes(id: number) { | ||
| 30 | + let p = this.restangular.one('environments', id).customGET("boxes"); | ||
| 31 | + let deferred = this.$q.defer<noosfero.Box[]>(); | ||
| 32 | + p.then(this.getHandleSuccessFunctionKeyArray<noosfero.Box[]>("boxes", deferred)); | ||
| 33 | + p.catch(this.getHandleErrorFunction<noosfero.Box[]>(deferred)); | ||
| 34 | + return deferred.promise; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** TODO - Please, use the base class RestangularService | ||
| 38 | + * (description) | ||
| 39 | + * | ||
| 40 | + * @template T | ||
| 41 | + * @param {ng.IDeferred<T>} deferred (description) | ||
| 42 | + * @returns {(response: restangular.IResponse) => void} (description) | ||
| 43 | + */ | ||
| 44 | + getHandleErrorFunction<T>(deferred: ng.IDeferred<T>): (response: restangular.IResponse) => void { | ||
| 45 | + let self = this; | ||
| 46 | + /** | ||
| 47 | + * (description) | ||
| 48 | + * | ||
| 49 | + * @param {restangular.IResponse} response (description) | ||
| 50 | + */ | ||
| 51 | + let errorFunction = (response: restangular.IResponse): void => { | ||
| 52 | + deferred.reject(response); | ||
| 53 | + }; | ||
| 54 | + return errorFunction; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * TODO - use restangular service as base class, and this will not be necessary here anymore | ||
| 59 | + */ | ||
| 60 | + protected getHandleSuccessFunction<C>(deferred: ng.IDeferred<C>, responseKey?: string): (response: restangular.IResponse) => void { | ||
| 61 | + let self = this; | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * (description) | ||
| 65 | + * | ||
| 66 | + * @param {restangular.IResponse} response (description) | ||
| 67 | + */ | ||
| 68 | + let successFunction = (response: restangular.IResponse): void => { | ||
| 69 | + let data = this.restangular.stripRestangular(response.data) | ||
| 70 | + deferred.resolve(data); | ||
| 71 | + }; | ||
| 72 | + return successFunction; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * TODO - use restangular service as base class, and this will not be necessary here anymore | ||
| 77 | + */ | ||
| 78 | + protected getHandleSuccessFunctionKeyArray<C>(key: string, deferred: ng.IDeferred<C>, responseKey?: string): (response: restangular.IResponse) => void { | ||
| 79 | + let self = this; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * (description) | ||
| 83 | + * | ||
| 84 | + * @param {restangular.IResponse} response (description) | ||
| 85 | + */ | ||
| 86 | + let successFunction = (response: restangular.IResponse): void => { | ||
| 87 | + let data = this.restangular.stripRestangular(response.data[key]); | ||
| 88 | + deferred.resolve(data); | ||
| 89 | + }; | ||
| 90 | + return successFunction; | ||
| 91 | + } | ||
| 92 | +} |
src/lib/ng-noosfero-api/interfaces/environment.ts
| 1 | 1 | ||
| 2 | namespace noosfero { | 2 | namespace noosfero { |
| 3 | + /** | ||
| 4 | + * @ngdoc interface | ||
| 5 | + * @name noofero.Environment | ||
| 6 | + * @description | ||
| 7 | + * A representation of a Noosfero Environment. | ||
| 8 | + */ | ||
| 3 | export interface Environment extends RestModel { | 9 | export interface Environment extends RestModel { |
| 10 | + /** | ||
| 11 | + * @ngdoc property | ||
| 12 | + * @name id | ||
| 13 | + * @propertyOf noofero.Environment | ||
| 14 | + * @returns {number} The Environment id | ||
| 15 | + */ | ||
| 16 | + id: number; | ||
| 17 | + settings: any | ||
| 4 | } | 18 | } |
| 5 | } | 19 | } |
| 6 | \ No newline at end of file | 20 | \ No newline at end of file |