Skip to content
This repository was archived by the owner on Oct 26, 2021. It is now read-only.

Commit 78ee245

Browse files
committed
Revert "Concat js resources."
This reverts commit 2e7019e.
1 parent 03d9005 commit 78ee245

File tree

9 files changed

+286
-19
lines changed

9 files changed

+286
-19
lines changed

app/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<link rel="stylesheet" href="bower_components/angular-loading-bar/build/loading-bar.min.css" />
99
<link rel="stylesheet" href="bower_components/angular-bootstrap-nav-tree/dist/abn_tree.css">
1010
<link rel="stylesheet" href="styles/main.css" />
11-
<!-- build:scripts -->
1211
<script src="bower_components/jquery/dist/jquery.min.js"></script>
1312
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
1413
<script src="bower_components/angular/angular.min.js"></script>
@@ -22,7 +21,7 @@
2221
<script src="scripts/modal.js"></script>
2322
<script src="scripts/navigation-top.js"></script>
2423
<script src="scripts/navigation-portlet.js"></script>
25-
<!-- endbuild -->
24+
<!-- Mock Backend -->
2625
<!-- build:mock -->
2726
<script src="bower_components/angular-mocks/angular-mocks.js"></script>
2827
<script src="scripts/mock-backend.js"></script>

gulpfile.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
var gulp = require('gulp'),
2-
concat = require('gulp-concat'),
32
del = require('del'),
43
prefix = require('gulp-prefix'),
54
less = require('gulp-less'),
65
replace = require('gulp-replace'),
7-
ugilfy = require('gulp-uglify'),
86
htmlReplace = require('gulp-html-replace'),
97
browserSync = require('browser-sync'),
108
sourcemaps = require('gulp-sourcemaps');
@@ -36,18 +34,15 @@ gulp.task('index-html', function(){
3634
gulp.src('app/index.html')
3735
.pipe(prefix(prefixUrl, null, true))
3836
.pipe(htmlReplace({
39-
'scripts': '++theme++plone.app.angularjs/plone.app.angularjs.min.js',
40-
'mock': ''
37+
'mock': ''
4138
}))
4239
.pipe(gulp.dest('src/plone/app/angularjs/app'));
4340
});
4441

45-
4642
// SCRIPTS
4743
gulp.task('scripts', function(){
4844
gulp.src('app/scripts/**/*.js')
4945
.pipe(replace("templateUrl: '", "templateUrl: '++theme++plone.app.angularjs/"))
50-
.pipe(concat('plone.app.angularjs.min.js'))
5146
.pipe(gulp.dest('src/plone/app/angularjs/app/scripts/'));
5247
});
5348

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
"browser-sync": "^1.5.7",
77
"del": "*",
88
"gulp": "^3.8.8",
9-
"gulp-concat": "^2.4.1",
109
"gulp-html-replace": "^1.4.0",
11-
"gulp-less": "^1.3.6",
1210
"gulp-prefix": "*",
1311
"gulp-replace": "^0.4.0",
14-
"gulp-sourcemaps": "^1.2.4",
15-
"gulp-uglify": "^1.0.1"
12+
"gulp-less": "^1.3.6",
13+
"gulp-sourcemaps": "^1.2.4"
1614
},
17-
"dependencies": {}
15+
"dependencies": {
16+
}
1817
}

src/plone/app/angularjs/app/index.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
<!doctype html>
22
<html ng-app="ploneApp">
33
<head>
4-
54
<title>Plone + AngularJS</title>
65
<meta charset="utf-8" />
76
<base tal:attributes="href view/base">
8-
97
<link rel="stylesheet" href="++theme++plone.app.angularjs/bower_components/bootstrap/dist/css/bootstrap.min.css">
108
<link rel="stylesheet" href="++theme++plone.app.angularjs/bower_components/angular-loading-bar/build/loading-bar.min.css">
119
<link rel="stylesheet" href="++theme++plone.app.angularjs/bower_components/angular-bootstrap-nav-tree/dist/abn_tree.css">
1210
<link rel="stylesheet" href="++theme++plone.app.angularjs/styles/main.css">
13-
14-
<script src="++theme++plone.app.angularjs/plone.app.angularjs.min.js"></script>
15-
11+
<script src="++theme++plone.app.angularjs/bower_components/jquery/dist/jquery.min.js"></script>
12+
<script src="++theme++plone.app.angularjs/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
13+
<script src="++theme++plone.app.angularjs/bower_components/angular/angular.min.js"></script>
14+
<script src="++theme++plone.app.angularjs/bower_components/angular-route/angular-route.min.js"></script>
15+
<script src="++theme++plone.app.angularjs/bower_components/angular-animate/angular-animate.js"></script>
16+
<script src="++theme++plone.app.angularjs/bower_components/angular-loading-bar/build/loading-bar.min.js"></script>
17+
<script src="++theme++plone.app.angularjs/bower_components/angular-sanitize/angular-sanitize.js"></script>
18+
<script src="++theme++plone.app.angularjs/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
19+
<script src="++theme++plone.app.angularjs/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
20+
<script src="++theme++plone.app.angularjs/scripts/app.js"></script>
21+
<script src="++theme++plone.app.angularjs/scripts/modal.js"></script>
22+
<script src="++theme++plone.app.angularjs/scripts/navigation-top.js"></script>
23+
<script src="++theme++plone.app.angularjs/scripts/navigation-portlet.js"></script>
24+
<!-- Mock Backend -->
1625

17-
1826
</head>
1927
<body>
2028
<div id="top-navigation-directive" navigation-directive></div>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
var ploneModule = angular.module(
2+
'ploneApp',
3+
[
4+
'ngAnimate',
5+
'ngRoute',
6+
'ngSanitize',
7+
'ui.bootstrap'
8+
]
9+
);
10+
11+
// Route Configuration
12+
ploneModule.config(['$routeProvider', '$locationProvider',
13+
function($routeProvider, $locationProvider) {
14+
'use strict';
15+
$locationProvider.html5Mode(true);
16+
$locationProvider.hashPrefix('!');
17+
$routeProvider.when('/:objecttraversal*', {
18+
controller: 'ObjectPathController',
19+
templateUrl: '++theme++plone.app.angularjs/page.tpl.html'
20+
}).otherwise({
21+
redirectTo: 'front-page'
22+
});
23+
}
24+
]);
25+
26+
ploneModule.controller('ObjectPathController',
27+
['$scope', '$routeParams', '$http', '$sce',
28+
function($scope, $routeParams, $http, $sce) {
29+
'use strict';
30+
//if ($routeParams.objecttraversal.match('/edit$')) {
31+
//}
32+
$http({
33+
url: '++api++v1/traversal',
34+
method: 'GET',
35+
params: {'path': $routeParams.objecttraversal.replace('index.html/', '')},
36+
}).success(function(data) {
37+
$scope.page = data;
38+
$scope.deliberatelyTrustDangerousSnippet = function() {
39+
return $sce.trustAsHtml($scope.snippet);
40+
};
41+
});
42+
}
43+
]
44+
);
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
var ploneModule;
2+
3+
angular.module('e2e-mocks', ['ngMockE2E']).run(function($httpBackend) {
4+
5+
var site_structure = [
6+
{
7+
id: 'front-page',
8+
title: 'Welcome to Plone',
9+
description: 'Congratulations! You have successfully installed Plone.',
10+
text: '<p>Front-page content</p>',
11+
path: 'front-page',
12+
portal_type: 'document',
13+
children: []
14+
},
15+
{
16+
id: 'news',
17+
title: 'News',
18+
description: 'Site News',
19+
text: '<p>Site news content</p>',
20+
path: 'news',
21+
portal_type: 'folder',
22+
children: []
23+
},
24+
{
25+
id: 'events',
26+
title: 'Events',
27+
description: 'Site Events',
28+
text: '<p>Site events content</p>',
29+
path: 'events',
30+
portal_type: 'folder',
31+
children: []
32+
},
33+
{
34+
id: 'Members',
35+
title: 'Members',
36+
description: 'Site Members',
37+
text: '<p>Site Members content</p>',
38+
path: 'Members',
39+
portal_type: 'folder',
40+
children: []
41+
}
42+
];
43+
44+
45+
// -- TOP NAVIGATION -------------------------------------------------------
46+
var top_navigation = [
47+
{
48+
id: 'news',
49+
title: 'News',
50+
description: 'News',
51+
path: '/news'
52+
},
53+
{
54+
id: 'events',
55+
title: 'Events',
56+
description: 'Events',
57+
path: '/events'
58+
}
59+
];
60+
var re = new RegExp('\\+\\+api\\+\\+v1/top_navigation');
61+
$httpBackend.whenGET(re).respond(top_navigation);
62+
63+
64+
// --- PORTLET NAVIGATION --------------------------------------------------
65+
var portlet_navigation_re = new RegExp('\\+\\+api\\+\\+v1/portlet_navigation');
66+
$httpBackend.whenGET(portlet_navigation_re).respond(site_structure);
67+
68+
69+
// --- TRAVERSAL -----------------------------------------------------------
70+
angular.forEach(site_structure, function(value, key) {
71+
var traversal = {
72+
'route': value.path,
73+
'id': value.id,
74+
'title': value.title,
75+
'description': value.description,
76+
'text': '<p>Lorem Ipsum</p>'
77+
};
78+
var traversal_re = new RegExp('\\+\\+api\\+\\+v1/traversal\\?path=' + value.path);
79+
$httpBackend.whenGET(traversal_re).respond(traversal);
80+
81+
});
82+
83+
84+
// --- PASS THROUGH TEMPLATES ----------------------------------------------
85+
var templates_re = new RegExp('.*.tpl.html$');
86+
$httpBackend.whenGET(templates_re).passThrough();
87+
88+
});
89+
90+
ploneModule.requires.push('e2e-mocks');
91+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var ploneModule;
2+
3+
ploneModule.controller('ModalInstanceCtrl', ['$scope', '$modalInstance', 'items',
4+
function ($scope, $modalInstance, items) {
5+
'use strict';
6+
$scope.items = items;
7+
$scope.selected = {
8+
item: $scope.items[0]
9+
};
10+
11+
$scope.ok = function () {
12+
$modalInstance.close($scope.selected);
13+
};
14+
15+
$scope.cancel = function () {
16+
$modalInstance.dismiss('cancel');
17+
};
18+
}
19+
]);
20+
21+
22+
ploneModule.controller('ModalDemoCtrl', ['$scope', '$modal', '$log',
23+
function ($scope, $modal, $log) {
24+
'use strict';
25+
$scope.items = ['item1', 'item2', 'item3'];
26+
27+
$scope.open = function () {
28+
29+
var modalInstance = $modal.open({
30+
templateUrl: '++theme++plone.app.angularjs/edit.tpl.html',
31+
controller: 'ModalInstanceCtrl',
32+
resolve: {
33+
items: function () {
34+
return $scope.items;
35+
}
36+
}
37+
});
38+
39+
modalInstance.result.then(function (selected) {
40+
$scope.selected = selected;
41+
}, function () {
42+
$log.info('Modal dismissed at: ' + new Date());
43+
});
44+
};
45+
}
46+
]);
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
var ploneModule;
2+
3+
ploneModule.factory('reportTreeService', function($q, $http) {
4+
5+
var getTreeData = function(path) {
6+
//console.log('getTreeData(' + path + ')');
7+
if (path == '/front-page') {
8+
path = null;
9+
}
10+
var deferred = $q.defer();
11+
$http({
12+
method: 'GET',
13+
url: '++api++v1/portlet_navigation',
14+
params: {
15+
'path': path
16+
}
17+
}).then(function (response) {
18+
deferred.resolve(response.data);
19+
});
20+
return deferred.promise;
21+
};
22+
23+
return {
24+
getTreeData: getTreeData
25+
};
26+
27+
});
28+
29+
30+
ploneModule.controller('NavigationPortletController',
31+
function($scope, $location, reportTreeService) {
32+
'use strict';
33+
$scope.location = $location;
34+
$scope.folders = [];
35+
var path = $scope.location.path();
36+
reportTreeService.getTreeData(path).then(function(data) {
37+
$scope.folders = data;
38+
$scope.output = JSON.stringify(data, null, " ");
39+
$scope.$watch('location', function(newValue, oldValue) {
40+
$scope.folders = data;
41+
});
42+
});
43+
}
44+
);
45+
46+
47+
ploneModule.directive('navigationPortletDirective',
48+
function() {
49+
'use strict';
50+
return {
51+
templateUrl: '++theme++plone.app.angularjs/navigation-portlet.tpl.html',
52+
controller: 'NavigationPortletController'
53+
};
54+
}
55+
);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var ploneModule;
2+
3+
ploneModule.controller('NavigationController',
4+
function($scope, $http, $location) {
5+
'use strict';
6+
$scope.location = $location;
7+
var url = '++api++v1/top_navigation';
8+
$http.get(url).success(function(data) {
9+
$scope.items = data;
10+
});
11+
12+
function setActiveNavigationItem() {
13+
$scope.activeSection = $location.path().slice(1).split('/')[0];
14+
$scope.activeItem = $location.path();
15+
$scope.path = $location.path().slice(1).split('/');
16+
}
17+
$scope.$watch('location.path()', setActiveNavigationItem);
18+
19+
}
20+
);
21+
22+
ploneModule.directive('navigationDirective',
23+
function() {
24+
'use strict';
25+
return {
26+
templateUrl: '++theme++plone.app.angularjs/navigation.tpl.html',
27+
controller: 'NavigationController'
28+
};
29+
}
30+
);

0 commit comments

Comments
 (0)