@@ -35,10 +35,12 @@ function PageController($scope, $http, DoSerial, $routeParams, $window) {
3535 ( $scope . config && $scope . config . playground_namespace ) ;
3636 } ;
3737
38+ // TODO: determine if there's a better way
3839 $scope . datastore_admin = function ( ) {
3940 $window . open ( '/playground/datastore/' + $scope . namespace ( ) , '_blank' ) ;
4041 } ;
4142
43+ // TODO: determine if there's a better way
4244 $scope . memcache_admin = function ( ) {
4345 $window . open ( '/playground/memcache/' + $scope . namespace ( ) , '_blank' ) ;
4446 } ;
@@ -118,6 +120,7 @@ function ProjectController($scope, $browser, $http, $routeParams, $window,
118120 $scope . url_of ( file ) : '' ;
119121 } ;
120122
123+ // TODO: don't expose function on $scope, while retaining testability
121124 $scope . _get = function ( file , success_cb ) {
122125 if ( file . hasOwnProperty ( 'contents' ) ) {
123126 success_cb ( ) ;
@@ -161,6 +164,7 @@ function ProjectController($scope, $browser, $http, $routeParams, $window,
161164*/
162165 } ;
163166
167+ // TODO: consider replacing DOM maniupulation here with a directive
164168 $scope . create_editor = function ( mime_type ) {
165169 if ( $scope . _editor ) {
166170 angular . element ( $scope . _editor . getWrapperElement ( ) ) . remove ( ) ;
@@ -232,6 +236,7 @@ function PageController($scope, $http, $location, $routeParams, $window,
232236 });
233237 };
234238
239+ // TODO: don't use prompt()
235240 $scope.prompt_to_delete_project = function(project) {
236241 var answer = prompt("Are you sure you want to delete project " +
237242 project.name + "?\nType 'yes' to confirm.", "no");
@@ -262,6 +267,7 @@ function PageController($scope, $http, $location, $routeParams, $window,
262267
263268function LightboxController($scope, $window) {
264269
270+ // TODO: determine if there's a better way
265271 $scope.reload = function() {
266272 $window.location.reload();
267273 };
@@ -276,6 +282,7 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
276282 Backoff, DoSerial, DomElementById,
277283 WrappedElementById) {
278284
285+ // TODO: determine if there's a better way
279286 var source_image = WrappedElementById('source-image');
280287
281288 // { "app.yaml" : {
@@ -309,6 +316,7 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
309316 _saveDirtyFiles();
310317 })
311318 .then(function() {
319+ // TODO: try to avoid DOM access
312320 var container = WrappedElementById('output-container');
313321 if (_output_window && _output_window.closed) {
314322 _popout = false;
@@ -342,6 +350,7 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
342350 .error(function(data, status, headers, config) {
343351 $scope.filestatus = 'Failed to save ' + path;
344352 file.dirty = true;
353+ // implement seconds() function
345354 var secs = Backoff.backoff() / 1000;
346355 $log.warn(path, 'failed to save; will retry in', secs, 'secs');
347356 Backoff.schedule(_saveDirtyFiles);
@@ -361,6 +370,7 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
361370 }
362371 }
363372
373+ // TODO: don't use prompt()
364374 $scope.prompt_file_delete = function() {
365375 var answer = prompt("Are you sure you want to delete " +
366376 $scope.current_file.name + "?\nType 'yes' to confirm.",
@@ -371,6 +381,7 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
371381 $scope.deletefile($scope.current_file);
372382 }
373383
384+ // TODO: don't use prompt()
374385 $scope.prompt_project_rename = function(project) {
375386 var new_project_name = prompt('Enter a new name for this project',
376387 project.name);
@@ -391,6 +402,7 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
391402 });
392403 }
393404
405+ // TODO: don't use prompt()
394406 $scope.prompt_file_rename = function() {
395407 var new_filename = prompt(
396408 'New filename?\n(You may specify a full path such as: foo/bar.txt)',
@@ -407,17 +419,20 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
407419 $scope.movefile($scope.current_file, new_filename);
408420 }
409421
422+ // TODO: determine if there's a better way
410423 function hide_context_menus() {
411424 $scope.showfilecontextmenu = false;
412425 $scope.showprojectcontextmenu = false;
413426 }
414427
415428 // setup context menu clear handler
429+ // TODO: use $window rather than window
416430 window.addEventListener('click', function(evt) {
417431 hide_context_menus();
418432 $scope.$apply();
419433 }, false);
420434
435+ // TODO: avoid DOM access
421436 $scope.project_context_menu = function(evt) {
422437 evt.stopPropagation();
423438 hide_context_menus();
@@ -427,6 +442,7 @@ function ProjectController($scope, $http, $filter, $log, $timeout, $routeParams,
427442 menuDiv.css('top', evt.pageY + 'px');
428443 };
429444
445+ // TODO: avoid DOM access
430446 $scope.file_context_menu = function(evt, file) {
431447 evt.stopPropagation();
432448 hide_context_menus();
0 commit comments