Skip to content

Commit 88e7851

Browse files
chore(release): v0.11.0
1 parent 3910154 commit 88e7851

File tree

8 files changed

+8503
-394
lines changed

8 files changed

+8503
-394
lines changed

assets/app.js

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,41 @@
1-
angular.module('bootstrapDemoApp', ['ui.bootstrap', 'plunker'], function($httpProvider){
1+
angular.module('bootstrapDemoApp', ['ui.bootstrap', 'plunker', 'ngTouch'], function($httpProvider){
22
FastClick.attach(document.body);
33
delete $httpProvider.defaults.headers.common['X-Requested-With'];
4-
});
4+
}).run(['$location', function($location){
5+
//Allows us to navigate to the correct element on initialization
6+
if ($location.path() !== '' && $location.path() !== '/') {
7+
smoothScroll(document.getElementById($location.path().substring(1)), 500, function(el) {
8+
location.replace(el.id);
9+
});
10+
}
11+
}]);
512

6-
function MainCtrl($scope, $http, $document, $modal, orderByFilter) {
7-
var url = "http://50.116.42.77:3001";
8-
//iFrame for downloading
9-
var $iframe = angular.element('<iframe>').css('display','none');
10-
$document.find('body').append($iframe);
13+
var builderUrl = "http://50.116.42.77:3001";
1114

12-
var downloadFileFromUrl = function(downloadUrl) {
13-
$iframe.attr('src', '');
14-
$iframe.attr('src', downloadUrl);
15-
};
16-
15+
function MainCtrl($scope, $http, $document, $modal, orderByFilter) {
1716
$scope.showBuildModal = function() {
1817
var modalInstance = $modal.open({
1918
templateUrl: 'buildModal.html',
2019
controller: 'SelectModulesCtrl',
2120
resolve: {
2221
modules: function() {
23-
return $http.get(url + "/api/bootstrap").then(function(response) {
22+
return $http.get(builderUrl + "/api/bootstrap").then(function(response) {
2423
return response.data.modules;
2524
});
2625
}
2726
}
2827
});
29-
30-
modalInstance.result.then(function(selectedModules) {
31-
var downloadUrl = url + "/api/bootstrap/download?";
32-
angular.forEach(selectedModules, function(module) {
33-
downloadUrl += "modules=" + module + "&";
34-
});
35-
downloadFileFromUrl(downloadUrl);
36-
});
3728
};
38-
29+
3930
$scope.showDownloadModal = function() {
4031
var modalInstance = $modal.open({
4132
templateUrl: 'downloadModal.html',
4233
controller: 'DownloadCtrl'
4334
});
44-
45-
modalInstance.result.then(function(options) {
46-
var downloadUrl = ['http://angular-ui.github.io/bootstrap/ui-bootstrap-'];
47-
if (options.tpls) {
48-
downloadUrl.push('tpls-');
49-
}
50-
downloadUrl.push(options.version);
51-
if (options.minified) {
52-
downloadUrl.push('.min');
53-
}
54-
downloadUrl.push('.js');
55-
56-
downloadFileFromUrl(downloadUrl.join(''));
57-
});
5835
};
5936
}
6037

6138
var SelectModulesCtrl = function($scope, $modalInstance, modules) {
62-
6339
$scope.selectedModules = [];
6440
$scope.modules = modules;
6541

@@ -78,20 +54,39 @@ var SelectModulesCtrl = function($scope, $modalInstance, modules) {
7854
$scope.cancel = function () {
7955
$modalInstance.dismiss();
8056
};
57+
58+
$scope.download = function (selectedModules) {
59+
var downloadUrl = builderUrl + "/api/bootstrap/download?";
60+
angular.forEach(selectedModules, function(module) {
61+
downloadUrl += "modules=" + module + "&";
62+
});
63+
return downloadUrl;
64+
};
8165
};
8266

8367
var DownloadCtrl = function($scope, $modalInstance) {
8468
$scope.options = {
8569
minified: true,
8670
tpls: true
8771
};
88-
72+
8973
$scope.download = function (version) {
90-
$scope.options.version = version;
91-
$modalInstance.close($scope.options);
74+
var options = $scope.options;
75+
76+
var downloadUrl = ['ui-bootstrap-'];
77+
if (options.tpls) {
78+
downloadUrl.push('tpls-');
79+
}
80+
downloadUrl.push(version);
81+
if (options.minified) {
82+
downloadUrl.push('.min');
83+
}
84+
downloadUrl.push('.js');
85+
86+
return downloadUrl.join('');
9287
};
93-
88+
9489
$scope.cancel = function () {
9590
$modalInstance.dismiss();
9691
};
97-
}
92+
}

assets/plunker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ angular.module('plunker', [])
1515
return '<!doctype html>\n' +
1616
'<html ng-app="plunker">\n' +
1717
' <head>\n' +
18-
' <script src="http://ajax.googleapis.com/ajax/libs/angularjs/'+ngVersion+'/angular.js"></script>\n' +
19-
' <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-'+version+'.js"></script>\n' +
18+
' <script src="//ajax.googleapis.com/ajax/libs/angularjs/'+ngVersion+'/angular.js"></script>\n' +
19+
' <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-'+version+'.js"></script>\n' +
2020
' <script src="example.js"></script>\n' +
2121
' <link href="//netdna.bootstrapcdn.com/bootstrap/'+bsVersion+'/css/bootstrap.min.css" rel="stylesheet">\n' +
2222
' </head>\n' +

assets/smoothscroll-angular-custom.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@ var linkHandler = function(ev) {
7373
// most browser don't update :target when the history api is used:
7474
// THIS IS A BUG FROM THE BROWSERS.
7575
// change the scrolling duration in this call
76-
smoothScroll(document.getElementById(this.hash.substring(1)), 500, function(el) {
76+
var targetEl = document.getElementById(this.hash.substring(1));
77+
if (targetEl) {
78+
smoothScroll(document.getElementById(this.hash.substring(1)), 500, function(el) {
7779
location.replace('#' + el.id)
7880
// this will cause the :target to be activated.
79-
});
81+
});
82+
}
8083
}
8184

8285
// We look for all the internal links in the documents and attach the smoothscroll function

0 commit comments

Comments
 (0)