From 1eaced858b36cd4068c6e22e81d2bdc7bca66f49 Mon Sep 17 00:00:00 2001 From: chensivan Date: Thu, 2 Feb 2017 22:10:57 -0500 Subject: [PATCH] showing all the annotation on the side bar as buttons to click to locate where they are --- .../controllers/helper_response.controller.js | 1 + .../controllers/request.controller.js | 27 +++++++++++++++---- lib/response/responseView.js | 4 ++- lib/response/services/response_manager.js | 7 +---- lib/response/views/response_panel.view.html | 20 +++++++++----- package.json | 10 ++++--- 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/lib/response/controllers/helper_response.controller.js b/lib/response/controllers/helper_response.controller.js index a5b7eaf..5b9d06e 100644 --- a/lib/response/controllers/helper_response.controller.js +++ b/lib/response/controllers/helper_response.controller.js @@ -39,6 +39,7 @@ module.exports = function(app) { $scope.sliderInit = false; + atom.workspace.onDidStopChangingActivePaneItem(function() { $scope.$evalAsync(); }); diff --git a/lib/response/controllers/request.controller.js b/lib/response/controllers/request.controller.js index 7c2e506..b1d2b08 100644 --- a/lib/response/controllers/request.controller.js +++ b/lib/response/controllers/request.controller.js @@ -1,6 +1,7 @@ var TooltipView = require('../../utils/requestbutton-view.js'); + module.exports = function(app) { app.controller("RequestController", ['$timeout', '$scope', '$rootScope', 'QuestionManager', 'ResponseManager', function($timeout, $scope, $rootScope, QuestionManager, ResponseManager) { @@ -9,12 +10,28 @@ module.exports = function(app) { var editorListener = atom.workspace.getActiveTextEditor() - $scope.codeDiffButtonName = "Helper Code"; + $scope.button_value = "Helper Code"; + + $scope.gotoAnnotation = function(answer){ + debugger + //move cursor to the middle point of the selection + var selection_start_row = answer.location.start.row + var selection_start_column = answer.location.start.column + var selection_end_row = answer.location.end.row + var selection_end_column = answer.location.end.column + + var ed = atom.workspace.getActiveTextEditor(); + var cursor = ed.getCursors()[0] + cursor.setBufferPosition([selection_start_row, selection_start_column]) + ed.scrollToCursorPosition() + //move the screen to the middle point of the selection + + } $scope.openNewTabShowCodeDiff = function(answers) { debugger; - if ($scope.codeDiffButtonName == "Code Diff") { - $scope.codeDiffButtonName = "Helper Code"; + if ($scope.button_value == "Code Diff") { + $scope.button_value = "Helper Code"; $scope.codeDiffLegend = true; $scope.codeCommentLegend = false; ResponseManager.showCodeDiff(answers); @@ -32,7 +49,7 @@ module.exports = function(app) { if (!onlyAnnotation) { // $scope.mergedAlready = false; - $scope.codeDiffButtonName = "Code Diff"; + $scope.button_value = "Code Diff"; $scope.noInlineCode = false; } else { $scope.noInlineCode = true; @@ -45,7 +62,7 @@ module.exports = function(app) { } $rootScope.$on('directlyShowHelper', function(devent, data) { - $scope.codeDiffButtonName = "Helper Code"; + $scope.button_value = "Helper Code"; $scope.openNewTabShowCodeDiff(data); }) diff --git a/lib/response/responseView.js b/lib/response/responseView.js index 91d5296..e6b7910 100644 --- a/lib/response/responseView.js +++ b/lib/response/responseView.js @@ -10,6 +10,8 @@ var $ = require('jquery'), pfs = require('../utils/promised_fs'), path = require('path'); require("jquery-ui"); + require('angular-material'); + require('angular-aria'); //var xeditable = require("angular-xeditable"); module.exports = ResponseView; @@ -22,7 +24,7 @@ function ResponseView(isEnabled) { this.sliderElement = $('
').addClass('codeon-slider-wrapper'); $("atom-pane-container").append(this.sliderElement); - this.app = angular.module('codeon_response', ['angularMoment', ]); + this.app = angular.module('codeon_response', ['angularMoment', 'ngMaterial', ]); this.app2 = angular.module('codeon_replay', ['angularMoment']); require('./controllers/helper_response.controller')(this.app); diff --git a/lib/response/services/response_manager.js b/lib/response/services/response_manager.js index 7f02dca..2383a08 100644 --- a/lib/response/services/response_manager.js +++ b/lib/response/services/response_manager.js @@ -446,16 +446,11 @@ module.exports = function(app) { } return rv = { - viewAnnotation: function(answer){ - // toggle == "Show me"?observeTabs(answer) - // : removeMarker(tooltipMarkers) - observeTabs(answer); - }, removeRequesterCurrentCodeInSystem: function(){ lineMarkers.path = {}; }, returnCodeContextAndMsg(){ - showMsgBox + // showMsgBox return 'hello' }, getMsgContext: function(){ diff --git a/lib/response/views/response_panel.view.html b/lib/response/views/response_panel.view.html index 515a156..5c7e2e5 100644 --- a/lib/response/views/response_panel.view.html +++ b/lib/response/views/response_panel.view.html @@ -88,21 +88,27 @@

Answer

-
- -
(Please only run Helper Code version.)
+
+ +
- + + + +
+ Helper Code + Code Diff +
+ diff --git a/package.json b/package.json index 27ec444..8b46155 100644 --- a/package.json +++ b/package.json @@ -11,15 +11,16 @@ }, "dependencies": { "angular": "latest", - "bootstrap": "latest", - "angular-ui-bootstrap": "latest", "angular-animate": "latest", + "angular-material": "^1.1.3", "angular-moment": "latest", "angular-route": "latest", "angular-socket-io": "latest", - "angular-xeditable":"latest", + "angular-ui-bootstrap": "latest", + "angular-xeditable": "latest", "archiver": "latest", "atom-helpers": "latest", + "bootstrap": "latest", "diff": "latest", "express": "latest", "form-data": "latest", @@ -38,6 +39,7 @@ "socket.io": "latest", "stacktrace-parser": "latest", "temp": "latest", - "underscore": "latest" + "underscore": "latest", + "angular-aria": "1.5.0" } }