增加已经写好的 admin 的模板

This commit is contained in:
virusdefender 2015-08-02 09:47:50 +08:00
parent 64f31a61be
commit 8b058a3785
12 changed files with 391 additions and 68 deletions

View File

@ -31,8 +31,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'hzfp^8mbgapc&x%$#xv)0=t8s7_ilingw(q3!@h&2fty6v6fxz'
ALLOWED_HOSTS = []
@ -103,7 +101,7 @@ USE_TZ = True
STATIC_URL = '/static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/release/"),)
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/src/"),)
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, "template"),

View File

@ -6,12 +6,14 @@ from django.views.generic import TemplateView
from account.views import UserLoginAPIView
urlpatterns = [
url("^$", TemplateView.as_view(template_name="utils/index.html"), name="index_page"),
url(r'^docs/', include('rest_framework_swagger.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/$', TemplateView.as_view(template_name="admin/index.html"), name="admin_index_page"),
url(r'^login/$', TemplateView.as_view(template_name="account/login.html"), name="user_login_page"),
url(r'^api/login/$', UserLoginAPIView.as_view(), name="login_api"),
url(r'^api/login/$', UserLoginAPIView.as_view(), name="user_login_api"),
url(r'^problem/(?P<problem_id>\d+)/$', "problem.views.problem_page", name="problem_page"),
url(r'^admin/contest/$', TemplateView.as_view(template_name="admin/add_contest.html"), name="add_contest_page"),
]

25
static/src/css/admin.css Normal file
View File

@ -0,0 +1,25 @@
@import url("bootstrap/bootstrap.min.css");
@import url("bootstrap/todc-bootstrap.min.css");
@import url("codeMirror/codemirror.css");
@import url("simditor/simditor.css");
@import url("webuploader/webuploader.css");
@import url("datetime_picker/bootstrap-datetimepicker.css");
html, body {
height: 100%;
}
img {
max-width: 100%;
height: auto;
}
.footer {
padding-top: 30px;
padding-bottom: 30px;
float: bottom;
bottom: 0;
}
label {
font-size: 16px;
}

View File

@ -29,8 +29,6 @@ label {
padding-top: 15px;
}
#loading {
display: none;
}
@ -40,53 +38,6 @@ label {
height: 300px;
}
.glyphicon-refresh-animate {
-animation: spin .9s infinite linear;
-webkit-animation: spin2 .9s infinite linear;
}
@-webkit-keyframes spin2 {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@keyframes spin {
from {
transform: scale(1) rotate(0deg);
}
to {
transform: scale(1) rotate(360deg);
}
}
.callout {
padding: 5px;
margin: 20px 0;
border: 1px solid #eee;
border-left-width: 5px;
border-radius: 3px;
}
.callout-danger {
border-left-color: #dd4b39;
}
.callout-info {
border-left-color: #d0e3f0;
}
.callout-warning {
border-left-color: #f1e7bc;
}
.callout p {
font-size: 16px;;
}
.problem-section {
padding-top: 5px;
padding-bottom: 5px;

View File

@ -1,5 +1,5 @@
define(["jquery", "avalon", "editor", "uploader", "datetime_picker",
"validation", "dropdown"
require(["jquery", "avalon", "editor", "uploader", "datetimepicker",
"validation"
],
function ($, avalon, editor, uploader) {
$("#add-contest-form")
@ -102,7 +102,6 @@ define(["jquery", "avalon", "editor", "uploader", "datetime_picker",
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
var editor1 = editor("#editor");
var vm = avalon.define({

View File

@ -16,7 +16,6 @@ var require = {
"bs_alert": "utils/bs_alert",
submit_code: "app/problem/submit_code",
//formValidation 不要在代码中单独使用而是使用和修改utils/validation
base: "lib/formValidation/base",
helper: "lib/formValidation/helper",
@ -39,10 +38,16 @@ var require = {
code_mirror_clang: "lib/codeMirror/language/clike",
//bootstrap
bootstrap: "lib/bootstrap/bootstrap"
bootstrap: "lib/bootstrap/bootstrap",
//
"_datetimepicker": "lib/datetime_picker/bootstrap-datetimepicker",
"datetimepicker": "lib/datetime_picker/bootstrap-datetimepicker.zh-CN"
},
shim: {
"bootstrap": {"deps": ['jquery']}
"bootstrap": {"deps": ['jquery']},
"_datetimepicker": {"deps": ["jquery"]},
"datetimepicker": {"deps": ["_datetimepicker"]}
}
};

View File

@ -0,0 +1,183 @@
{% extends "admin_base.html" %}
{% block body %}
{% verbatim %}
<div ms-controller="add_contest">
<form id="add-contest-form">
<div class="col-md-9">
<div class="col-md-12">
<label>比赛题目</label>
</div>
<div class="col-md-12">
<div class="form-group">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="col-md-12">
<label>说明</label>
</div>
<div class="col-md-12">
<div class="form-group">
<textarea id="editor" placeholder="这里输入内容" autofocus></textarea>
</div>
</div>
<div class="col-md-6">
<label>开始时间</label>
</div>
<div class="col-md-6">
<label>结束时间</label>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" class="form-control" name="start_time" id="contest_start_time">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" class="form-control" name="end_time" id="contest_end_time">
</div>
</div>
<div class="col-md-6">
<label>
密码保护
</label>
</div>
<div class="col-md-3">
<label>
模式
</label>
</div>
<div class="col-md-3">
<label>
结束前是否开放排名
</label>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" class="form-control" name="password" placeholder="留空就是公开赛">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<input type="radio" name="mode">OI
<input type="radio" name="mode">ACM
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<input type="checkbox" value="open_rank">开放排名
</div>
</div>
<div class="col-md-12">
<label>添加题目</label>
<a href="javascript:void(0)" class="btn btn-primary btn-sm" ms-click="add_problem()">添加</a>
</div>
<div class="col-md-12">
<div class="problem" ms-repeat-problem="problems">
<div class="panel panel-default problem-panel" ms-attr-id="problem-{{ problem.id }}">
<div class="panel-heading">
<span class="panel-title">题目{{$index + 1}} </span>
<a href="javascript:void(0)" class="btn btn-primary btn-sm"
ms-click="toggle_problem(problem)">
{{ problem.toggle_string }}
</a>
<a href="javascript:void(0)" class="btn btn-danger btn-sm"
ms-click="del_problem(problem)">
删除
</a>
</div>
<div class="panel-body" ms-attr-id="problem-{{ problem.id }}-body">
<div class="col-md-12">
<label>题目</label>
</div>
<div class="col-md-12">
<div class="form-group">
<input type="text" name="problem_name[]" class="form-control">
</div>
</div>
<div class="col-md-6">
<label>cpu</label>
</div>
<div class="col-md-6">
<label>内存</label>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="cpu[]" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="memory[]" class="form-control">
</div>
</div>
<div class="col-md-12">
<label>样例</label>
<a href="javascript:void(0)" class="btn btn-primary btn-sm"
ms-click="add_sample(problem)">
添加
</a>
<div class="sample">
<div class="panel panel-default sample-panel"
ms-repeat-sample="problem.samples">
<div class="panel-heading">
<span class="panel-title">样例{{$index + 1}}</span>
<a href="javascript:void(0)" class="btn btn-primary btn-sm"
ms-click="toggle_sample(problem, sample)">
{{ sample.toggle_string }}
</a>
<a href="javascript:void(0)" class="btn btn-danger btn-sm"
ms-click="del_sample(problem, sample)">
删除
</a>
</div>
<div class="panel-body"
ms-attr-id="problem-{{ problem.id }}-sampleio-{{ sample.id }}-body">
<div class="col-md-12">
<label>样例输入</label>
</div>
<div class="col-md-12">
<div class="form-group">
<textarea class="form-control" rows="5"></textarea>
</div>
</div>
<div class="col-md-12">
<label>样例输出</label>
</div>
<div class="col-md-12">
<div class="form-group">
<textarea class="form-control" rows="5"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<label>测试数据</label>
</div>
<div class="col-md-12">
<div class="form-group">
<div ms-attr-id="problem-{{ problem.id }}-uploader">选择文件</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
{% endverbatim %}
{% endblock %}

View File

@ -0,0 +1,4 @@
{% extends "admin_base.html" %}
{% block body %}
Hello world
{% endblock %}

View File

@ -1,10 +1,116 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<title>在线评测系统 - 后台管理</title>
<!-- custom css begin -->
{% block css_block %}{% endblock %}
<!-- custom css end -->
<!-- global css begin -->
<link href="/static/css/admin.css" rel="stylesheet">
<!-- global css end -->
</head>
<body>
<!-- nav begin -->
<nav class="navbar navbar-masthead navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">qduoj admin</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">主页</a></li>
<li><a href="#about">题目</a></li>
<li><a href="#contact">提交</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">
李扬
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">我的提交</a></li>
<li><a href="#">我的资料</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">退出</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- nav end -->
<!--browser happy begin -->
<!--[if lt IE 9]>
<div class="alert alert-danger text-center" role="alert">
当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>.
</div>
<![endif]-->
<!-- browser happy end -->
<div class="container">
<div class="row">
<!-- admin left begin-->
<div class="col-md-2">
<ul class="list-group">
<li class="list-group-header">List header</li>
<li class="list-group-item active"><a href="#">Home</a></li>
<li class="list-group-item"><a href="#">Library</a></li>
<li class="list-group-item"><a href="#">Applications</a></li>
<li class="list-group-header">Another list header</li>
<li class="list-group-item"><a href="#">Help</a></li>
</ul>
</div>
<!-- admin left end -->
<!-- custom body begin -->
{% block body %}{% endblock %}
<!-- custom body end -->
</div>
</div>
<div class="modal fade" id="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title">提示</h4>
</div>
<div class="modal-body">
<p id="modal-text"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<script src="/static/js/config.js"></script>
<script src="/static/js/require.js" data-main="/static/js/app/admin.js"></script>
<!-- footer begin -->
<div class="footer">
<p class="text-muted text-center">Copyright © 2015 青岛大学信息工程学院 创新实验室</p>
</div>
<!-- footer end -->
</body>
</html>

View File

@ -0,0 +1,15 @@
{% extends "oj_base.html" %}
{% block body %}
<div class="container">
<ul class="nav nav-tabs nav-tabs-google">
<li role="presentation" class="active">
<a href="problem.html">题目</a></li>
<li role="presentation"><a href="my_solutions_list.html">我的提交</a></li>
<li role="presentation"><a href="#">排名</a></li>
</ul>
<h2 class="text-center">第一次比赛</h2>
<p class="text-muted text-center"><b>开始时间:</b> 2015-6-8 19:00 <b>结束时间:</b> 2015-9-1 12:00</p>
</div>
{% endblock %}

View File

@ -26,7 +26,6 @@
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -46,11 +45,9 @@
李扬
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">我的资料</a></li>
<li><a href="#">设置</a></li>
<li><a href="#">我的提交</a></li>
<li><a href="#">我的资料</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">修改密码</li>
<li><a href="#">退出</a></li>
</ul>
</li>
@ -70,6 +67,8 @@
<!-- custom body begin -->
{% block body %}{% endblock %}
<!-- custom body end -->
<div class="modal fade" id="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
@ -88,7 +87,6 @@
</div>
</div>
<!-- custom body end -->
<script src="/static/js/config.js"></script>
<script src="/static/js/require.js" data-main="/static/js/app/oj.js"></script>
<!-- footer begin -->

37
template/utils/index.html Normal file
View File

@ -0,0 +1,37 @@
{% extends "oj_base.html" %}
{% block body %}
<div class="container">
<div class="container">
<div class="jumbotron">
<h1>青岛大学在线评测平台</h1>
<p class="lead">走心的在线评测平台和算法交流社区,全新登场~</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">开始刷题!</a></p>
</div>
<!-- Example row of columns -->
<div class="row">
<div class="col-lg-4">
<h2>全新UI 全新设计</h2>
<p>精心设计的UI和交互让你。。。编不下去了 </p>
</div>
<div class="col-lg-4">
<h2>分布式评测</h2>
<p>技术领先的高性能分布式评测机制,根据提交数量自动伸缩判题机器实例。</p>
</div>
<div class="col-lg-4">
<h2>高质量原创题目</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula
porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh,
ut fermentum massa.</p>
</div>
</div>
</div>
</div>
{% endblock %}