Skip to content

Commit 9fbb274

Browse files
committed
jquery + bootstrap js -> angular-ui bootstrap
1 parent ca2eab7 commit 9fbb274

10 files changed

Lines changed: 1258 additions & 46 deletions

File tree

angular-ui.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
handlers:
2+
- url: /angular-ui
3+
static_dir: app/lib/angular-ui/
4+
secure: always

app.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ threadsafe: false
88

99
includes:
1010
- angularjs.yaml
11+
- angular-ui.yaml
1112
- bootstrap.yaml
1213
- codemirror.yaml
1314
- playground.yaml

app/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@
4646
</div>
4747
</div>
4848

49-
<div class="alert pagination-centered">
49+
<!-- remove type attribute once https://github.com/angular-ui/bootstrap/pull/106 is fixed -->
50+
<alert type='"unspecified"' class='pagination-centered'>
5051
Note: This is a shared public playground.
5152
Anyone can read, modify or delete your projects, files and data at any time.
5253
Your private source code and data are <em>not</em> safe here.
53-
</div>
54+
</alert>
5455

5556
<div id="main">
5657
<div ng-view></div>
@@ -84,8 +85,7 @@
8485
<div class="screen" style="z-index: {{2147483647 - $index * 2 - 1}};"></div>
8586
</div>
8687

87-
<script src='/bootstrap/js/jquery.js'></script>
88-
<script src='/bootstrap/js/bootstrap.js'></script>
88+
<script src='/angular-ui/ui-bootstrap-tpls-0.1.0-SNAPSHOT.js'></script>
8989
<script src="/playground/js/app.js"></script>
9090
<script src="/playground/js/services.js"></script>
9191
<script src="/playground/js/controllers.js"></script>

app/js/app.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
'use strict';
22

3-
angular.module('playgroundApp', ['playgroundApp.filters',
4-
'playgroundApp.services',
5-
'playgroundApp.directives'])
3+
angular.module('playgroundApp', [
4+
'playgroundApp.filters',
5+
'playgroundApp.services',
6+
'playgroundApp.directives',
7+
'ui.bootstrap',
8+
])
69

7-
.config(function($locationProvider, $routeProvider, $httpProvider) {
10+
.config(function($locationProvider, $routeProvider, $httpProvider, $dialogProvider) {
811

912
$locationProvider.html5Mode(true);
1013

@@ -23,4 +26,10 @@ angular.module('playgroundApp', ['playgroundApp.filters',
2326

2427
$httpProvider.responseInterceptors.push('playgroundHttpInterceptor');
2528

29+
// TODO: test these defaults?
30+
$dialogProvider.options({
31+
backdropFade: true,
32+
modalFade: true,
33+
});
34+
2635
})

app/js/controllers.js

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function MainController($scope, $http, $window, $location, DoSerial) {
104104
}
105105

106106
function ProjectController($scope, $browser, $http, $routeParams, $window,
107-
$log, DoSerial, DomElementById) {
107+
$dialog, $log, DoSerial, DomElementById) {
108108

109109
// TODO: remove once file contents are returned in JSON response
110110
$scope.no_json_transform = function(data) { return data; };
@@ -240,36 +240,26 @@ function ProjectController($scope, $browser, $http, $routeParams, $window,
240240
*/
241241
};
242242

243-
$scope.$on('new_file', function(evt, path) {
244-
$scope.insert_path(path);
245-
});
246-
247243
$scope.prompt_new_file = function() {
248-
$scope.$broadcast('prompt_new_file');
244+
$dialog.dialog({
245+
controller: 'NewFileController',
246+
templateUrl: '/playground/new_file_modal.html',
247+
})
248+
.open().then(function(path) {
249+
if (path) {
250+
// remove leading and trailing slash(es)
251+
path = path.replace(/^\/*(.*?)\/*$/, '$1')
252+
$scope.insert_path(path);
253+
}
254+
});
249255
};
250256

251257
}
252258

253-
function NewFileController($scope, $log) {
254-
255-
// TODO: avoid DOM access
256-
var new_file_modal = $('#new-file-modal');
257-
258-
$scope.$on('prompt_new_file', function() {
259-
$scope.filename = '';
260-
new_file_modal.modal('show');
261-
// TODO: avoid DOM access
262-
$('#new_filename')[0].focus();
263-
});
264-
265-
$scope.create_file = function() {
266-
// remove leading and trailing slash(es)
267-
var path = $scope.filename.replace(/^\/*(.*?)\/*$/, '$1')
268-
$scope.$emit('new_file', path);
269-
}
259+
function NewFileController($scope, $log, dialog) {
270260

271-
$scope.close = function() {
272-
new_file_modal.modal('hide');
261+
$scope.close = function(path) {
262+
dialog.close(path);
273263
}
274264

275265
}

app/js/directives.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ angular.module('playgroundApp.directives', [])
66

77
// TODO: DETERMINE how must of this we should test
88
.directive('resizer', function(WrappedElementById) {
9+
910
var downx, downy, isdown, initialheight, elem;
1011
var dragDiv = WrappedElementById('drag-div');
1112

@@ -44,4 +45,5 @@ angular.module('playgroundApp.directives', [])
4445
dragDiv.bind('mouseup', upfunc);
4546
});
4647
};
47-
});
48+
49+
})

0 commit comments

Comments
 (0)