From 8b95f40cb626a7be629ee6da6e37ea389ceb379d Mon Sep 17 00:00:00 2001
From: prathamesh
Date: Fri, 27 Mar 2020 13:03:36 +0530
Subject: Add tests for R evaluator and codemirror R mode
---
yaksh/static/yaksh/js/codemirror/mode/r/index.html | 85 +++++++++++
yaksh/static/yaksh/js/codemirror/mode/r/r.js | 164 +++++++++++++++++++++
yaksh/static/yaksh/js/requesthandler.js | 3 +-
3 files changed, 251 insertions(+), 1 deletion(-)
create mode 100644 yaksh/static/yaksh/js/codemirror/mode/r/index.html
create mode 100644 yaksh/static/yaksh/js/codemirror/mode/r/r.js
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/js/codemirror/mode/r/index.html b/yaksh/static/yaksh/js/codemirror/mode/r/index.html
new file mode 100644
index 0000000..6dd9634
--- /dev/null
+++ b/yaksh/static/yaksh/js/codemirror/mode/r/index.html
@@ -0,0 +1,85 @@
+
+
+
CodeMirror: R mode
+
+
+
+
+
+
+
+
+
+
+R mode
+
+
+
+ MIME types defined: text/x-rsrc
.
+
+ Development of the CodeMirror R mode was kindly sponsored
+ by Ubalo.
+
+
diff --git a/yaksh/static/yaksh/js/codemirror/mode/r/r.js b/yaksh/static/yaksh/js/codemirror/mode/r/r.js
new file mode 100644
index 0000000..d41d1c5
--- /dev/null
+++ b/yaksh/static/yaksh/js/codemirror/mode/r/r.js
@@ -0,0 +1,164 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.registerHelper("wordChars", "r", /[\w.]/);
+
+CodeMirror.defineMode("r", function(config) {
+ function wordObj(str) {
+ var words = str.split(" "), res = {};
+ for (var i = 0; i < words.length; ++i) res[words[i]] = true;
+ return res;
+ }
+ var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
+ var builtins = wordObj("list quote bquote eval return call parse deparse");
+ var keywords = wordObj("if else repeat while function for in next break");
+ var blockkeywords = wordObj("if else repeat while function for");
+ var opChars = /[+\-*\/^<>=!&|~$:]/;
+ var curPunc;
+
+ function tokenBase(stream, state) {
+ curPunc = null;
+ var ch = stream.next();
+ if (ch == "#") {
+ stream.skipToEnd();
+ return "comment";
+ } else if (ch == "0" && stream.eat("x")) {
+ stream.eatWhile(/[\da-f]/i);
+ return "number";
+ } else if (ch == "." && stream.eat(/\d/)) {
+ stream.match(/\d*(?:e[+\-]?\d+)?/);
+ return "number";
+ } else if (/\d/.test(ch)) {
+ stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
+ return "number";
+ } else if (ch == "'" || ch == '"') {
+ state.tokenize = tokenString(ch);
+ return "string";
+ } else if (ch == "." && stream.match(/.[.\d]+/)) {
+ return "keyword";
+ } else if (/[\w\.]/.test(ch) && ch != "_") {
+ stream.eatWhile(/[\w\.]/);
+ var word = stream.current();
+ if (atoms.propertyIsEnumerable(word)) return "atom";
+ if (keywords.propertyIsEnumerable(word)) {
+ // Block keywords start new blocks, except 'else if', which only starts
+ // one new block for the 'if', no block for the 'else'.
+ if (blockkeywords.propertyIsEnumerable(word) &&
+ !stream.match(/\s*if(\s+|$)/, false))
+ curPunc = "block";
+ return "keyword";
+ }
+ if (builtins.propertyIsEnumerable(word)) return "builtin";
+ return "variable";
+ } else if (ch == "%") {
+ if (stream.skipTo("%")) stream.next();
+ return "variable-2";
+ } else if (ch == "<" && stream.eat("-")) {
+ return "arrow";
+ } else if (ch == "=" && state.ctx.argList) {
+ return "arg-is";
+ } else if (opChars.test(ch)) {
+ if (ch == "$") return "dollar";
+ stream.eatWhile(opChars);
+ return "operator";
+ } else if (/[\(\){}\[\];]/.test(ch)) {
+ curPunc = ch;
+ if (ch == ";") return "semi";
+ return null;
+ } else {
+ return null;
+ }
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ if (stream.eat("\\")) {
+ var ch = stream.next();
+ if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
+ else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
+ else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
+ else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
+ else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
+ return "string-2";
+ } else {
+ var next;
+ while ((next = stream.next()) != null) {
+ if (next == quote) { state.tokenize = tokenBase; break; }
+ if (next == "\\") { stream.backUp(1); break; }
+ }
+ return "string";
+ }
+ };
+ }
+
+ function push(state, type, stream) {
+ state.ctx = {type: type,
+ indent: state.indent,
+ align: null,
+ column: stream.column(),
+ prev: state.ctx};
+ }
+ function pop(state) {
+ state.indent = state.ctx.indent;
+ state.ctx = state.ctx.prev;
+ }
+
+ return {
+ startState: function() {
+ return {tokenize: tokenBase,
+ ctx: {type: "top",
+ indent: -config.indentUnit,
+ align: false},
+ indent: 0,
+ afterIdent: false};
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ if (state.ctx.align == null) state.ctx.align = false;
+ state.indent = stream.indentation();
+ }
+ if (stream.eatSpace()) return null;
+ var style = state.tokenize(stream, state);
+ if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
+
+ var ctype = state.ctx.type;
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
+ if (curPunc == "{") push(state, "}", stream);
+ else if (curPunc == "(") {
+ push(state, ")", stream);
+ if (state.afterIdent) state.ctx.argList = true;
+ }
+ else if (curPunc == "[") push(state, "]", stream);
+ else if (curPunc == "block") push(state, "block", stream);
+ else if (curPunc == ctype) pop(state);
+ state.afterIdent = style == "variable" || style == "keyword";
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize != tokenBase) return 0;
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
+ closing = firstChar == ctx.type;
+ if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+ else return ctx.indent + (closing ? 0 : config.indentUnit);
+ },
+
+ lineComment: "#"
+ };
+});
+
+CodeMirror.defineMIME("text/x-rsrc", "r");
+
+});
diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js
index 7ccdef0..80b67fb 100644
--- a/yaksh/static/yaksh/js/requesthandler.js
+++ b/yaksh/static/yaksh/js/requesthandler.js
@@ -160,7 +160,8 @@ $(document).ready(function(){
'cpp': 'text/x-c++src',
'java': 'text/x-java',
'bash': 'text/x-sh',
- 'scilab': 'text/x-csrc'
+ 'scilab': 'text/x-csrc',
+ 'r':'text/x-rsrc',
}
// Code mirror Options
--
cgit
From 8007fa364ce894a879f72d72c104e7fe49e7154f Mon Sep 17 00:00:00 2001
From: adityacp
Date: Mon, 30 Mar 2020 16:03:02 +0530
Subject: Change templates, js, views
- Show module name in design module page
- Fix tooltip in design course and design module page
- Change order of sidebar menu in course detail page
---
yaksh/static/yaksh/js/design_course.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/js/design_course.js b/yaksh/static/yaksh/js/design_course.js
index dbff9fd..4e2dc9d 100644
--- a/yaksh/static/yaksh/js/design_course.js
+++ b/yaksh/static/yaksh/js/design_course.js
@@ -20,7 +20,11 @@ $(document).ready(function(){
$(this).append('');
return true;
});
- var msg = "Check Prerequisite is set to Yes by default \n" +
- "To change, select the Change checkbox and Click Change Prerequisite button \n";
- $("#prereq_msg").attr("title", msg);
+ var completion_msg = "This will check if the previous module is completed " +
+ "before viewing the next module."
+ $("#prereq_msg").attr("title", completion_msg);
+ $("#prereq_msg").tooltip();
+ var completion_msg = "This will check if the previous module is completed " +
+ "before viewing the next module based on quiz passing status."
+ $("#prereq_passing_msg").attr("title", completion_msg);
});
\ No newline at end of file
--
cgit
From ce3eb1dbbd924003489d01f4e98aba841cd803c0 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Wed, 8 Apr 2020 15:55:59 +0530
Subject: Change templates, views, forms, models
- Allow to test, download and delete single question
- Fix pagination for searching and filtering questions
---
yaksh/static/yaksh/js/question_filter.js | 47 --------------------------------
yaksh/static/yaksh/js/show_question.js | 17 ++++++++++--
2 files changed, 14 insertions(+), 50 deletions(-)
delete mode 100644 yaksh/static/yaksh/js/question_filter.js
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/js/question_filter.js b/yaksh/static/yaksh/js/question_filter.js
deleted file mode 100644
index aa3a229..0000000
--- a/yaksh/static/yaksh/js/question_filter.js
+++ /dev/null
@@ -1,47 +0,0 @@
-$(document).ready(function(){
- $question_type = $("#id_question_type");
- $marks = $("#id_marks");
- $language = $("#id_language");
-
- function question_filter() {
- $.ajax({
- url: "/exam/ajax/questions/filter/",
- type: "POST",
- data: {
- question_type: $question_type.val(),
- marks: $marks.val(),
- language: $language.val()
- },
- dataType: "html",
- success: function(output) {
- var questions = $(output).filter("#questions").html();
- $("#filtered-questions").html(questions);
- }
- });
- }
-
- $question_type.change(function() {
- question_filter()
- });
-
- $language.change(function() {
- question_filter()
- });
-
- $marks.change(function() {
- question_filter()
- });
-
- $("#checkall").change(function(){
- if($(this).prop("checked")) {
- $("#filtered-questions input:checkbox").each(function(index, element) {
- $(this).prop('checked', true);
- });
- }
- else {
- $("#filtered-questions input:checkbox").each(function(index, element) {
- $(this).prop('checked', false);
- });
- }
- });
-});
\ No newline at end of file
diff --git a/yaksh/static/yaksh/js/show_question.js b/yaksh/static/yaksh/js/show_question.js
index e6825a0..d7b6a44 100644
--- a/yaksh/static/yaksh/js/show_question.js
+++ b/yaksh/static/yaksh/js/show_question.js
@@ -47,7 +47,18 @@ function append_tag(tag){
tag_name.value = tag.value;
}
}
-$(document).ready(function()
- {
- $("#questions-table").tablesorter({sortList: [[0,0], [4,0]]});
+$(document).ready(function() {
+ $("#questions-table").tablesorter({});
+ $("#checkall").change(function(){
+ if($(this).prop("checked")) {
+ $("#filtered-questions input:checkbox").each(function(index, element) {
+ $(this).prop('checked', true);
+ });
+ }
+ else {
+ $("#filtered-questions input:checkbox").each(function(index, element) {
+ $(this).prop('checked', false);
+ });
+ }
});
+});
--
cgit
From 0e6c7d589114450d5cd1bc581ee1692c235f1a73 Mon Sep 17 00:00:00 2001
From: CruiseDevice
Date: Mon, 13 Apr 2020 16:45:42 +0530
Subject: Add feature for uploading images
---
yaksh/static/yaksh/css/custom.css | 9 +++++++++
1 file changed, 9 insertions(+)
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index 63ee455..d6b9bdc 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -97,3 +97,12 @@ body, .dropdown-menu {
min-height: 100vh;
transition: all 0.3s;
}
+
+/* ---------------------------------------------------
+ Forum STYLE
+----------------------------------------------------- */
+
+.comment_image {
+ width: 350px;
+ height: 350px;
+}
\ No newline at end of file
--
cgit
From 169228186d8c9ad880ee33c5190e49203d2c5243 Mon Sep 17 00:00:00 2001
From: CruiseDevice
Date: Wed, 15 Apr 2020 21:19:09 +0530
Subject: Resolve comments
- Fix "'image' attribute has no file associated with it" issue.
- Don't allow users who are not part of a course to see the discussion
forum of that course.
- Add Discussion forum link in moderator interface under course_details
page.
- Remove custom css for post and comments in Discussion forum. Use
bootstrap 'img-fluid' class instead. 'img-fluid' fills the height and
width of the card.
- Use instance.uid instead of just instance in get_image_dir.
---
yaksh/static/yaksh/css/custom.css | 9 ---------
1 file changed, 9 deletions(-)
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index d6b9bdc..63ee455 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -97,12 +97,3 @@ body, .dropdown-menu {
min-height: 100vh;
transition: all 0.3s;
}
-
-/* ---------------------------------------------------
- Forum STYLE
------------------------------------------------------ */
-
-.comment_image {
- width: 350px;
- height: 350px;
-}
\ No newline at end of file
--
cgit
From eb9f6cb240268735e08ebc2a6d26d88c7e5097f7 Mon Sep 17 00:00:00 2001
From: CruiseDevice
Date: Wed, 15 Apr 2020 22:15:53 +0530
Subject: Improve UI slightly
---
yaksh/static/yaksh/css/custom.css | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index 63ee455..299f5d3 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -97,3 +97,15 @@ body, .dropdown-menu {
min-height: 100vh;
transition: all 0.3s;
}
+
+/* ---------------------------------------------------
+ FORUM STYLE
+----------------------------------------------------- */
+
+.brown-light {
+ background: #f4a460;
+ padding-left: 0.3em;
+ padding-right: 0.3em;
+ padding-top: 0.2em;
+ padding-bottom: 0.2em;
+}
\ No newline at end of file
--
cgit
From d018db505471226bba8a2e031782676b646396c0 Mon Sep 17 00:00:00 2001
From: CruiseDevice
Date: Thu, 16 Apr 2020 15:11:21 +0530
Subject: Set post_image, comment_image height, width to 50%
- img-fluid took more space of a card than required. Made it hard
to read the remaining description in a forum.
---
yaksh/static/yaksh/css/custom.css | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index 299f5d3..6687c4b 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -108,4 +108,9 @@ body, .dropdown-menu {
padding-right: 0.3em;
padding-top: 0.2em;
padding-bottom: 0.2em;
+}
+
+.post_image, .comment_image {
+ width: 50%;
+ height: 50%;
}
\ No newline at end of file
--
cgit
From 536b4634eb275332d2932983e451b85809554438 Mon Sep 17 00:00:00 2001
From: CruiseDevice
Date: Fri, 24 Apr 2020 20:46:53 +0530
Subject: Improve post comments UI
---
yaksh/static/yaksh/css/custom.css | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'yaksh/static')
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index 6687c4b..3979e3e 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -113,4 +113,8 @@ body, .dropdown-menu {
.post_image, .comment_image {
width: 50%;
height: 50%;
+}
+
+.description {
+ font-size: 16px;
}
\ No newline at end of file
--
cgit