Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<link rel="stylesheet" href="lib/calendar/fullcalendar.css" >
<link rel="stylesheet" href="css/app.css" >
</head>
<body data-spy="scroll">
<body data-spy="scroll" ng-controller="MainCtrl">
<header class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
Expand Down Expand Up @@ -117,7 +117,7 @@ <h1>
</h1>
<p>The companion suite to the <strong><a href="http://angularjs.org">AngularJS</a></strong> framework.</p>
<p class="btn-group">
<a class="btn btn-large" href="https://github.com/angular-ui/angular-ui"><i class="icon-github"></i> Code on Github</a><a class="btn btn-large btn-primary" href="https://github.com/angular-ui/angular-ui/tags"><i class="icon-download-alt icon-white"></i> Download</a>
<a class="btn btn-large" href="https://github.com/angular-ui/angular-ui"><i class="icon-github"></i> Code on Github</a><a class="btn btn-large btn-primary" href="https://github.com/angular-ui/angular-ui/tags"><i class="icon-download-alt icon-white"></i> Download</a><a class="btn btn-large" ng-click="showBuildModal()">Create a Build</a>
</p>
</div>
<div class="bs-docs-social">
Expand Down Expand Up @@ -1201,5 +1201,26 @@ <h3>How?</h3>
})();

</script>

<div ui-modal class="fade" ng-model="buildModalShown">
<div class="modal-header"><h2>Create a Custom Build</h2></div>
<div class="modal-body">
<div ng-show="buildErrorText">
<h3 style="text-align: center;">{{buildErrorText}}</h3>
</div>
<div ng-hide="buildErrorText">
<h3 style="text-align: center;">Select the modules you wish to download:</h3>
<select style="width: 100%;" ui-select2 multiple
ui-options="{multiple: true}"
ng-model="selectedModules">
<option ng-repeat="m in modules" value="{{m}}">{{m | inflector:'humanize'}}</option>
</select>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ng-disabled="!selectedModules.length" ng-click="selectedModules.length && downloadBuild()"><i class="icon-download-alt icon-white"></i> Download {{selectedModules.length}} Modules</a>
<a class="btn" ng-click="buildModalShown = false">Cancel</a>
</div>
</div>
</body>
</html>
31 changes: 30 additions & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,35 @@ angular.module('demoApp', ['ui'], function($locationProvider) {
};
}]);

function MainCtrl($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/angular-ui").then(function(response) {
$scope.modules = response.data.modules;
}, function() {
$scope.buildGetErrorText = "Error retrieving build files from server.";
});
}
};

$scope.downloadBuild = function() {
var downloadUrl = url + "/api/angular-ui/download?";
angular.forEach($scope.selectedModules, function(module) {
downloadUrl += "modules=" + module + "&";
});
$iframe.attr('src','');
$iframe.attr('src', downloadUrl);
$scope.buildModalShown = false;
};
}

function CodeMirrorCtrl($scope) {
$scope.codeMirrorModel = "var helloWorld = 'Success!';";
}
Expand Down Expand Up @@ -170,4 +199,4 @@ function CalendarCtrl($scope) {
$scope.events.splice(index,1);
}
}
/* EOF */
/* EOF */