From 19a7162cf22512d66a2ce1279bcabc64ef5787cf Mon Sep 17 00:00:00 2001 From: Carlos Purificacao Date: Wed, 16 Mar 2016 10:57:18 -0300 Subject: [PATCH] Fixed docs package configuration. Added documented files --- package.json | 2 ++ src/app/components/noosfero-activities/activities.component.ts | 13 +++++++++++++ src/app/components/noosfero-articles/article/article_view.ts | 14 ++++++++++++++ src/app/components/noosfero-articles/blog/blog.component.ts | 6 ++++++ src/app/components/noosfero/profile-image/index.ts | 4 ++++ src/app/components/noosfero/profile-image/profile-image.component.spec.ts | 6 ++++++ src/app/components/noosfero/profile-image/profile-image.component.ts | 30 ++++++++++++++++++++++++++++++ src/app/index.module.ts | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- src/app/main/main.component.ts | 24 ++++++++++++++++++++++++ src/app/models/interfaces.ts | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/app/profile/profile.component.ts | 6 ++++++ 11 files changed, 225 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index fbd4cf6..1ad04a8 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "build": "webpack; gulp build", "webpack": "webpack", + "docs": "gulp ngdocs; static-server docs", "karma": "karma", "coverage": "karma start --single-run; npm run remap-coverage", "remap-coverage": "ts-node --project ./dev-scripts ./dev-scripts/remapCoverage.ts", @@ -77,6 +78,7 @@ "reflect-metadata": "^0.1.3", "remap-istanbul": "github:sitepen/remap-istanbul", "replace": "^0.3.0", + "static-server": "^2.0.1", "ts-loader": "^0.8.1", "ts-node": "^0.5.5", "tslint": "^3.5.0", diff --git a/src/app/components/noosfero-activities/activities.component.ts b/src/app/components/noosfero-activities/activities.component.ts index 7fe9715..580710e 100644 --- a/src/app/components/noosfero-activities/activities.component.ts +++ b/src/app/components/noosfero-activities/activities.component.ts @@ -2,6 +2,13 @@ import {Component, Input} from "ng-forward"; import {NoosferoActivity} from "./activity/activity.component"; import {Activity} from "../../models/interfaces"; +/** + * @ngdoc controller + * @name NoosferoActivities + * @description + * The controller responsible to retreive profile activities. + */ + @Component({ selector: "noosfero-activities", templateUrl: 'app/components/noosfero-activities/activities.html', @@ -9,6 +16,12 @@ import {Activity} from "../../models/interfaces"; }) export class NoosferoActivities { + /** + * @ngdoc property + * @propertyOf NoosferoActivities + * @name activities + * @returns {Activity[]} An array of {@link Activity}. + */ @Input() activities: Activity[]; } diff --git a/src/app/components/noosfero-articles/article/article_view.ts b/src/app/components/noosfero-articles/article/article_view.ts index b19c863..ca479ed 100644 --- a/src/app/components/noosfero-articles/article/article_view.ts +++ b/src/app/components/noosfero-articles/article/article_view.ts @@ -1,6 +1,13 @@ import { bundle, Input, Inject, Component, Directive } from 'ng-forward'; import {ArticleBlog} from "../blog/blog.component"; +/** + * @ngdoc controller + * @name ArticleDefaultView + * @description + * A default view for Noosfero Articles. If the specific article view is + * not implemented, then this view is used. + */ @Component({ selector: 'noosfero-default-article', templateUrl: 'app/components/noosfero-articles/article/article.html' @@ -12,6 +19,13 @@ export class ArticleDefaultView { } +/** + * @ngdoc controller + * @name ArticleView + * @description + * A dynamic view for articles. It uses the article type to replace + * the default template with the custom article directive. + */ @Component({ selector: 'noosfero-article', template: 'not-used', diff --git a/src/app/components/noosfero-articles/blog/blog.component.ts b/src/app/components/noosfero-articles/blog/blog.component.ts index bba66ba..aa829dd 100644 --- a/src/app/components/noosfero-articles/blog/blog.component.ts +++ b/src/app/components/noosfero-articles/blog/blog.component.ts @@ -3,6 +3,12 @@ import {Component, Input, Inject} from "ng-forward"; import {Article, Profile} from "./../../../models/interfaces"; import {ArticleService} from "../../../../lib/ng-noosfero-api/http/article.service"; +/** + * @ngdoc controller + * @name ArticleBlog + * @description + * An specific {@link ArticleView} for Blog articles. + */ @Component({ selector: "noosfero-blog", templateUrl: "app/components/noosfero-articles/blog/blog.html" diff --git a/src/app/components/noosfero/profile-image/index.ts b/src/app/components/noosfero/profile-image/index.ts index 4206e70..f7507cc 100644 --- a/src/app/components/noosfero/profile-image/index.ts +++ b/src/app/components/noosfero/profile-image/index.ts @@ -1 +1,5 @@ +/** + * Module for the image component in the Noosfero Angular Theme + * @namespace components.noosfero.profile-image + */ /* Module Index Entry - generated using the script npm run generate-index */ diff --git a/src/app/components/noosfero/profile-image/profile-image.component.spec.ts b/src/app/components/noosfero/profile-image/profile-image.component.spec.ts index 12fe1c9..605f2a6 100644 --- a/src/app/components/noosfero/profile-image/profile-image.component.spec.ts +++ b/src/app/components/noosfero/profile-image/profile-image.component.spec.ts @@ -1,3 +1,9 @@ +/** + * @ngdoc overview + * @name components.noosfero.profile-image.ProfileImageSpec + * @description + * This file contains the tests for the {@link components.noosfero.profile-image.ProfileImage} component. + */ import {TestComponentBuilder, ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder'; import {Pipe, Input, provide, Component} from 'ng-forward'; diff --git a/src/app/components/noosfero/profile-image/profile-image.component.ts b/src/app/components/noosfero/profile-image/profile-image.component.ts index c59e8c2..6a31ef3 100644 --- a/src/app/components/noosfero/profile-image/profile-image.component.ts +++ b/src/app/components/noosfero/profile-image/profile-image.component.ts @@ -1,15 +1,45 @@ import {Inject, Input, Component} from "ng-forward"; import {Profile} from "./../../../models/interfaces"; + +/** + * @ngdoc controller + * @name components.noosfero.profile-image.ProfileImage + * @description The component responsible for rendering the profile image + * @exports ProfileImage + */ @Component({ selector: "noosfero-profile-image", templateUrl: 'app/components/noosfero/profile-image/profile-image.html', }) export class ProfileImage { + + /** + * @ngdoc property + * @name profile + * @propertyOf components.noosfero.profile-image.ProfileImage + * @description + * The Noosfero {@link models.Profile} holding the image. + */ @Input() profile: Profile; + /** + * @ngdoc property + * @name defaultIcon + * @propertyOf components.noosfero.profile-image.ProfileImage + * @descritpion + * The default icon used by this profile + */ defaultIcon: string; + + /** + * @ngdoc method + * @name ngOnInit + * @methodOf components.noosfero.profile-image.ProfileImage + * @description + * Initializes the icon names to their corresponding values depending on the profile type passed to the controller + */ ngOnInit() { this.defaultIcon = 'fa-users'; if (this.profile && this.profile.type === 'Person') { diff --git a/src/app/index.module.ts b/src/app/index.module.ts index 26d6aaa..ce2861b 100644 --- a/src/app/index.module.ts +++ b/src/app/index.module.ts @@ -1,36 +1,96 @@ + +/** + * @ngdoc service + * @name NoosferoApp + * @description + * The main NoosferoApp module class. It provide helper static methods used by + * the module to initialize the application. + */ export class NoosferoApp { + /** + * @ngdoc property + * @name appName + * @propertyOf NoosferoApp + * @returns {string} the name of this application ('noosferoApp') + */ static appName: string = "noosferoApp"; + + /** + * @ngdoc property + * @name angularModule + * @propertyOf NoosferoApp + * @returns {any} all the modules installed for this application + */ static angularModule: any; - // static init(angularModule: any) { - // NoosferoApp.angularModule - // angular.module(NoosferoApp.appName, ["ngAnimate", "ngCookies", "ngStorage", "ngTouch", - // "ngSanitize", "ngMessages", "ngAria", "restangular", - // "ui.router", "ui.bootstrap", "toastr", - // "angularMoment", "angular.filter", "akoenig.deckgrid", - // "angular-timeline", "duScroll", "oitozero.ngSweetAlert"]); - // } + /** + * @ngdoc method + * @name addConfig + * @methodOf NoosferoApp + * @param {Function} configFunc the configuration function to add + * @descprition adds a configuration function to + * the {@link NoosferoApp#angularModule} + */ static addConfig(configFunc: Function) { NoosferoApp.angularModule.config(configFunc); } + /** + * @ngdoc method + * @name addConstants + * @methodOf NoosferoApp + * @param {string} constantName the constant name + * @param {any} value the constant value + * @description adds a constant to the {@link NoosferoApp#angularModule} + */ static addConstants(constantName: string, value: any) { NoosferoApp.angularModule.constant(constantName, value); } + /** + * @ngdoc method + * @name addService + * @methodOf NoosferoApp + * @param {string} serviceName the service name + * @param {any} value the service value + * @description adds a service to the {@link NoosferoApp#angularModule} + */ static addService(serviceName: string, value: any) { NoosferoApp.angularModule.service(serviceName, value); } + /** + * @ngdoc method + * @name addFactory + * @methodOf NoosferoApp + * @param {string} factoryName the factory name + * @param {any} value the factory value + * @description adds a factory to the {@link NoosferoApp#angularModule} + */ static addFactory(factoryName: string, value: any) { NoosferoApp.angularModule.factory(factoryName, value); } + /** + * @ngdoc method + * @name addController + * @methodOf NoosferoApp + * @param {string} controllerName the controller name + * @param {any} value the controller value + * @description adds a controller to the {@link NoosferoApp#angularModule} + */ static addController(controllerName: string, value: any) { NoosferoApp.angularModule.controller(controllerName, value); } + /** + * @ngdoc method + * @name run + * @methodOf NoosferoApp + * @param {Function} runFunction the function to execute + * @description runs a function using the {@link NoosferoApp#angularModule} + */ static run(runFunction: Function) { NoosferoApp.angularModule.run(runFunction); } diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 87a00ee..d54396b 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -25,6 +25,16 @@ import {Navbar} from "../components/navbar/navbar"; import {MainBlock} from "../components/noosfero-blocks/main-block/main-block.component"; +/** + * @ngdoc controller + * @name main.MainContent + * @requires AuthService, Session + * @descrition + * This controller actually contains the main content of Noosfero Angular Theme: + * - the navbar + * - the {@link Main} view content + * + */ @Component({ selector: 'main-content', templateUrl: "app/main/main.html", @@ -34,6 +44,20 @@ export class MainContent { } +/** + * @ngdoc controller + * @name main.Main + * @requires AuthService, Session, Notification, ArticleBlog, ArticleView, Boxes, Block, LinkListBlock, + * MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, MembersBlock, + * NoosferoTemplate, DateFormat, RawHTMLBlock + * @description + * The Main controller for the Noosfero Angular Theme application. + * + * The main route '/' is defined as the URL for this controller, which routes + * requests to the {@link main.MainContent} controller and also, the '/profile' route, + * which routes requests to the {@link profile.Profile} controller. See {@link profile.Profile} + * for more details on how various Noosfero profiles are rendered. + */ @Component({ selector: 'main', template: '
', diff --git a/src/app/models/interfaces.ts b/src/app/models/interfaces.ts index 02a728f..9fd5fcc 100644 --- a/src/app/models/interfaces.ts +++ b/src/app/models/interfaces.ts @@ -10,13 +10,53 @@ export interface Article { id: number; } +/** + * @ngdoc interface + * @name models.Profile + * @description + * A representation of a Noosfero Profile. + */ export interface Profile { + + /** + * @ngdoc property + * @name id + * @propertyOf models.Profile + * @returns {number} The Profile id + */ id: number; + + /** + * @ngdoc property + * @name identifier + * @propertyOf models.Profile + * @returns {string} The unque identifier for the Profile + */ identifier: string; + + /** + * @ngdoc property + * @name type + * @propertyOf models.Profile + * @returns {string} The Profile type (e.g.: "Person", etc.) + */ type: string; } + +/** + * @ngdoc interface + * @name models.Person + * @description + * A representation of a Person in Noosfero. + */ export interface Person extends Profile { + /** + * @ngdoc property + * @name id + * @propertyOf models.Person + * @returns {number} The Person id + */ id: number; } @@ -52,7 +92,19 @@ export interface Box { position: number; } +/** + * @ngdoc interface + * @name models.Activity + * @description + * A representation of a {@link models.Profile} activity in Noosfero. + */ export interface Activity { + /** + * @ngdoc property + * @name verb + * @propertyOf models.Activity + * @returns {string} The activity verb. + */ verb: string; } diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index ae35a27..69fce42 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -10,6 +10,12 @@ import {Notification} from "../components/notification/notification.component"; import * as noosferoModels from "./../models/interfaces"; +/** + * @ngdoc controller + * @name profile.Profile + * @description + * This is the profile controller. It provide routes to supported Noosfero Profiles. + */ @Component({ selector: 'profile', templateUrl: "app/profile/profile.html", -- libgit2 0.21.2