Skip to content

Commit

Permalink
Merge branch 'master' into gmatute
Browse files Browse the repository at this point in the history
  • Loading branch information
gabomatute committed Mar 7, 2017
2 parents 6103cc0 + 8761159 commit 5d9d23f
Show file tree
Hide file tree
Showing 23 changed files with 847 additions and 7,857 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@ prerequisites to install the plugin. Below there is a guide that
will take you through the requirements for Codeon the installation
process.

### Atom v1.6.2
### Atom

The Codeon plugin requires that you run the version 1.6.2 of Atom, so we
will have to install this specific version. Don’t worry if you use Atom
as your editor of choice and you would prefer to have the latest version
installed, you can have both versions simultaneously.
The Codeon plugin requires that you run the latest version of Atom. You can
download it from the following link:

#### Download

Get Atom v1.6.2 for your platform from the following link:
- [Atom](https://atom.io/)

- [Atom v1.6.2](https://github.com/atom/atom/releases/tag/v1.6.2)

#### Installation

Expand All @@ -37,8 +32,8 @@ Get Atom v1.6.2 for your platform from the following link:
the left of the Finder.

***Note:*** *If you already have a version of Atom in your system that
you wish to keep rename the application launcher to something else (like
Atom-1.6.2) so you don’t overwrite the existing app.*
you wish to keep rename the application launcher to something else so you
don’t overwrite the existing app.*

##### For Windows

Expand Down Expand Up @@ -154,7 +149,7 @@ If this doesn't work, try to make the link by giving the full path to
each directory, for example:

$ ln -s C:/Users/path/to/repo C:/Users/User/.atom/packages

Changing the paths as needed.

Alternatively, you can make a symbolic link to the standard installation
Expand Down
1 change: 1 addition & 0 deletions index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
@import "styles/recording-bar";
@import "styles/tooltip";
@import "styles/request-background-color";
// @import "styles/less/bootstrap";
4 changes: 3 additions & 1 deletion lib/codeon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ var user_preferences = require('./utils/user_preferences');
var editorID;
var pfs = require('./utils/promised_fs');
var path = require('path');

require('electron').ipcRenderer.setMaxListeners(20);
global.jQuery = require('jquery');
require('bootstrap');

module.exports= {

Expand Down
6 changes: 3 additions & 3 deletions lib/requests/controllers/recording_prompt.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = function(app, _parent) {
// triggers text request box
$scope.textRecording = function() {
//hide h2, hide start recording button
$scope.TEXTMODE = true
// $scope.TEXTMODE = true
$scope.textRequestDescription = ""
};

Expand All @@ -67,7 +67,7 @@ module.exports = function(app, _parent) {
//re-configure
$scope.requestTitle = "";
$scope.textRequestDescription = ""
$scope.TEXTMODE = false;
// $scope.TEXTMODE = false;
$scope.COUNTDOWN = false;
_parent.closePrompt();
}
Expand All @@ -76,7 +76,7 @@ module.exports = function(app, _parent) {
$scope.cancelPrompt = function() {
$scope.requestTitle = "";
$scope.textRequestDescription = ""
$scope.TEXTMODE = false
// $scope.TEXTMODE = false
$scope.COUNTDOWN = false;
var scope = angular.element(document.querySelector('#makeRequest')).scope();
$timeout(function(){
Expand Down
13 changes: 11 additions & 2 deletions lib/requests/requestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,19 @@ function RequestView() {
scope.reqSideBarButton = false;
});
}, 0, false);

// start recording with enter key
// $('textarea', this.getPromptPanelElement()).select().focus().on('keydown.checkEnter', _.bind(function(event) {
// if (event.keyCode === 13 && event.shiftKey === false) {
// $('#startRecording', this.getPromptPanelElement()).click();
// } else if (event.keyCode === 27) {
// $('#cancelRecording', this.getPromptPanelElement()).click();
// }
// }, this));

// send request with enter key
$('textarea', this.getPromptPanelElement()).select().focus().on('keydown.checkEnter', _.bind(function(event) {
if (event.keyCode === 13 && event.shiftKey === false) {
$('#startRecording', this.getPromptPanelElement()).click();
$('#requestTextSubmittion', this.getPromptPanelElement()).click();
} else if (event.keyCode === 27) {
$('#cancelRecording', this.getPromptPanelElement()).click();
}
Expand Down
4 changes: 4 additions & 0 deletions lib/requests/views/metafile.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval'; img-src data:; font-src 'self' data:; 'child-src' 'self' blob:">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.1/jquery.qtip.min.css" />
<script src="http://cdn.jsdelivr.net/qtip2/2.2.0/jquery.qtip.min.js"></script>
</head>
</html>
15 changes: 7 additions & 8 deletions lib/requests/views/recording_prompt.view.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@

<div ng-controller='RequestPromptController' class='code-on-request-prompt'>
<form ng-submit='startRecording()' ng-hide='COUNTDOWN'>
<h2>Briefly name your request. (e.g. javascript event handler syntax)</h2>
<textarea ng-model='requestTitle' id="request-title" class="form-control native-key-bindings" rows="1" tabIndex=-1 placeholder="(e.g. javascript event handler syntax)">{{requestTitle}}</textarea>
<h2 ng-hide='TEXTMODE'>
<h2 ng-show='TEXTMODE'>
You have two options to describe your request:<br><br>
1. Pressing "Text" button below allows you to write your request. <br><br>
2. Pressing "Start Recording" button below will start recording your voice and text written in the editor.
</h2>
<h2 ng-hide='TEXTMODE' style="color:red;">Please keep your request within 1 minute.</h2>
<h2 ng-show='TEXTMODE' style="color:red;">Please keep your request within 1 minute.</h2>
<br/>
<h2 ng-show='TEXTMODE' >Describe your request in the text box below. Click 'Submit' button once you are done! (up to 50 words)</h2>
<h2>Describe your request in the text box below. Click 'Submit' button once you are done! (up to 50 words)</h2>

<textarea ng-show='TEXTMODE' ng-model='textRequestDescription' id="request-text" class="form-control native-key-bindings" rows="5" tabIndex=-1 placeholder="(e.g. type your request here ... )">{{requestText}}</textarea>
<textarea ng-model='textRequestDescription' id="request-text" class="form-control native-key-bindings" rows="5" tabIndex=-1 placeholder="(e.g. type your request here ... )">{{requestText}}</textarea>

<div ng-hide="COUNTDOWN" class="prompt_buttons">
<select ng-model="requestTags" ng-options="tag for tag in tags" multiple></select>
<button id='textRecording' ng-hide='TEXTMODE' type='button' class='btn btn-default icon settings h3_size' ng-click='textRecording()'>Text</button>
<button id='startRecording' ng-hide='TEXTMODE' type='button' class='btn btn-default icon icon-primitive-dot settings h3_size' ng-click='startRecording()'>Start Recording</button>
<button id='requestTextSubmittion' ng-show='TEXTMODE' type='button' class='btn btn-default icon settings h3_size' ng-click='textRequestSubmittion()'>Submit</button>
<button id='textRecording' ng-show='TEXTMODE' type='button' class='btn btn-default icon settings h3_size' ng-click='textRecording()'>Text</button>
<button id='startRecording' ng-show='TEXTMODE' type='button' class='btn btn-default icon icon-primitive-dot settings h3_size' ng-click='startRecording()'>Start Recording</button>
<button id='requestTextSubmittion' type='button' class='btn btn-default icon settings h3_size' ng-click='textRequestSubmittion()'>Submit</button>
<button id='cancelRecording' type='button' class='btn btn-default icon settings h3_size' ng-click='cancelPrompt()'>Cancel</button>
</div>
</form>
Expand Down
54 changes: 49 additions & 5 deletions lib/response/controllers/helper_response.controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
var Quill = require('quill')

// var mediumEditor = require("medium-editor")
var trix = require('angular-trix')
var trixx = require('trix')
require('qtip')
module.exports = function(app) {

app.filter('showButtonOnce', function() {
Expand Down Expand Up @@ -35,16 +38,57 @@ module.exports = function(app) {

});


app.directive('qtip', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.qtip({
content: attrs.qtip,
style: {
classes: 'myRequestTooltipClass'
},
hide: {
event: (scope.closeButton == true ? "false" : "click mouseleave"),
delay: 0,
fixed: (($(this).hover || attrs.fixed) ? true : false), //prevent the tooltip from hiding when set to true
leave: false
}

});
},

};
});

app.controller("HelperResponse", ['$scope', '$rootScope', 'QuestionManager', 'Slider', 'RequestReplayer', function($scope, $rootScope, QuestionManager, Slider, RequestReplayer) {
$scope.hasReplay = false;
$scope.show = false;

debugger;
$scope.sliderInit = false;

var quill = new Quill(document.getElementsByClassName("annotation_bubble_lower")[0].getElementsByTagName("div"), {
theme: 'snow'
var quill = new Quill('#editor-container', {
modules: {toolbar: false},
theme: 'bubble',
readOnly: true
});
var answerLength = $scope.selectedObj.status.responses.length
var lastAnswerArray = $scope.selectedObj.status.responses[answerLength-1].answers
var needToInsertText;
_.each(lastAnswerArray, function(obj){
if(obj.hasOwnProperty('type') && obj.type == 'explanation')
needToInsertText = obj.value //explanation content
//need to extract context location etc.
})

quill.insertText(0, needToInsertText, {
'color': 'rgb(0, 0, 0)',
'underline': false
});
quill.formatText(1, 4, {
'color': 'rgb(0, 0, 255)',
'underline': true
});


atom.workspace.onDidStopChangingActivePaneItem(function() {
$scope.$evalAsync();
Expand Down
74 changes: 22 additions & 52 deletions lib/response/controllers/request.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,62 +30,36 @@ module.exports = function(app) {

$scope.openNewTabShowCodeDiff = function(answers) {
debugger;
if ($scope.button_value == "Code Diff") {
$scope.button_value = "Helper Code";
$scope.codeDiffLegend = true;
$scope.codeCommentLegend = false;
ResponseManager.showCodeDiff(answers);
} else {

//if not only annotation,
var onlyAnnotation = false;
_.every(answers, function(val, ind) {
if (val.type == 'inlinecode' && val.original == val.value) {
onlyAnnotation = true;
return false
}
return true;
});

if (!onlyAnnotation) {
// $scope.mergedAlready = false;
$scope.button_value = "Code Diff";
$scope.noInlineCode = false;
} else {
$scope.noInlineCode = true;
//if not only annotation,
var onlyAnnotation = false;
_.every(answers, function(val, ind) {
if (val.type == 'inlinecode' && val.original == val.value) {
onlyAnnotation = true;
return false
}
return true;
});

$scope.codeDiffLegend = false;
$scope.codeCommentLegend = true;
ResponseManager.showHelperCode(answers);
if (!onlyAnnotation) {
// $scope.mergedAlready = false;
$scope.noInlineCode = false;
} else {
$scope.noInlineCode = true;
}
}

$rootScope.$on('directlyShowHelper', function(devent, data) {
$scope.button_value = "Helper Code";
$scope.openNewTabShowCodeDiff(data);
})

$scope.openNewTabShowHelperCode = function(answers) {
$scope.codeDiffLegend = false;
$scope.codeCommentLegend = true;
ResponseManager.showHelperCode(answers);
ResponseManager.showCodeDiff(answers);
}

$scope.showContext = function(msg){
ResponseManager.getMsgContext();
console.log(msg);
$scope.openNewTabShowHelperCode = function(answers){
$scope.codeDiffLegend = true;
ResponseManager.showHelperCode(answers);
}

$scope.captureContext = function(){
console.log('works');
//activate context selection and a text box displaying along
console.log(ResponseManager.returnCodeContextAndMsg())
// get back something from ResponseManager

// push it to message window

}
$rootScope.$on('directlyShowHelper', function(devent, data) {
debugger
$scope.openNewTabShowHelperCode(data);
})

$scope.inlineCodeResponse = function(answer) {
ResponseManager.viewCodeDiff(answer, answer.showMerge);
Expand All @@ -99,12 +73,8 @@ module.exports = function(app) {
// ResponseManager.runOpenTabCode();
}

$scope.finalMergeVersion = function(answer) {
ResponseManager.mergeCode(answer);
}

$scope.showLocationWithinRequest = function(selectedObj) {

debugger
atom.workspace.open(selectedObj.changelog[1].path)
.then(function(editor) {
_.every(selectedObj.changelog, function(obj) {
Expand Down
Loading

0 comments on commit 5d9d23f

Please sign in to comment.