Commit 40711fe8675bb6d10b1b4f7d7a4cbd0b7ba53983
Exists in
master
and in
31 other branches
merge with ngforward branch
Showing
17 changed files
with
269 additions
and
12 deletions
Show diff stats
.gitignore
gulp/build.js
| ... | ... | @@ -111,4 +111,8 @@ gulp.task('clean', function () { |
| 111 | 111 | return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]); |
| 112 | 112 | }); |
| 113 | 113 | |
| 114 | +gulp.task('clean-docs', [], function() { | |
| 115 | + return $.del([path.join(conf.paths.docs, '/')]); | |
| 116 | +}); | |
| 117 | + | |
| 114 | 118 | gulp.task('build', ['html', 'fonts', 'other', 'locale']); | ... | ... |
gulp/conf.js
gulpfile.js
| ... | ... | @@ -27,3 +27,42 @@ wrench.readdirSyncRecursive('./gulp').filter(function(file) { |
| 27 | 27 | gulp.task('default', ['clean'], function () { |
| 28 | 28 | gulp.start('build'); |
| 29 | 29 | }); |
| 30 | + | |
| 31 | +gulp.task('ngdocs', ['clean-docs'], function () { | |
| 32 | + var gulpDocs = require('gulp-ngdocs'); | |
| 33 | + var options = { | |
| 34 | + scripts: [ | |
| 35 | + 'bower_components/angular/angular.min.js', | |
| 36 | + 'bower_components/angular/angular.min.js.map', | |
| 37 | + 'bower_components/angular-animate/angular-animate.min.js', | |
| 38 | + 'bower_components/angular-animate/angular-animate.min.js.map' | |
| 39 | + //'bower_components/angular/angular.js' | |
| 40 | + ], | |
| 41 | + html5Mode: true, | |
| 42 | + startPage: '/', | |
| 43 | + title: "Noosfero Angular Theme Documentation", | |
| 44 | + //image: "path/to/my/image.png", | |
| 45 | + //imageLink: "http://my-domain.com", | |
| 46 | + titleLink: "/", | |
| 47 | + loadDefaults: { | |
| 48 | + angular: false, | |
| 49 | + angularAnimate: false | |
| 50 | + } | |
| 51 | + } | |
| 52 | + return gulpDocs.sections({ | |
| 53 | + api: { | |
| 54 | + glob:[ | |
| 55 | + //'src/**/*.js', '!src/noosfero.js', '!src/noosfero-specs.js' | |
| 56 | + //'src/noosfero.js' | |
| 57 | + 'src/**/*.ts' | |
| 58 | + ],//, '!src/**/*.spec.js'], | |
| 59 | + api: true, | |
| 60 | + title: 'API Documentation' | |
| 61 | + }, | |
| 62 | + tutorial: { | |
| 63 | + glob: ['content/tutorial/*.ngdoc'], | |
| 64 | + title: 'Tutorial' | |
| 65 | + } | |
| 66 | + }).pipe(gulpDocs.process(options)).pipe(gulp.dest('./docs')); | |
| 67 | +}); | |
| 68 | + | ... | ... |
package.json
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | "build": "webpack; gulp build", |
| 12 | 12 | "webpack": "webpack", |
| 13 | 13 | "karma": "concurrently \"webpack -w\" \"karma start\"", |
| 14 | + "docs": "gulp ngdocs; static-server docs", | |
| 14 | 15 | "coverage": "karma start --single-run; npm run remap-coverage", |
| 15 | 16 | "remap-coverage": "ts-node --project ./dev-scripts ./dev-scripts/remapCoverage.ts", |
| 16 | 17 | "test-single": "karma start --single-run", |
| ... | ... | @@ -44,6 +45,7 @@ |
| 44 | 45 | "gulp-minify-css": "~1.2.1", |
| 45 | 46 | "gulp-minify-html": "~1.0.4", |
| 46 | 47 | "gulp-ng-annotate": "~1.1.0", |
| 48 | + "gulp-ngdocs": "0.2.13", | |
| 47 | 49 | "gulp-protractor": "~1.0.0", |
| 48 | 50 | "gulp-rename": "~1.2.2", |
| 49 | 51 | "gulp-replace": "~0.5.4", |
| ... | ... | @@ -71,13 +73,13 @@ |
| 71 | 73 | "karma-webpack": "^1.7.0", |
| 72 | 74 | "lodash": "~3.10.1", |
| 73 | 75 | "main-bower-files": "~2.9.0", |
| 74 | - "ng-forward": "0.0.1-alpha.12", | |
| 75 | 76 | "on-build-webpack": "^0.1.0", |
| 76 | 77 | "phantomjs": "~1.9.18", |
| 77 | 78 | "phantomjs-polyfill": "0.0.2", |
| 78 | 79 | "reflect-metadata": "^0.1.3", |
| 79 | 80 | "remap-istanbul": "github:sitepen/remap-istanbul", |
| 80 | 81 | "replace": "^0.3.0", |
| 82 | + "static-server": "^2.0.1", | |
| 81 | 83 | "ts-loader": "^0.8.1", |
| 82 | 84 | "ts-node": "^0.5.5", |
| 83 | 85 | "tslint": "^3.5.0", | ... | ... |
src/app/components/noosfero-activities/activities.component.ts
| 1 | 1 | import {Component, Input} from "ng-forward"; |
| 2 | 2 | import {NoosferoActivity} from "./activity/activity.component"; |
| 3 | 3 | |
| 4 | +/** | |
| 5 | + * @ngdoc controller | |
| 6 | + * @name NoosferoActivities | |
| 7 | + * @description | |
| 8 | + * The controller responsible to retreive profile activities. | |
| 9 | + */ | |
| 10 | + | |
| 4 | 11 | @Component({ |
| 5 | 12 | selector: "noosfero-activities", |
| 6 | 13 | templateUrl: 'app/components/noosfero-activities/activities.html', |
| ... | ... | @@ -8,6 +15,13 @@ import {NoosferoActivity} from "./activity/activity.component"; |
| 8 | 15 | }) |
| 9 | 16 | export class NoosferoActivities { |
| 10 | 17 | |
| 18 | + /** | |
| 19 | + * @ngdoc property | |
| 20 | + * @propertyOf NoosferoActivities | |
| 21 | + * @name activities | |
| 22 | + * @returns {Activity[]} An array of {@link Activity}. | |
| 23 | + */ | |
| 11 | 24 | @Input() activities: noosfero.Activity[]; |
| 12 | 25 | |
| 26 | + | |
| 13 | 27 | } | ... | ... |
src/app/components/noosfero-articles/article/article_view.ts
| 1 | 1 | import { bundle, Input, Inject, Component, Directive } from 'ng-forward'; |
| 2 | 2 | import {ArticleBlog} from "../blog/blog.component"; |
| 3 | 3 | |
| 4 | +/** | |
| 5 | + * @ngdoc controller | |
| 6 | + * @name ArticleDefaultView | |
| 7 | + * @description | |
| 8 | + * A default view for Noosfero Articles. If the specific article view is | |
| 9 | + * not implemented, then this view is used. | |
| 10 | + */ | |
| 4 | 11 | @Component({ |
| 5 | 12 | selector: 'noosfero-default-article', |
| 6 | 13 | templateUrl: 'app/components/noosfero-articles/article/article.html' |
| ... | ... | @@ -12,6 +19,13 @@ export class ArticleDefaultView { |
| 12 | 19 | |
| 13 | 20 | } |
| 14 | 21 | |
| 22 | +/** | |
| 23 | + * @ngdoc controller | |
| 24 | + * @name ArticleView | |
| 25 | + * @description | |
| 26 | + * A dynamic view for articles. It uses the article type to replace | |
| 27 | + * the default template with the custom article directive. | |
| 28 | + */ | |
| 15 | 29 | @Component({ |
| 16 | 30 | selector: 'noosfero-article', |
| 17 | 31 | template: 'not-used', | ... | ... |
src/app/components/noosfero-articles/blog/blog.component.ts
| ... | ... | @@ -2,6 +2,12 @@ import {Component, Input, Inject} from "ng-forward"; |
| 2 | 2 | |
| 3 | 3 | import {ArticleService} from "../../../../lib/ng-noosfero-api/http/article.service"; |
| 4 | 4 | |
| 5 | +/** | |
| 6 | + * @ngdoc controller | |
| 7 | + * @name ArticleBlog | |
| 8 | + * @description | |
| 9 | + * An specific {@link ArticleView} for Blog articles. | |
| 10 | + */ | |
| 5 | 11 | @Component({ |
| 6 | 12 | selector: "noosfero-blog", |
| 7 | 13 | templateUrl: "app/components/noosfero-articles/blog/blog.html" | ... | ... |
src/app/components/noosfero/profile-image/index.ts
src/app/components/noosfero/profile-image/profile-image.component.spec.ts
| 1 | +/** | |
| 2 | + * @ngdoc overview | |
| 3 | + * @name components.noosfero.profile-image.ProfileImageSpec | |
| 4 | + * @description | |
| 5 | + * This file contains the tests for the {@link components.noosfero.profile-image.ProfileImage} component. | |
| 6 | + */ | |
| 1 | 7 | |
| 2 | 8 | import {TestComponentBuilder, ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder'; |
| 3 | 9 | import {Pipe, Input, provide, Component} from 'ng-forward'; | ... | ... |
src/app/components/noosfero/profile-image/profile-image.component.ts
| 1 | 1 | import {Inject, Input, Component} from "ng-forward"; |
| 2 | 2 | |
| 3 | + | |
| 4 | +/** | |
| 5 | + * @ngdoc controller | |
| 6 | + * @name components.noosfero.profile-image.ProfileImage | |
| 7 | + * @description The component responsible for rendering the profile image | |
| 8 | + * @exports ProfileImage | |
| 9 | + */ | |
| 3 | 10 | @Component({ |
| 4 | 11 | selector: "noosfero-profile-image", |
| 5 | 12 | templateUrl: 'app/components/noosfero/profile-image/profile-image.html', |
| 6 | 13 | }) |
| 7 | 14 | export class ProfileImage { |
| 8 | 15 | |
| 16 | + /** | |
| 17 | + * @ngdoc property | |
| 18 | + * @name profile | |
| 19 | + * @propertyOf components.noosfero.profile-image.ProfileImage | |
| 20 | + * @description | |
| 21 | + * The Noosfero {@link models.Profile} holding the image. | |
| 22 | + */ | |
| 9 | 23 | @Input() profile: noosfero.Profile; |
| 24 | + /** | |
| 25 | + * @ngdoc property | |
| 26 | + * @name defaultIcon | |
| 27 | + * @propertyOf components.noosfero.profile-image.ProfileImage | |
| 28 | + * @descritpion | |
| 29 | + * The default icon used by this profile | |
| 30 | + */ | |
| 10 | 31 | defaultIcon: string; |
| 11 | 32 | |
| 33 | + /** | |
| 34 | + * @ngdoc method | |
| 35 | + * @name ngOnInit | |
| 36 | + * @methodOf components.noosfero.profile-image.ProfileImage | |
| 37 | + * @description | |
| 38 | + * Initializes the icon names to their corresponding values depending on the profile type passed to the controller | |
| 39 | + */ | |
| 12 | 40 | ngOnInit() { |
| 13 | 41 | this.defaultIcon = 'fa-users'; |
| 14 | 42 | if (this.profile && this.profile.type === 'Person') { | ... | ... |
src/app/index.module.ts
| 1 | + | |
| 2 | +/** | |
| 3 | + * @ngdoc service | |
| 4 | + * @name NoosferoApp | |
| 5 | + * @description | |
| 6 | + * The main NoosferoApp module class. It provide helper static methods used by | |
| 7 | + * the module to initialize the application. | |
| 8 | + */ | |
| 1 | 9 | export class NoosferoApp { |
| 2 | 10 | |
| 11 | + /** | |
| 12 | + * @ngdoc property | |
| 13 | + * @name appName | |
| 14 | + * @propertyOf NoosferoApp | |
| 15 | + * @returns {string} the name of this application ('noosferoApp') | |
| 16 | + */ | |
| 3 | 17 | static appName: string = "noosferoApp"; |
| 18 | + | |
| 19 | + /** | |
| 20 | + * @ngdoc property | |
| 21 | + * @name angularModule | |
| 22 | + * @propertyOf NoosferoApp | |
| 23 | + * @returns {any} all the modules installed for this application | |
| 24 | + */ | |
| 4 | 25 | static angularModule: any; |
| 5 | - // static init(angularModule: any) { | |
| 6 | - // NoosferoApp.angularModule | |
| 7 | - // angular.module(NoosferoApp.appName, ["ngAnimate", "ngCookies", "ngStorage", "ngTouch", | |
| 8 | - // "ngSanitize", "ngMessages", "ngAria", "restangular", | |
| 9 | - // "ui.router", "ui.bootstrap", "toastr", | |
| 10 | - // "angularMoment", "angular.filter", "akoenig.deckgrid", | |
| 11 | - // "angular-timeline", "duScroll", "oitozero.ngSweetAlert"]); | |
| 12 | - // } | |
| 13 | 26 | |
| 27 | + /** | |
| 28 | + * @ngdoc method | |
| 29 | + * @name addConfig | |
| 30 | + * @methodOf NoosferoApp | |
| 31 | + * @param {Function} configFunc the configuration function to add | |
| 32 | + * @descprition adds a configuration function to | |
| 33 | + * the {@link NoosferoApp#angularModule} | |
| 34 | + */ | |
| 14 | 35 | static addConfig(configFunc: Function) { |
| 15 | 36 | NoosferoApp.angularModule.config(configFunc); |
| 16 | 37 | } |
| 17 | 38 | |
| 39 | + /** | |
| 40 | + * @ngdoc method | |
| 41 | + * @name addConstants | |
| 42 | + * @methodOf NoosferoApp | |
| 43 | + * @param {string} constantName the constant name | |
| 44 | + * @param {any} value the constant value | |
| 45 | + * @description adds a constant to the {@link NoosferoApp#angularModule} | |
| 46 | + */ | |
| 18 | 47 | static addConstants(constantName: string, value: any) { |
| 19 | 48 | NoosferoApp.angularModule.constant(constantName, value); |
| 20 | 49 | } |
| 21 | 50 | |
| 51 | + /** | |
| 52 | + * @ngdoc method | |
| 53 | + * @name addService | |
| 54 | + * @methodOf NoosferoApp | |
| 55 | + * @param {string} serviceName the service name | |
| 56 | + * @param {any} value the service value | |
| 57 | + * @description adds a service to the {@link NoosferoApp#angularModule} | |
| 58 | + */ | |
| 22 | 59 | static addService(serviceName: string, value: any) { |
| 23 | 60 | NoosferoApp.angularModule.service(serviceName, value); |
| 24 | 61 | } |
| 25 | 62 | |
| 63 | + /** | |
| 64 | + * @ngdoc method | |
| 65 | + * @name addFactory | |
| 66 | + * @methodOf NoosferoApp | |
| 67 | + * @param {string} factoryName the factory name | |
| 68 | + * @param {any} value the factory value | |
| 69 | + * @description adds a factory to the {@link NoosferoApp#angularModule} | |
| 70 | + */ | |
| 26 | 71 | static addFactory(factoryName: string, value: any) { |
| 27 | 72 | NoosferoApp.angularModule.factory(factoryName, value); |
| 28 | 73 | } |
| 29 | 74 | |
| 75 | + /** | |
| 76 | + * @ngdoc method | |
| 77 | + * @name addController | |
| 78 | + * @methodOf NoosferoApp | |
| 79 | + * @param {string} controllerName the controller name | |
| 80 | + * @param {any} value the controller value | |
| 81 | + * @description adds a controller to the {@link NoosferoApp#angularModule} | |
| 82 | + */ | |
| 30 | 83 | static addController(controllerName: string, value: any) { |
| 31 | 84 | NoosferoApp.angularModule.controller(controllerName, value); |
| 32 | 85 | } |
| 33 | 86 | |
| 87 | + /** | |
| 88 | + * @ngdoc method | |
| 89 | + * @name run | |
| 90 | + * @methodOf NoosferoApp | |
| 91 | + * @param {Function} runFunction the function to execute | |
| 92 | + * @description runs a function using the {@link NoosferoApp#angularModule} | |
| 93 | + */ | |
| 34 | 94 | static run(runFunction: Function) { |
| 35 | 95 | NoosferoApp.angularModule.run(runFunction); |
| 36 | 96 | } | ... | ... |
src/app/main/main.component.ts
| ... | ... | @@ -25,6 +25,16 @@ import {Navbar} from "../components/navbar/navbar"; |
| 25 | 25 | import {MainBlock} from "../components/noosfero-blocks/main-block/main-block.component"; |
| 26 | 26 | |
| 27 | 27 | |
| 28 | +/** | |
| 29 | + * @ngdoc controller | |
| 30 | + * @name main.MainContent | |
| 31 | + * @requires AuthService, Session | |
| 32 | + * @descrition | |
| 33 | + * This controller actually contains the main content of Noosfero Angular Theme: | |
| 34 | + * - the navbar | |
| 35 | + * - the {@link Main} view content | |
| 36 | + * | |
| 37 | + */ | |
| 28 | 38 | @Component({ |
| 29 | 39 | selector: 'main-content', |
| 30 | 40 | templateUrl: "app/main/main.html", |
| ... | ... | @@ -34,6 +44,20 @@ export class MainContent { |
| 34 | 44 | |
| 35 | 45 | } |
| 36 | 46 | |
| 47 | +/** | |
| 48 | + * @ngdoc controller | |
| 49 | + * @name main.Main | |
| 50 | + * @requires AuthService, Session, Notification, ArticleBlog, ArticleView, Boxes, Block, LinkListBlock, | |
| 51 | + * MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, MembersBlock, | |
| 52 | + * NoosferoTemplate, DateFormat, RawHTMLBlock | |
| 53 | + * @description | |
| 54 | + * The Main controller for the Noosfero Angular Theme application. | |
| 55 | + * | |
| 56 | + * The main route '/' is defined as the URL for this controller, which routes | |
| 57 | + * requests to the {@link main.MainContent} controller and also, the '/profile' route, | |
| 58 | + * which routes requests to the {@link profile.Profile} controller. See {@link profile.Profile} | |
| 59 | + * for more details on how various Noosfero profiles are rendered. | |
| 60 | + */ | |
| 37 | 61 | @Component({ |
| 38 | 62 | selector: 'main', |
| 39 | 63 | template: '<div ng-view></div>', | ... | ... |
src/app/profile/profile.component.ts
| ... | ... | @@ -8,6 +8,14 @@ import {NoosferoActivities} from "../components/noosfero-activities/activities.c |
| 8 | 8 | import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service"; |
| 9 | 9 | import {Notification} from "../components/notification/notification.component"; |
| 10 | 10 | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * @ngdoc controller | |
| 14 | + * @name profile.Profile | |
| 15 | + * @description | |
| 16 | + * This is the profile controller. It provide routes to supported Noosfero Profiles. | |
| 17 | + */ | |
| 18 | + | |
| 11 | 19 | @Component({ |
| 12 | 20 | selector: 'profile', |
| 13 | 21 | templateUrl: "app/profile/profile.html", | ... | ... |
src/lib/ng-noosfero-api/interfaces/activity.ts
| 1 | 1 | namespace noosfero { |
| 2 | + /** | |
| 3 | + * @ngdoc interface | |
| 4 | + * @name noofero.Activity | |
| 5 | + * @description | |
| 6 | + * A representation of a {@link noosfero.Profile} activity in Noosfero. | |
| 7 | + */ | |
| 2 | 8 | export interface Activity { |
| 9 | + /** | |
| 10 | + * @ngdoc property | |
| 11 | + * @name verb | |
| 12 | + * @propertyOf noofero.Activity | |
| 13 | + * @returns {string} The activity verb. | |
| 14 | + */ | |
| 3 | 15 | verb: string; |
| 4 | 16 | } |
| 5 | 17 | } |
| 6 | 18 | \ No newline at end of file | ... | ... |
src/lib/ng-noosfero-api/interfaces/person.ts
src/lib/ng-noosfero-api/interfaces/profile.ts
| 1 | 1 | |
| 2 | 2 | namespace noosfero { |
| 3 | - export interface Profile extends RestModel { | |
| 3 | + /** | |
| 4 | + * @ngdoc interface | |
| 5 | + * @name noofero.Profile | |
| 6 | + * @description | |
| 7 | + * A representation of a Noosfero Profile. | |
| 8 | + */ | |
| 9 | + export interface Profile extends RestModel { | |
| 10 | + /** | |
| 11 | + * @ngdoc property | |
| 12 | + * @name id | |
| 13 | + * @propertyOf noofero.Profile | |
| 14 | + * @returns {number} The Profile id | |
| 15 | + */ | |
| 16 | + id: number; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * @ngdoc property | |
| 20 | + * @name identifier | |
| 21 | + * @propertyOf noofero.Profile | |
| 22 | + * @returns {string} The unque identifier for the Profile | |
| 23 | + */ | |
| 4 | 24 | identifier: string; |
| 25 | + | |
| 26 | + /** | |
| 27 | + * @ngdoc property | |
| 28 | + * @name type | |
| 29 | + * @propertyOf noofero.Profile | |
| 30 | + * @returns {string} The Profile type (e.g.: "Person", etc.) | |
| 31 | + */ | |
| 5 | 32 | type: string; |
| 6 | - name?: string; | |
| 33 | + | |
| 34 | + name: string; | |
| 7 | 35 | } |
| 8 | 36 | } |
| 9 | 37 | \ No newline at end of file | ... | ... |