Skip to content

Commit

Permalink
showing all the annotation on the side bar as buttons to click to loc…
Browse files Browse the repository at this point in the history
…ate where they are
  • Loading branch information
chensivan committed Feb 3, 2017
1 parent 2d8b4ee commit 1eaced8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 23 deletions.
1 change: 1 addition & 0 deletions lib/response/controllers/helper_response.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = function(app) {

$scope.sliderInit = false;


atom.workspace.onDidStopChangingActivePaneItem(function() {
$scope.$evalAsync();
});
Expand Down
27 changes: 22 additions & 5 deletions lib/response/controllers/request.controller.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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);
})

Expand Down
4 changes: 3 additions & 1 deletion lib/response/responseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +24,7 @@ function ResponseView(isEnabled) {
this.sliderElement = $('<div />').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);
Expand Down
7 changes: 1 addition & 6 deletions lib/response/services/response_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
20 changes: 13 additions & 7 deletions lib/response/views/response_panel.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,27 @@ <h4> Answer
</div>
</div>
<div style='margin: 5px' ng-repeat='answer in helper_response.answers | showButtonOnce track by $index '>
<div ng-show="codeCommentLegend">
<!-- Helper's code is on the right column with a legend
<span class="commentline">Comment</span> (You may close helper code w/o saving it.) -->
</div>
<div style="text-align:right; font-size:11px">
<div style='float: left; color:red' ng-show="codeDiffLegend">
(Please only run Helper Code version.)
</div>
<span am-time-ago="helper_response.timestamp"></span>
</div>
<div ng-hide="codeDiffLegend" ng-repeat='answer in helper_response.answers track by $index'>
<button ng-show="answer.type=='annotation'" ng-click="gotoAnnotation(answer)">Annotation: {{answer.value}}</button>
</div>
<form ng-hide='noInlineCode' style="margin-top:25px;">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default">
<input ng-model="values" ng-click="openNewTabShowCodeDiff(helper_response.answers)" value="helper" type="radio">{{codeDiffButtonName}}
</label>

<!-- <label class="btn btn-default">
<input ng-model="values" ng-click="openNewTabShowCodeDiff(helper_response.answers)" value="helper" type="radio">{{button_value}}
</label> -->

<div layout="row" layout-sm="column" layout-align="space-between" layout-align-sm="space-around center">
<input type="radio" ng-model="button_value" value="Helper Code" name="user_type1" ng-click='openNewTabShowCodeDiff(helper_response.answers, button_value)'>Helper Code
<input type="radio" ng-model="button_value" value="Code Diff" name="user_type2" ng-click='openNewTabShowCodeDiff(helper_response.answers, button_value)'>Code Diff
</div>

<!-- <label class="btn btn-default">
<input ng-model="values" ng-click="openNewTabShowHelperCode(helper_response.answers)" value="2013" type="radio">Helper
</label> -->
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -38,6 +39,7 @@
"socket.io": "latest",
"stacktrace-parser": "latest",
"temp": "latest",
"underscore": "latest"
"underscore": "latest",
"angular-aria": "1.5.0"
}
}

0 comments on commit 1eaced8

Please sign in to comment.