Commit d81889c24303f3ff11eccca44ecd54542bd33c5e
1 parent
531c0222
Exists in
master
and in
36 other branches
first typescript version. using webpack to compile and generate the noosfero.js …
…bundled file. added 'npm start' script to allow run the webpack and gulp-serve concurrently
Showing
42 changed files
with
473 additions
and
187 deletions
Show diff stats
.gitignore
package.json
... | ... | @@ -3,50 +3,58 @@ |
3 | 3 | "version": "0.0.0", |
4 | 4 | "dependencies": {}, |
5 | 5 | "scripts": { |
6 | - "test": "gulp test" | |
6 | + "test": "gulp test", | |
7 | + "postinstall": "npm install -g bower && bower install", | |
8 | + "start": "concurrently \"webpack -w\" \"gulp serve\"" | |
7 | 9 | }, |
8 | 10 | "devDependencies": { |
11 | + "browser-sync": "~2.9.11", | |
12 | + "browser-sync-spa": "~1.0.3", | |
13 | + "chalk": "~1.1.1", | |
14 | + "del": "~2.0.2", | |
15 | + "eslint-plugin-angular": "~0.12.0", | |
9 | 16 | "estraverse": "~4.1.0", |
17 | + "expose-loader": "^0.7.1", | |
10 | 18 | "gulp": "~3.9.0", |
11 | - "gulp-autoprefixer": "~3.0.2", | |
19 | + "gulp-angular-filesort": "~1.1.1", | |
12 | 20 | "gulp-angular-templatecache": "~1.8.0", |
13 | - "del": "~2.0.2", | |
14 | - "lodash": "~3.10.1", | |
15 | - "gulp-minify-css": "~1.2.1", | |
21 | + "gulp-autoprefixer": "~3.0.2", | |
22 | + "gulp-eslint": "~1.0.0", | |
16 | 23 | "gulp-filter": "~3.0.1", |
17 | 24 | "gulp-flatten": "~0.2.0", |
18 | - "gulp-eslint": "~1.0.0", | |
19 | - "eslint-plugin-angular": "~0.12.0", | |
25 | + "gulp-inject": "~3.0.0", | |
20 | 26 | "gulp-load-plugins": "~0.10.0", |
21 | - "gulp-size": "~2.0.0", | |
22 | - "gulp-uglify": "~1.4.1", | |
23 | - "gulp-useref": "~1.3.0", | |
24 | - "gulp-util": "~3.0.6", | |
27 | + "gulp-minify-css": "~1.2.1", | |
28 | + "gulp-minify-html": "~1.0.4", | |
25 | 29 | "gulp-ng-annotate": "~1.1.0", |
26 | - "gulp-replace": "~0.5.4", | |
30 | + "gulp-protractor": "~1.0.0", | |
27 | 31 | "gulp-rename": "~1.2.2", |
32 | + "gulp-replace": "~0.5.4", | |
28 | 33 | "gulp-rev": "~6.0.1", |
29 | 34 | "gulp-rev-replace": "~0.4.2", |
30 | - "gulp-minify-html": "~1.0.4", | |
31 | - "gulp-inject": "~3.0.0", | |
32 | - "gulp-protractor": "~1.0.0", | |
33 | - "gulp-sourcemaps": "~1.6.0", | |
34 | 35 | "gulp-sass": "~2.0.4", |
35 | - "gulp-angular-filesort": "~1.1.1", | |
36 | - "main-bower-files": "~2.9.0", | |
37 | - "wiredep": "~2.2.2", | |
36 | + "gulp-size": "~2.0.0", | |
37 | + "gulp-sourcemaps": "~1.6.0", | |
38 | + "gulp-typescript": "^2.12.0", | |
39 | + "gulp-uglify": "~1.4.1", | |
40 | + "gulp-useref": "~1.3.0", | |
41 | + "gulp-util": "~3.0.6", | |
42 | + "http-proxy-middleware": "~0.9.0", | |
38 | 43 | "karma": "~0.13.10", |
39 | - "karma-jasmine": "~0.3.6", | |
40 | - "karma-phantomjs-launcher": "~0.2.1", | |
41 | - "phantomjs": "~1.9.18", | |
42 | 44 | "karma-angular-filesort": "~1.0.0", |
43 | 45 | "karma-coverage": "~0.5.2", |
46 | + "karma-jasmine": "~0.3.6", | |
44 | 47 | "karma-ng-html2js-preprocessor": "~0.2.0", |
45 | - "browser-sync": "~2.9.11", | |
46 | - "browser-sync-spa": "~1.0.3", | |
47 | - "http-proxy-middleware": "~0.9.0", | |
48 | - "chalk": "~1.1.1", | |
48 | + "karma-phantomjs-launcher": "~0.2.1", | |
49 | + "lodash": "~3.10.1", | |
50 | + "main-bower-files": "~2.9.0", | |
51 | + "phantomjs": "~1.9.18", | |
52 | + "ts-loader": "^0.8.1", | |
53 | + "typescript": "^1.8.2", | |
54 | + "typings": "^0.6.8", | |
49 | 55 | "uglify-save-license": "~0.4.1", |
56 | + "webpack": "^1.12.14", | |
57 | + "wiredep": "~2.2.2", | |
50 | 58 | "wrench": "~1.5.8" |
51 | 59 | }, |
52 | 60 | "engines": { | ... | ... |
src/app/cms/cms.controller.js
src/app/components/auth/auth.controller.js
src/app/components/auth/auth.service.js
src/app/components/navbar/navbar.directive.js
src/app/components/noosfero-activities/activities.component.js
src/app/components/noosfero-activities/activity/activity.component.js
src/app/components/noosfero-articles/article/article.directive.js
src/app/components/noosfero-articles/blog/blog.component.js
src/app/components/noosfero-blocks/block.directive.js
src/app/components/noosfero-blocks/link-list/link-list.component.js
src/app/components/noosfero-blocks/main-block/main-block.component.js
src/app/components/noosfero-blocks/members-block/members-block.component.js
src/app/components/noosfero-blocks/profile-image/profile-image.component.js
src/app/components/noosfero-blocks/recent-documents/recent-documents.component.js
src/app/components/noosfero-boxes/boxes.component.js
src/app/components/noosfero/noosfero-template.filter.js
src/app/components/noosfero/noosfero.service.js
src/app/components/noosfero/profile-image/profile-image.component.js
src/app/content-viewer/content-viewer-actions.controller.js
src/app/content-viewer/content-viewer.controller.js
src/app/index.config.js
1 | -(function() { | |
2 | - 'use strict'; | |
3 | - | |
4 | - angular | |
5 | - .module('angular') | |
6 | - .config(config); | |
7 | - | |
8 | - /** @ngInject */ | |
9 | - function config($logProvider, $locationProvider, RestangularProvider, $httpProvider, $provide) { | |
1 | +"use strict"; | |
2 | +/** @ngInject */ | |
3 | +function noosferoModuleConfig($logProvider, $locationProvider, RestangularProvider, $httpProvider, $provide) { | |
10 | 4 | $logProvider.debugEnabled(true); |
11 | - $locationProvider.html5Mode({enabled: true}); | |
12 | - RestangularProvider.setBaseUrl('/api/v1'); | |
5 | + $locationProvider.html5Mode({ enabled: true }); | |
6 | + RestangularProvider.setBaseUrl("/api/v1"); | |
13 | 7 | RestangularProvider.setFullResponse(true); |
14 | - $httpProvider.defaults.headers.post = {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'}; | |
15 | - | |
16 | - $provide.decorator('$uiViewScroll', function ($delegate, $document) { | |
17 | - return function (uiViewElement) { | |
18 | - $document.scrollToElementAnimated(uiViewElement); | |
19 | - }; | |
8 | + $httpProvider.defaults.headers.post = { "Content-Type": "application/x-www-form-urlencoded; charset=utf-8" }; | |
9 | + $provide.decorator("$uiViewScroll", function ($delegate, $document) { | |
10 | + return function (uiViewElement) { | |
11 | + $document.scrollToElementAnimated(uiViewElement); | |
12 | + }; | |
20 | 13 | }); |
21 | - } | |
22 | - | |
23 | -})(); | |
14 | +} | |
15 | +exports.noosferoModuleConfig = noosferoModuleConfig; | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | + | |
2 | +/** @ngInject */ | |
3 | +export function noosferoModuleConfig($logProvider, $locationProvider, RestangularProvider, $httpProvider, $provide) { | |
4 | + $logProvider.debugEnabled(true); | |
5 | + $locationProvider.html5Mode({ enabled: true }); | |
6 | + RestangularProvider.setBaseUrl("/api/v1"); | |
7 | + RestangularProvider.setFullResponse(true); | |
8 | + $httpProvider.defaults.headers.post = { "Content-Type": "application/x-www-form-urlencoded; charset=utf-8" }; | |
9 | + | |
10 | + $provide.decorator("$uiViewScroll", function($delegate, $document) { | |
11 | + return function(uiViewElement) { | |
12 | + $document.scrollToElementAnimated(uiViewElement); | |
13 | + }; | |
14 | + }); | |
15 | +} | |
0 | 16 | \ No newline at end of file | ... | ... |
src/app/index.constants.js
... | ... | @@ -1,14 +0,0 @@ |
1 | -/* global moment:false */ | |
2 | -(function() { | |
3 | - 'use strict'; | |
4 | - | |
5 | - angular | |
6 | - .module('angular') | |
7 | - .constant('moment', moment) | |
8 | - .constant('AUTH_EVENTS', { | |
9 | - loginSuccess: 'auth-login-success', | |
10 | - loginFailed: 'auth-login-failed', | |
11 | - logoutSuccess: 'auth-logout-success' | |
12 | - }); | |
13 | - | |
14 | -})(); |
... | ... | @@ -0,0 +1,39 @@ |
1 | +"use strict"; | |
2 | +var index_module_1 = require("./index.module"); | |
3 | +var index_config_1 = require("./index.config"); | |
4 | +var index_run_1 = require("./index.run"); | |
5 | +var index_route_1 = require("./index.route"); | |
6 | +index_module_1.NoosferoApp.init(); | |
7 | +index_module_1.NoosferoApp.addConstants("moment", moment); | |
8 | +index_module_1.NoosferoApp.addConstants("AUTH_EVENTS", { | |
9 | + loginSuccess: "auth-login-success", | |
10 | + loginFailed: "auth-login-failed", | |
11 | + logoutSuccess: "auth-logout-success" | |
12 | +}); | |
13 | +index_module_1.NoosferoApp.addConfig(index_config_1.noosferoModuleConfig); | |
14 | +index_module_1.NoosferoApp.run(index_run_1.noosferoAngularRunBlock); | |
15 | +require("./cms/cms.controller.js"); | |
16 | +require("./components/auth/auth.controller.js"); | |
17 | +require("./components/auth/auth.service.js"); | |
18 | +require("./components/navbar/navbar.directive.js"); | |
19 | +require("./components/noosfero-activities/activities.component.js"); | |
20 | +require("./components/noosfero-activities/activity/activity.component.js"); | |
21 | +require("./components/noosfero-articles/article/article.directive.js"); | |
22 | +require("./components/noosfero-articles/blog/blog.component.js"); | |
23 | +require("./components/noosfero-blocks/block.directive.js"); | |
24 | +require("./components/noosfero-blocks/link-list/link-list.component.js"); | |
25 | +require("./components/noosfero-blocks/main-block/main-block.component.js"); | |
26 | +require("./components/noosfero-blocks/members-block/members-block.component.js"); | |
27 | +require("./components/noosfero-blocks/profile-image/profile-image.component.js"); | |
28 | +require("./components/noosfero-blocks/recent-documents/recent-documents.component.js"); | |
29 | +require("./components/noosfero-boxes/boxes.component.js"); | |
30 | +require("./components/noosfero/noosfero-template.filter.js"); | |
31 | +require("./components/noosfero/noosfero.service.js"); | |
32 | +require("./components/noosfero/profile-image/profile-image.component.js"); | |
33 | +require("./content-viewer/content-viewer-actions.controller.js"); | |
34 | +require("./content-viewer/content-viewer.controller.js"); | |
35 | +require("./main/main.controller.js"); | |
36 | +require("./profile-info/profile-info.controller.js"); | |
37 | +require("./profile/profile-home.controller.js"); | |
38 | +require("./profile/profile.controller.js"); | |
39 | +index_module_1.NoosferoApp.addConfig(index_route_1.routeConfig); | ... | ... |
src/app/index.module.js
1 | -(function() { | |
2 | - 'use strict'; | |
3 | - | |
4 | - angular | |
5 | - .module('angular', ['ngAnimate', 'ngCookies', 'ngStorage', 'ngTouch', | |
6 | - 'ngSanitize', 'ngMessages', 'ngAria', 'restangular', | |
7 | - 'ui.router', 'ui.bootstrap', 'toastr', | |
8 | - 'angularMoment', 'angular.filter', 'akoenig.deckgrid', | |
9 | - 'angular-timeline', 'duScroll', 'oitozero.ngSweetAlert']); | |
10 | - | |
11 | -})(); | |
1 | +"use strict"; | |
2 | +var NoosferoApp = (function () { | |
3 | + function NoosferoApp() { | |
4 | + } | |
5 | + NoosferoApp.init = function () { | |
6 | + angular.module(NoosferoApp.appName, ["ngAnimate", "ngCookies", "ngStorage", "ngTouch", | |
7 | + "ngSanitize", "ngMessages", "ngAria", "restangular", | |
8 | + "ui.router", "ui.bootstrap", "toastr", | |
9 | + "angularMoment", "angular.filter", "akoenig.deckgrid", | |
10 | + "angular-timeline", "duScroll", "oitozero.ngSweetAlert"]); | |
11 | + }; | |
12 | + NoosferoApp.addConfig = function (configFunc) { | |
13 | + angular.module(NoosferoApp.appName).config(configFunc); | |
14 | + }; | |
15 | + NoosferoApp.addConstants = function (constantName, value) { | |
16 | + angular.module(NoosferoApp.appName).constant(constantName, value); | |
17 | + }; | |
18 | + NoosferoApp.addService = function (serviceName, value) { | |
19 | + angular.module(NoosferoApp.appName).service(serviceName, value); | |
20 | + }; | |
21 | + NoosferoApp.run = function (runFunction) { | |
22 | + angular.module(NoosferoApp.appName).run(runFunction); | |
23 | + }; | |
24 | + NoosferoApp.appName = "noosferoApp"; | |
25 | + return NoosferoApp; | |
26 | +}()); | |
27 | +exports.NoosferoApp = NoosferoApp; | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +export class NoosferoApp { | |
2 | + | |
3 | + static appName: string = "noosferoApp"; | |
4 | + | |
5 | + static init() { | |
6 | + angular.module(NoosferoApp.appName, ["ngAnimate", "ngCookies", "ngStorage", "ngTouch", | |
7 | + "ngSanitize", "ngMessages", "ngAria", "restangular", | |
8 | + "ui.router", "ui.bootstrap", "toastr", | |
9 | + "angularMoment", "angular.filter", "akoenig.deckgrid", | |
10 | + "angular-timeline", "duScroll", "oitozero.ngSweetAlert"]); | |
11 | + } | |
12 | + | |
13 | + static addConfig(configFunc: Function) { | |
14 | + angular.module(NoosferoApp.appName).config(configFunc); | |
15 | + } | |
16 | + | |
17 | + static addConstants(constantName: string, value: any) { | |
18 | + angular.module(NoosferoApp.appName).constant(constantName, value); | |
19 | + } | |
20 | + | |
21 | + static addService(serviceName: string, value: any) { | |
22 | + angular.module(NoosferoApp.appName).service(serviceName, value); | |
23 | + } | |
24 | + | |
25 | + static run(runFunction: Function) { | |
26 | + angular.module(NoosferoApp.appName).run(runFunction); | |
27 | + } | |
28 | +} | |
29 | + | ... | ... |
src/app/index.route.js
1 | -(function() { | |
2 | - 'use strict'; | |
3 | - | |
4 | - angular | |
5 | - .module('angular') | |
6 | - .config(routeConfig); | |
7 | - | |
8 | - function routeConfig($stateProvider, $urlRouterProvider) { | |
1 | +"use strict"; | |
2 | +/** @ngInject */ | |
3 | +function routeConfig($stateProvider, $urlRouterProvider) { | |
9 | 4 | $stateProvider |
10 | - .state('main', { | |
11 | - url: '/', | |
12 | - templateUrl: 'app/main/main.html', | |
13 | - controller: 'MainController', | |
14 | - controllerAs: 'vm', | |
5 | + .state("main", { | |
6 | + url: "/", | |
7 | + templateUrl: "app/main/main.html", | |
8 | + controller: "MainController", | |
9 | + controllerAs: "vm", | |
15 | 10 | resolve: { |
16 | - currentUser: function(AuthService) { | |
17 | - return AuthService.loginFromCookie(); | |
18 | - } | |
11 | + currentUser: function (AuthService) { | |
12 | + return AuthService.loginFromCookie(); | |
13 | + } | |
19 | 14 | } |
20 | - }) | |
21 | - .state('main.profile.cms', { | |
22 | - url: '^/myprofile/:profile/cms', | |
15 | + }) | |
16 | + .state("main.profile.cms", { | |
17 | + url: "^/myprofile/:profile/cms", | |
23 | 18 | views: { |
24 | - 'mainBlockContent': { | |
25 | - templateUrl: 'app/cms/cms.html', | |
26 | - controller: 'CmsController', | |
27 | - controllerAs: 'vm' | |
28 | - } | |
19 | + "mainBlockContent": { | |
20 | + templateUrl: "app/cms/cms.html", | |
21 | + controller: "CmsController", | |
22 | + controllerAs: "vm" | |
23 | + } | |
29 | 24 | } |
30 | - }) | |
31 | - .state('main.profile.settings', { | |
32 | - url: '^/myprofile/:profile' | |
33 | - }) | |
34 | - .state('main.profile', { | |
35 | - url: '^/:profile', | |
25 | + }) | |
26 | + .state("main.profile.settings", { | |
27 | + url: "^/myprofile/:profile" | |
28 | + }) | |
29 | + .state("main.profile", { | |
30 | + url: "^/:profile", | |
36 | 31 | abstract: true, |
37 | 32 | views: { |
38 | - 'content': { | |
39 | - templateUrl: 'app/profile/profile.html', | |
40 | - controller: 'ProfileController', | |
41 | - controllerAs: 'vm' | |
42 | - } | |
33 | + "content": { | |
34 | + templateUrl: "app/profile/profile.html", | |
35 | + controller: "ProfileController", | |
36 | + controllerAs: "vm" | |
37 | + } | |
43 | 38 | } |
44 | - }) | |
45 | - .state('main.profile.home', { | |
46 | - url: '', | |
39 | + }) | |
40 | + .state("main.profile.home", { | |
41 | + url: "", | |
47 | 42 | views: { |
48 | - 'mainBlockContent': { | |
49 | - controller: 'ProfileHomeController', | |
50 | - controllerAs: 'vm' | |
51 | - } | |
43 | + "mainBlockContent": { | |
44 | + controller: "ProfileHomeController", | |
45 | + controllerAs: "vm" | |
46 | + } | |
52 | 47 | } |
53 | - }) | |
54 | - .state('main.profile.info', { | |
55 | - url: '^/profile/:profile', | |
48 | + }) | |
49 | + .state("main.profile.info", { | |
50 | + url: "^/profile/:profile", | |
56 | 51 | views: { |
57 | - 'mainBlockContent': { | |
58 | - templateUrl: 'app/profile-info/profile-info.html', | |
59 | - controller: 'ProfileInfoController', | |
60 | - controllerAs: 'vm' | |
61 | - } | |
52 | + "mainBlockContent": { | |
53 | + templateUrl: "app/profile-info/profile-info.html", | |
54 | + controller: "ProfileInfoController", | |
55 | + controllerAs: "vm" | |
56 | + } | |
62 | 57 | } |
63 | - }) | |
64 | - .state('main.profile.page', { | |
65 | - url: '/{page:any}', | |
58 | + }) | |
59 | + .state("main.profile.page", { | |
60 | + url: "/{page:any}", | |
66 | 61 | views: { |
67 | - 'mainBlockContent': { | |
68 | - templateUrl: 'app/content-viewer/page.html', | |
69 | - controller: 'ContentViewerController', | |
70 | - controllerAs: 'vm' | |
71 | - }, | |
72 | - 'actions@main': { | |
73 | - templateUrl: 'app/content-viewer/navbar-actions.html', | |
74 | - controller: 'ContentViewerActionsController', | |
75 | - controllerAs: 'vm' | |
76 | - } | |
62 | + "mainBlockContent": { | |
63 | + templateUrl: "app/content-viewer/page.html", | |
64 | + controller: "ContentViewerController", | |
65 | + controllerAs: "vm" | |
66 | + }, | |
67 | + "actions@main": { | |
68 | + templateUrl: "app/content-viewer/navbar-actions.html", | |
69 | + controller: "ContentViewerActionsController", | |
70 | + controllerAs: "vm" | |
71 | + } | |
77 | 72 | } |
78 | - }); | |
79 | - | |
80 | - $urlRouterProvider.otherwise('/'); | |
81 | - } | |
82 | - | |
83 | -})(); | |
73 | + }); | |
74 | + $urlRouterProvider.otherwise("/"); | |
75 | +} | |
76 | +exports.routeConfig = routeConfig; | ... | ... |
... | ... | @@ -0,0 +1,79 @@ |
1 | + | |
2 | + | |
3 | +/** @ngInject */ | |
4 | +export function routeConfig($stateProvider, $urlRouterProvider) { | |
5 | + $stateProvider | |
6 | + .state("main", { | |
7 | + url: "/", | |
8 | + templateUrl: "app/main/main.html", | |
9 | + controller: "MainController", | |
10 | + controllerAs: "vm", | |
11 | + resolve: { | |
12 | + currentUser: function(AuthService) { | |
13 | + return AuthService.loginFromCookie(); | |
14 | + } | |
15 | + } | |
16 | + }) | |
17 | + .state("main.profile.cms", { | |
18 | + url: "^/myprofile/:profile/cms", | |
19 | + views: { | |
20 | + "mainBlockContent": { | |
21 | + templateUrl: "app/cms/cms.html", | |
22 | + controller: "CmsController", | |
23 | + controllerAs: "vm" | |
24 | + } | |
25 | + } | |
26 | + }) | |
27 | + .state("main.profile.settings", { | |
28 | + url: "^/myprofile/:profile" | |
29 | + }) | |
30 | + .state("main.profile", { | |
31 | + url: "^/:profile", | |
32 | + abstract: true, | |
33 | + views: { | |
34 | + "content": { | |
35 | + templateUrl: "app/profile/profile.html", | |
36 | + controller: "ProfileController", | |
37 | + controllerAs: "vm" | |
38 | + } | |
39 | + } | |
40 | + }) | |
41 | + .state("main.profile.home", { | |
42 | + url: "", | |
43 | + views: { | |
44 | + "mainBlockContent": { | |
45 | + controller: "ProfileHomeController", | |
46 | + controllerAs: "vm" | |
47 | + } | |
48 | + } | |
49 | + }) | |
50 | + .state("main.profile.info", { | |
51 | + url: "^/profile/:profile", | |
52 | + views: { | |
53 | + "mainBlockContent": { | |
54 | + templateUrl: "app/profile-info/profile-info.html", | |
55 | + controller: "ProfileInfoController", | |
56 | + controllerAs: "vm" | |
57 | + } | |
58 | + } | |
59 | + }) | |
60 | + .state("main.profile.page", { | |
61 | + url: "/{page:any}", | |
62 | + views: { | |
63 | + "mainBlockContent": { | |
64 | + templateUrl: "app/content-viewer/page.html", | |
65 | + controller: "ContentViewerController", | |
66 | + controllerAs: "vm" | |
67 | + }, | |
68 | + "actions@main": { | |
69 | + templateUrl: "app/content-viewer/navbar-actions.html", | |
70 | + controller: "ContentViewerActionsController", | |
71 | + controllerAs: "vm" | |
72 | + } | |
73 | + } | |
74 | + }); | |
75 | + | |
76 | + $urlRouterProvider.otherwise("/"); | |
77 | + } | |
78 | + | |
79 | + | ... | ... |
src/app/index.run.js
1 | -(function() { | |
2 | - 'use strict'; | |
3 | - | |
4 | - angular | |
5 | - .module('angular') | |
6 | - .run(runBlock); | |
7 | - | |
8 | - /** @ngInject */ | |
9 | - function runBlock($log, Restangular, Session) { | |
10 | - Restangular.addFullRequestInterceptor(function(element, operation, route, url, headers) { | |
11 | - if(Session.getCurrentUser()) { | |
12 | - headers['Private-Token'] = Session.getCurrentUser().private_token; | |
13 | - } | |
14 | - return { headers: headers }; | |
1 | +"use strict"; | |
2 | +/** @ngInject */ | |
3 | +function noosferoAngularRunBlock($log, Restangular, Session) { | |
4 | + Restangular.addFullRequestInterceptor(function (element, operation, route, url, headers) { | |
5 | + if (Session.getCurrentUser()) { | |
6 | + headers["Private-Token"] = Session.getCurrentUser().private_token; | |
7 | + } | |
8 | + return { headers: headers }; | |
15 | 9 | }); |
16 | - } | |
17 | - | |
18 | -})(); | |
10 | +} | |
11 | +exports.noosferoAngularRunBlock = noosferoAngularRunBlock; | ... | ... |
... | ... | @@ -0,0 +1,11 @@ |
1 | + | |
2 | +/** @ngInject */ | |
3 | +export function noosferoAngularRunBlock($log, Restangular, Session) { | |
4 | + Restangular.addFullRequestInterceptor(function(element, operation, route, url, headers) { | |
5 | + if (Session.getCurrentUser()) { | |
6 | + headers["Private-Token"] = Session.getCurrentUser().private_token; | |
7 | + } | |
8 | + return { headers: headers }; | |
9 | + }); | |
10 | +} | |
11 | + | ... | ... |
... | ... | @@ -0,0 +1,49 @@ |
1 | +import {NoosferoApp} from "./index.module"; | |
2 | +import {noosferoModuleConfig} from "./index.config"; | |
3 | +import {noosferoAngularRunBlock} from "./index.run"; | |
4 | +import {routeConfig} from "./index.route"; | |
5 | + | |
6 | +declare var moment: any; | |
7 | + | |
8 | +NoosferoApp.init(); | |
9 | + | |
10 | +NoosferoApp.addConstants("moment", moment); | |
11 | +NoosferoApp.addConstants("AUTH_EVENTS", { | |
12 | + loginSuccess: "auth-login-success", | |
13 | + loginFailed: "auth-login-failed", | |
14 | + logoutSuccess: "auth-logout-success" | |
15 | +}); | |
16 | + | |
17 | + | |
18 | +NoosferoApp.addConfig(noosferoModuleConfig); | |
19 | + | |
20 | +NoosferoApp.run(noosferoAngularRunBlock); | |
21 | + | |
22 | +declare function require(module): any; | |
23 | + | |
24 | +require("./cms/cms.controller.js"); | |
25 | +require("./components/auth/auth.controller.js"); | |
26 | +require("./components/auth/auth.service.js"); | |
27 | +require("./components/navbar/navbar.directive.js"); | |
28 | +require("./components/noosfero-activities/activities.component.js"); | |
29 | +require("./components/noosfero-activities/activity/activity.component.js"); | |
30 | +require("./components/noosfero-articles/article/article.directive.js"); | |
31 | +require("./components/noosfero-articles/blog/blog.component.js"); | |
32 | +require("./components/noosfero-blocks/block.directive.js"); | |
33 | +require("./components/noosfero-blocks/link-list/link-list.component.js"); | |
34 | +require("./components/noosfero-blocks/main-block/main-block.component.js"); | |
35 | +require("./components/noosfero-blocks/members-block/members-block.component.js"); | |
36 | +require("./components/noosfero-blocks/profile-image/profile-image.component.js"); | |
37 | +require("./components/noosfero-blocks/recent-documents/recent-documents.component.js"); | |
38 | +require("./components/noosfero-boxes/boxes.component.js"); | |
39 | +require("./components/noosfero/noosfero-template.filter.js"); | |
40 | +require("./components/noosfero/noosfero.service.js"); | |
41 | +require("./components/noosfero/profile-image/profile-image.component.js"); | |
42 | +require("./content-viewer/content-viewer-actions.controller.js"); | |
43 | +require("./content-viewer/content-viewer.controller.js"); | |
44 | +require("./main/main.controller.js"); | |
45 | +require("./profile-info/profile-info.controller.js"); | |
46 | +require("./profile/profile-home.controller.js"); | |
47 | +require("./profile/profile.controller.js"); | |
48 | + | |
49 | +NoosferoApp.addConfig(routeConfig); | ... | ... |
src/app/main/main.controller.js
src/app/profile-info/profile-info.controller.js
src/app/profile/profile-home.controller.js
src/app/profile/profile.controller.js
src/index.html
1 | 1 | <!doctype html> |
2 | -<html ng-app="angular"> | |
2 | +<html ng-app="noosferoApp"> | |
3 | 3 | <head> |
4 | 4 | <base href="/"> |
5 | 5 | <meta charset="utf-8"> |
... | ... | @@ -33,10 +33,9 @@ |
33 | 33 | <!-- endbower --> |
34 | 34 | <!-- endbuild --> |
35 | 35 | |
36 | - <!-- build:js({.tmp/serve,.tmp/partials,src}) scripts/app.js --> | |
37 | - <!-- inject:js --> | |
38 | - <!-- js files will be automatically insert here --> | |
39 | - <!-- endinject --> | |
36 | + | |
37 | + | |
38 | + <script src="noosfero.js"></script> | |
40 | 39 | |
41 | 40 | <!-- inject:partials --> |
42 | 41 | <!-- angular templates will be automatically converted in js and inserted here --> | ... | ... |
style.css
... | ... | @@ -0,0 +1,9 @@ |
1 | +{ | |
2 | + "name": "angular", | |
3 | + "dependencies": {}, | |
4 | + "devDependencies": {}, | |
5 | + "ambientDependencies": { | |
6 | + "angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#1c4a34873c9e70cce86edd0e61c559e43dfa5f75", | |
7 | + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#470954c4f427e0805a2d633636a7c6aa7170def8" | |
8 | + } | |
9 | +} | ... | ... |
... | ... | @@ -0,0 +1,54 @@ |
1 | +var argv = require("yargs").argv; | |
2 | +var path = require("path"); | |
3 | + | |
4 | +var extension = ".js"; | |
5 | +if (argv.production) { | |
6 | + extension = ".min.js" | |
7 | +} | |
8 | + | |
9 | +var uglifyLoaderConfig = { | |
10 | + // I want to uglify with mangling only app files, not thirdparty libs | |
11 | + test: /\.js$/, | |
12 | + exclude: /.spec.js/, // excluding .spec files | |
13 | + loader: "uglify" | |
14 | +}; | |
15 | + | |
16 | +var webpackConfig = { | |
17 | + entry: { | |
18 | + noosfero: './src/app/index.ts' | |
19 | + }, | |
20 | + | |
21 | + | |
22 | + output: { | |
23 | + path: path.join(__dirname, "src"), | |
24 | + filename: "[name]" + extension, | |
25 | + }, | |
26 | + resolve: { | |
27 | + // Add `.ts` and `.tsx` as a resolvable extension. | |
28 | + extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js'] | |
29 | + }, | |
30 | + // Source maps support (or 'inline-source-map' also works) | |
31 | + devtool: 'source-map', | |
32 | + | |
33 | + module: { | |
34 | + loaders: [{ | |
35 | + test: /\.css$/, | |
36 | + loader: "style!css" | |
37 | + }, { | |
38 | + test: /\.scss$/, | |
39 | + loaders: ["style", "css?sourceMap", "sass?sourceMap"] | |
40 | + }, { | |
41 | + test: /.(png|woff(2)?|eot|ttf|svg)(\?[a-z0-9=\.]+)?$/, | |
42 | + loader: 'url-loader?limit=100000' | |
43 | + }, { | |
44 | + test: /\.tsx?$/, | |
45 | + loader: 'ts-loader' | |
46 | + }] | |
47 | + } | |
48 | +}; | |
49 | + | |
50 | +if (argv.production) { | |
51 | + webpackConfig.module.loaders.push(uglifyLoaderConfig); | |
52 | +} | |
53 | + | |
54 | +module.exports = webpackConfig; | ... | ... |