-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.js
34 lines (30 loc) · 1.07 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
angular.module('foundationDemoApp', ['ui.bootstrap', 'plunker'])
.controller('MainCtrl', function($scope, $http, orderByFilter) {
var url = "http://50.116.42.77:3001";
$scope.selectedModules = [];
//iFrame for downloading
var $iframe = $("<iframe>").css('display','none').appendTo(document.body);
$scope.showBuildModal = function() {
$scope.buildModalShown = true;
//Load modules if they aren't loaded yet
if (!$scope.modules) {
$http.get(url + "/api/bootstrap").then(function(response) {
$scope.modules = response.data.modules;
}, function() {
$scope.buildGetErrorText = "Error retrieving build files from server.";
});
}
};
$scope.downloadBuild = function() {
var downloadUrl = url + "/api/bootstrap/download?";
angular.forEach($scope.selectedModules, function(module) {
downloadUrl += "modules=" + module + "&";
});
$iframe.attr('src','');
$iframe.attr('src', downloadUrl);
$scope.buildModalShown = false;
};
})
.config(function(buttonConfig) {
buttonConfig.activeClass = 'success';
});