Show requests for comments and begin work on a view for executing them

This commit is contained in:
Felix Wolff
2015-03-27 18:10:47 +01:00
parent de154a6f66
commit b8ec3edef2
15 changed files with 241 additions and 10 deletions

View File

@@ -318,7 +318,7 @@ $(function() {
commentModal.find('#removeAllButton').off('click')
commentModal.find('#addCommentButton').on('click', function(e){
var user_id = 18
var user_id = element.data('user-id')
var commenttext = commentModal.find('textarea').val()
if (commenttext !== "") {
@@ -328,7 +328,7 @@ $(function() {
})
commentModal.find('#removeAllButton').on('click', function(e){
var user_id = 18;
var user_id = element.data('user-id')
deleteComment(user_id,file_id,row,editor);
commentModal.modal('hide')
})
@@ -351,10 +351,7 @@ $(function() {
}
var setAnnotations = function (editor, file_id){
var session = editor.getSession();
// Retrieve comments for file and set them as annotations
var session = editor.getSession()
var url = "/comments";
var jqrequest = $.ajax({
@@ -439,7 +436,7 @@ $(function() {
url: '/comments',
data: {
id: annotation.id,
user_id: 18,
user_id: $('#editor').data('user-id'),
comment: {
row: annotation.row,
text: annotation.text
@@ -475,6 +472,7 @@ $(function() {
$('#create-file').on('click', showFileDialog);
$('#destroy-file').on('click', confirmDestroy);
$('#download').on('click', downloadCode);
$('#request-for-comments').on('click', requestComments)
};
var initializeTooltips = function() {
@@ -833,6 +831,29 @@ $(function() {
$('#test').toggle(isActiveFileTestable());
};
var requestComments = function(e) {
var user_id = $('#editor').data('user-id')
var exercise_id = $('#editor').data('exercise-id')
var file_id = $('.editor').data('file-id')
$.ajax({
method: 'POST',
url: '/request_for_comments',
data: {
request_for_comment: {
requestorid: user_id,
exerciseid: exercise_id,
fileid: file_id,
"requested_at(1i)": 2015,
"requested_at(2i)":3,
"requested_at(3i)":27,
"requested_at(4i)":17,
"requested_at(5i)":06
}
}
})
}
if ($('#editor').isPresent()) {
if (isBrowserSupported()) {
$('.score, #development-environment').show();

View File

@@ -0,0 +1,69 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}
a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}
div {
&.field, &.actions {
margin-bottom: 10px;
}
}
#notice {
color: green;
}
.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}
#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}