Skip to content

Commit

Permalink
Merge pull request #21 from TobiasSH/develop
Browse files Browse the repository at this point in the history
Develop into master, ezzy
  • Loading branch information
Thodnebo authored Mar 28, 2017
2 parents 8f3834d + bd87f4d commit 1abdf7e
Show file tree
Hide file tree
Showing 429 changed files with 57,055 additions and 136 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Kolab
The Kolab App

### Screenshots
<img src="/screenshots/student-view-2017-02-20.png" alt="alt text" width="250">
<img src="/screenshots/student-questions-2017-02-20.png" alt="alt text" width="250">
### [Screenshots](/screenshots/screenshots.md)

### Use npm to install all dependencies
1. Navigate to the folder you've placed the project in with terminal/cmd
2. Run: `npm install`

### Run the server
1. `cd` into the directory that contains the server.js file
Expand Down
30 changes: 21 additions & 9 deletions app/components/front/front.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
<div class="container vertical-center">
<div class="container horizontal-center">
<div class="vertical-center">
<div class="horizontal-center">
<h1>TDT4140 <p> Software Engineering</h1>
<table class="table">
<table class="table front-table">
<tbody>
<tr>
<td><a href="/student">
<button class="btn btn-info btn-lg btn-block bn-square">Student <p> View</button>
</a></td>
<td><a href="/lecturer">
<button class="btn btn-info btn-lg btn-block bn-square">Lecturer <p> View</button>
</a></td>
<td>
<a href="/student">
<button class="btn btn-lg btn-block bn-square btn-student">
<img class="front-button-icon" src="../../../assets/img/icons/student.svg" onerror="this.onerror=null; this.src='../../../assets/img/icons/student.png'">
<span style="display:block; height: 30px;"></span>
Student View
</button>
</a>
</td>
<td>
<a href="/lecturer">
<button class="btn btn-lg btn-block bn-square btn-lecturer">
<img class="front-button-icon" src="../../../assets/img/icons/lecturer.svg" onerror="this.onerror=null; this.src='../../../assets/img/icons/lecturer.png'">
<span style="display:block; height: 30px;"></span>
Lecturer View
</button>
</a>
</td>
</tr>
</tbody>
</table>
Expand Down
154 changes: 149 additions & 5 deletions app/components/lecturer/lecturer.controller.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,171 @@
kolabApp.controller('lecturerCtrl', ['$scope', '$http', function ($scope, $http) {
console.log("Hello World from controller");

var socket = io();
var max = 0;
var cantKeepUpHits;
var decreaseVolumeHits;
var increaseVolumeHits;
var decreaseSpeedHits;
var increaseSpeedHits;

// initial retrieval of questions from the database
var refresh = function () {
$http.get('/questionsCollection').then(function (response) {
console.log("I got the data I requested");
$scope.kolabDBScope = response.data;
$scope.question = null;
},

function (error) {
console.log("I got ERROR");
});
$http.get('/counters').then(function(response){
cantKeepUpHits = response.data[0].hits
decreaseVolumeHits = response.data[1].hits
increaseVolumeHits = response.data[2].hits
decreaseSpeedHits = response.data[3].hits
increaseSpeedHits = response.data[4].hits
})
};

refresh();

$scope.studentView = function () {
console.log("cantKeepUp button was clicked");
};
$scope.resetVotes = function() {
socket.emit('resetVotes');
console.log("votes reset")
}


// remove function bound to the delete buttons in lecture view
$scope.remove = function (index, id) {
console.log("This is the index of the question we're trying to delete: " +index+ "\n and this is the ID: "+id);
socket.emit('question delete', index, id);

$scope.remove = function (id) {
console.log(id);
$http.delete('/questionsCollection/' + id).then(function (response) {
refresh();
});
};

// socket message "question delete" and the response to that message
socket.on('question delete', function (index, id) {
console.log("Trying to delete message (SOCKET) with ID: " + id);
console.log("kolabDBScope object: ");

$scope.kolabDBScope.splice(index, 1);
$scope.$apply();
});

// socket message "question message" and the response to that message
socket.on('question message', function (msg) {
console.log('Trying to populate the table with questions with ID: ' + msg._id);
$scope.kolabDBScope.push(msg);
$scope.$apply();

});
socket.on('resetVotes', function(){
var cantKeepUpBar = document.getElementById("cantKeepUpBar");
var decreaseVolumeBar = document.getElementById("decreaseVolumeBar");
var increaseVolumeBar = document.getElementById("increaseVolumeBar");
var decreaseSpeedBar = document.getElementById("decreaseSpeedBar");
var increaseSpeedBar = document.getElementById("increaseSpeedBar");
cantKeepUpBar.style.width=0+'%';
decreaseVolumeBar.style.width=0+'%';
increaseVolumeBar.style.width=0+'%';
increaseSpeedBar.style.width=0+'%';
decreaseSpeedBar.style.width=0+'%';
cantKeepUpHits = 0
decreaseVolumeHits = 0
increaseVolumeHits = 0
decreaseSpeedHits = 0
increaseSpeedHits = 0

})
socket.on('incUser',function(){
max+=1;
console.log("more users")

})
socket.on('decUser',function(){
max-=1;

})
socket.on('cantKeepUp',function( hit){
cantKeepUpHits += hit;


console.log(cantKeepUpHits + "hit get on");
var percent = (cantKeepUpHits/(max))*100
console.log(percent +"%")
console.log(max+" users")
console.log(cantKeepUpHits + " hits")
console.log("cant keeep up lecture side");
var elem = document.getElementById("cantKeepUpBar");


elem.style.width=percent+'%';

});
socket.on('decreaseVolume', function(hit){
decreaseVolumeHits += hit;
console.log("decrease volume lecture side");

var percent = (decreaseVolumeHits/(max))*100
console.log(percent +"%")
console.log(max+" users")
console.log(decreaseVolumeHits + " hits")
console.log("decrease up lecture side");
var elem = document.getElementById("decreaseVolumeBar");


elem.style.width=percent+'%';
});
socket.on('increaseVolume', function(hit){
increaseVolumeHits += hit;
console.log("increaseses volumes lecture side");

var percent = (increaseVolumeHits/(max))*100
console.log(percent +"%")
console.log(max+" users")
console.log(increaseVolumeHits + " hits")
console.log("increase vol up lecture side");
var elem = document.getElementById("increaseVolumeBar");


elem.style.width=percent+'%';

});
socket.on('decreaseSpeed', function(hit){
decreaseSpeedHits += hit;
console.log("decerease speed lecture side");

var percent = (decreaseSpeedHits/(max))*100
console.log(percent +"%")
console.log(max+" users")
console.log(decreaseSpeedHits + " hits")
console.log("decrease speed lecture side");
var elem = document.getElementById("decreaseSpeedBar");


elem.style.width=percent+'%';


});
socket.on('increaseSpeed', function(hit){
increaseSpeedHits += hit;
console.log("incerease speed lecture side");

var percent = (increaseSpeedHits/(max))*100
console.log(percent +"%")
console.log(max+" users")
console.log(increaseSpeedHits + " hits")
console.log("increase speed lecture side");
var elem = document.getElementById("increaseSpeedBar");


elem.style.width=percent+'%';


});

}]);
85 changes: 65 additions & 20 deletions app/components/lecturer/lecturer.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,69 @@
<div class="container horizontal-center">
<h1>TDT4140 <p> Software Engineering</h1>
<h1>Questions</h1>
<div class="vertical-center">
<div class="horizontal-center">
<table class="title">
<tbody>
<tr>
<td width="90%">
<h1>TDT4140 <p> Software Engineering</h1>
</td>
<td width="10%">
<a href="/">
<button type="button" class="btn btn-lg btn-responsive btn-home">
<img class="home-button-icon" src="../../../assets/img/icons/chevron-right.svg" onerror="this.onerror=null; this.src='../../../assets/img/icons/chevron-right.png'">
</button>
</a>
</td>
</tr>
</tbody>
</table>
<span style="display:block; height: 20px;"></span>
<div class="progress">
<div id="cantKeepUpBar" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="40"
aria-valuemin="0" aria-valuemax="100" style="width:0%">
Cant Keep up
</div>
</div>
<div class="progress">
<div id="decreaseVolumeBar" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50"
aria-valuemin="0" aria-valuemax="100" style="width:0%">
Decrease Volume
</div>
</div>
<div class="progress">
<div id="increaseVolumeBar" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="60"
aria-valuemin="0" aria-valuemax="100" style="width:0%">
Increase Volume
</div>
</div>
<div class="progress">
<div id="decreaseSpeedBar" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="40"
aria-valuemin="0" aria-valuemax="100" style="width:0%">
Decrease Speed
</div>
</div>
<div class="progress">
<div id="increaseSpeedBar" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="70"
aria-valuemin="0" aria-valuemax="100" style="width:0%">
Increase Speed
</div>
</div>

<a href="/">
<button type="button" class="btn btn-primary">
Home
<button type="button" class="btn btn-primary" ng-click="resetVotes()">
Reset votes
</button>
</a>
<div class="container vertical-center">
<table class="table">
<tbody>
<tr ng-repeat="question in kolabDBScope" class="questionRows">
<!--<td>{{question.number}}</td>-->
<td class="td-question">{{question.text}}</td>
<td>
<button class="btn btn-danger btn-lg btn-block btn-remove" ng-click="remove(question._id)">Remove
</button>
</td>
</tr>
</tbody>
</table>
<span style="display:block; height: 20px;"></span>
<table id="lecturerTable" class="table lecturer-table">
<tbody>
<tr ng-repeat="question in kolabDBScope" class="questionRows">
<!--<td>{{question.number}}</td>-->
<td width="80%" class="td-question">{{question.text}}</td>
<td width="20%">
<button class="btn btn-lg btn-block btn-remove" ng-click="remove($index, question._id)">
<img class="lecturer-button-icon" src="../../../assets/img/icons/remove.svg" onerror="this.onerror=null; this.src='../../../assets/img/icons/remove.png'">
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
28 changes: 16 additions & 12 deletions app/components/menu/menu.controller.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
kolabApp.controller('menuCtrl', ['$scope', '$http', function ($scope, $http) {
console.log("Hello World from menu-controller");

var refresh = function () {
$http.get('/questionsCollection').then(function (response) {
console.log("I got the data I requested, menu-controller");
$scope.kolab = response.data;
$scope.question = null;
},
function (error) {
console.log("I got ERROR");
});
};

refresh();
var socket = io();

$scope.questions = function () {
console.log("questions button was clicked");

};






$scope.cantKeepUp = function () {
console.log("cantKeepUp button was clicked");



socket.emit('cantKeepUp')

};

$scope.decreaseVolume = function () {
console.log("decreaseVolume button was clicked");
socket.emit('decreaseVolume')
};

$scope.increaseVolume = function () {
console.log("increaseVolume button was clicked");
socket.emit('increaseVolume')
};

$scope.decreaseSpeed = function () {
console.log("decreaseSpeed button was clicked");
socket.emit('decreaseSpeed')
};

$scope.increaseSpeed = function () {
console.log("increaseSpeed button was clicked");
socket.emit('increaseSpeed')
};


Expand Down
Loading

0 comments on commit 1abdf7e

Please sign in to comment.