89 lines
3 KiB
HTML
89 lines
3 KiB
HTML
<div class="page-header">
|
|
<h1>Problem Editor</h1>
|
|
</div>
|
|
|
|
<style>
|
|
.ace_editor {
|
|
width: 100%;
|
|
height: 200px;
|
|
}
|
|
.epiceditor-edit-mode {
|
|
border: 1px solid #999 !important;
|
|
}
|
|
</style>
|
|
|
|
<div class="row">
|
|
<div class="tabbable">
|
|
<ul class="nav nav-pills nav-stacked col-md-3">
|
|
<li class="active"><a data-target="#new" data-toggle="tab">New</a></li>
|
|
<li ng-repeat="problem in problems"><a data-target="#problem_{{ problem['pid'] }}" data-toggle="tab">{{ problem["title"] }} ({{ problem["value"] }} points)</a></li>
|
|
</ul>
|
|
<div class="tab-content col-md-9">
|
|
<div class="tab-pane active" id="new">
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">New Problem</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div id="add-status"></div>
|
|
<form class="form-horizontal" onsubmit="create_problem(); return false;" id="new_problem_form">
|
|
<input class="form-control" name="name" placeholder="Name" required/>
|
|
<br>
|
|
<textarea class="form-control" name="description" placeholder="Description" required autocomplete="off"/>
|
|
<br>
|
|
<input class="form-control" name="category" placeholder="Category" required autocomplete="off"/>
|
|
<br>
|
|
<input class="form-control" name="hint" placeholder="Hint" required/>
|
|
<br>
|
|
<input class="form-control" name="value" type="number" placeholder="Problem Value" required autocomplete="off"/>
|
|
<br>
|
|
<input class="form-control" name="flag" placeholder="Flag" required/>
|
|
<br>
|
|
<div id="new_grader"></div>
|
|
<br>
|
|
<input type="submit" id="create-problem" class="btn btn-success" value="Create"/>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="tab-pane" ng-repeat="problem in problems" id="problem_{{ problem['pid'] }}">
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">{{ problem["title"] }}</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$(".selectpicker").selectpicker();
|
|
var config = {
|
|
toolbar: [
|
|
{ name: "basicstyles", items: [ "Bold", "Italic", "Underline" ] },
|
|
{ name: "links", items: [ "Link" ] },
|
|
{ name: "paragraph", items: [ "NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote" ] },
|
|
{ name: "tools", items: [ "Maximize" ] },
|
|
{ name: "document", items: [ "Source" ] },
|
|
]
|
|
};
|
|
var editor = new EpicEditor({
|
|
container: "new_grader",
|
|
theme: {
|
|
base: "https://cdnjs.cloudflare.com/ajax/libs/epiceditor/0.2.2/themes/base/epiceditor.css",
|
|
preview: "https://cdnjs.cloudflare.com/ajax/libs/epiceditor/0.2.2/themes/preview/github.css",
|
|
editor: "https://cdnjs.cloudflare.com/ajax/libs/epiceditor/0.2.2/themes/editor/epic-light.css"
|
|
},
|
|
button: {
|
|
bar: "show"
|
|
}
|
|
}).load();
|
|
var new_grader = ace.edit("new_grader");
|
|
new_grader.setTheme("ace/theme/tomorrow");
|
|
new_grader.getSession().setMode("ace/mode/python");
|
|
});
|
|
</script>
|