Skip to content

Commit

Permalink
big style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
soney committed Mar 5, 2016
1 parent 90d0615 commit 744b35e
Show file tree
Hide file tree
Showing 10 changed files with 376 additions and 270 deletions.
2 changes: 1 addition & 1 deletion index.less
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import "styles/responses";
@import "styles/recording-bar";
@import "styles/recording-bar";
118 changes: 29 additions & 89 deletions lib/response/controllers/helper_response.controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = function(app){

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

Expand All @@ -24,93 +24,6 @@ app.controller("HelperResponse", ['$scope','$rootScope',function ($scope,$rootSc
$scope.$evalAsync();
});

var initSlider = function( id, SLIDER_UPDATE_RESOLUTION){
console.log("initSlider started");

var slider = $('.livewriting_slider').slider({
min: 0.0,
max:SLIDER_UPDATE_RESOLUTION,
slide: function(event, ui){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
editor.sliderEventHandler(event, ui);
}
});


$( "#lw_toolbar_beginning" + id ).button({
text: false,
icons: {
primary: "ui-icon-seek-start"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
editor.sliderGoToBeginning();
});

$( "#lw_toolbar_slower" + id).button({
text: false,
icons: {
primary: "ui-icon-minusthick"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
var sliderValue = $("#livewriting_slider"+ id).slider("value");
editor.halfTheSpeed(sliderValue);
$("#livewriting_speed"+ id).text(editor.lw_playback);
});

$( "#lw_toolbar_play"+ id ).button({
text: false,
icons: {
primary: "ui-icon-pause"
},
click:null
})
.click(function() {
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
if ( $( this ).text() === "pause" ) {
editor.livewritingPause();
} else {
editor.livewritingResume();
}
});
$( "#lw_toolbar_faster" + id).button({
text: false,
icons: {
primary: "ui-icon-plusthick"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
var sliderValue = $("#livewriting_slider"+ editor.lw_slider_suffix).slider("value");
editor.doubleTheSpeed(sliderValue);
$("#livewriting_speed"+ id).text(editor.lw_playback);
});
$( "#lw_toolbar_end"+ id ).button({
text: false,
icons: {
primary: "ui-icon-seek-end"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
editor.sliderGoToEnd();
});
}
$scope.showSlider = function(slider_id){
var editor = atom.workspace.getActiveTextEditor();
if (slider_id == editor.lw_slider_suffix)
Expand All @@ -132,13 +45,40 @@ app.controller("HelperResponse", ['$scope','$rootScope',function ($scope,$rootSc
editor.lw_slider_suffix = slider_id;
}
if(!$scope.sliderInit){
initSlider(slider_id, editor.SLIDER_UPDATE_RESOLUTION); // we need to initiate slider only one time.
Slider.initSlider(editor, slider_id, editor.SLIDER_UPDATE_RESOLUTION); // we need to initiate slider only one time.
$scope.sliderInit = true;
}
editor.sliderGoToBeginning();
});
});
};
$scope.nah = function(obj){
$scope.isRejecting = !$scope.isRejecting;
};

$scope.merge = function(msg) {
QuestionManager.markResolved($scope.selectedObj.question_id);
};




// send out the iteration message
$scope.iterate = function(msg) {
QuestionManager.sendIterationRequest($scope.selectedObj.question_id, msg);

$scope.inputs.iterationMsg = "";
$scope.isRejecting = false;

/*
$scope.$apply(function() {
// $scope.myArr[key].status = "Status: Solved!";
value.status = "Status: Unsolved!";
angular.element(document.getElementById(response.id)).css('background-color','white')
})
*/

}

}]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,11 @@ $ = require("jquery");

module.exports = function(app){

app.controller("ShowRequest", ['$scope','$rootScope','QuestionManager',function ($scope,$rootScope,QuestionManager) {
app.controller("RequestController", ['$scope','$rootScope','QuestionManager',function ($scope,$rootScope,QuestionManager) {

console.log("testing");
$scope.showTips = "Show me";
$scope.showTips = "Show code difference";
$scope.nah = function(obj){
$rootScope.isRejecting = !$rootScope.isRejecting;
};

$scope.merge = function(msg) {
QuestionManager.markResolved($scope.selectedObj.question_id);
};




// send out the iteration message
$scope.iterate = function(msg) {
QuestionManager.sendIterationRequest($scope.selectedObj.question_id, msg);

$scope.inputs.iterationMsg = "";
$rootScope.isRejecting = false;

/*
$scope.$apply(function() {
// $scope.myArr[key].status = "Status: Solved!";
value.status = "Status: Unsolved!";
angular.element(document.getElementById(response.id)).css('background-color','white')
})
*/

}

//show each sub-response within one response if there are some
$scope.subResponseClick = function(response){
Expand Down
6 changes: 3 additions & 3 deletions lib/response/controllers/response_panel.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var _ = require('underscore');
module.exports = function(app) {
app.controller("ResponsePanelController", ['$scope','$rootScope','$timeout', 'QuestionManager', function ($scope,$rootScope,$timeout,QuestionManager) {

$scope.title = "Response List";
$scope.title = "CoDemand Requests";
$scope.resList = true;
$scope.responseContent = false;

Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = function(app) {


$scope.titleClick = function(title){
$scope.title = "Response List";
$scope.title = "CoDemand Requests";
$scope.resList = true;
$rootScope.isRejecting = false;
$scope.responseContent = false;
Expand All @@ -100,7 +100,7 @@ module.exports = function(app) {

$scope.resList = false;
$scope.responseContent = true;
$scope.title = "Click here to go back to response list";
$scope.title = "Requests";
$rootScope.isRejecting = false;
$scope.selectedObj = obj;
}
Expand Down
8 changes: 5 additions & 3 deletions lib/response/responseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var $ = require('jquery'),
angular_route = require('angular-route'),
_ = require('underscore'),
angular_animate = require('angular-animate'),
angular_moment = require('angular-moment'),
less = require('less'),
helpers = require('atom-helpers'),
pfs = require('../utils/promised_fs'),
Expand All @@ -19,12 +20,13 @@ function ResponseView(isEnabled) {
item: this.element
});

this.app = angular.module('codemand_response', []);
this.app = angular.module('codemand_response', ['angularMoment']);

require('./controllers/helper_response.controller')(this.app);
require('./controllers/response_panel.controller')(this.app);
require('./controllers/response.controller')(this.app);
require('./controllers/request.controller')(this.app);
require('./services/question_manager')(this.app);
require('./services/slider')(this.app);

pfs.readFile(path.join(__dirname, 'views', 'response_panel.view.html'), 'utf8').then(_.bind(function(contents) {

Expand All @@ -37,7 +39,7 @@ function ResponseView(isEnabled) {
console.error(err);
});

this.enable(isEnabled);
this.enable(true);
}

(function(My) {
Expand Down
97 changes: 97 additions & 0 deletions lib/response/services/slider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
var client = require('socket.io-client');
var prefs = require('../../utils/user_preferences');
var _ = require('underscore')

module.exports = function(app) {
app.factory('Slider', ['$http', '$q', '$rootScope', function ($http, $q, $rootScope) {
return {
initSlider: function( editor, id, SLIDER_UPDATE_RESOLUTION){
console.log("initSlider started");

var slider = $('.livewriting_slider').slider({
min: 0.0,
max:SLIDER_UPDATE_RESOLUTION,
slide: function(event, ui){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
editor.sliderEventHandler(event, ui);
}
});


$( "#lw_toolbar_beginning" + id ).button({
text: false,
icons: {
primary: "ui-icon-seek-start"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
editor.sliderGoToBeginning();
});

$( "#lw_toolbar_slower" + id).button({
text: false,
icons: {
primary: "ui-icon-minusthick"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
var sliderValue = $("#livewriting_slider"+ id).slider("value");
editor.halfTheSpeed(sliderValue);
$("#livewriting_speed"+ id).text(editor.lw_playback);
});

$( "#lw_toolbar_play"+ id ).button({
text: false,
icons: {
primary: "ui-icon-pause"
},
click:null
})
.click(function() {
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
if ( $( this ).text() === "pause" ) {
editor.livewritingPause();
} else {
editor.livewritingResume();
}
});
$( "#lw_toolbar_faster" + id).button({
text: false,
icons: {
primary: "ui-icon-plusthick"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
var sliderValue = $("#livewriting_slider"+ editor.lw_slider_suffix).slider("value");
editor.doubleTheSpeed(sliderValue);
$("#livewriting_speed"+ id).text(editor.lw_playback);
});
$( "#lw_toolbar_end"+ id ).button({
text: false,
icons: {
primary: "ui-icon-seek-end"
},
click:null
}).click(function(){
var editor = atom.workspace.getActiveTextEditor();
if (id != editor.lw_slider_suffix)
return;
editor.sliderGoToEnd();
});
}
};
}]);
};
Loading

0 comments on commit 744b35e

Please sign in to comment.