Accept Merge Request #137 对后台的综合调整 : (dev-sxw -> dev)

Merge Request: 对后台的综合调整
Created By: @esp
Accepted By: @virusdefender
URL: https://coding.net/u/virusdefender/p/qduoj/git/merge/137
This commit is contained in:
virusdefender 2015-08-27 17:26:22 +08:00
commit fbd0aac850
25 changed files with 653 additions and 422 deletions

View File

@ -1,3 +1,84 @@
from django.test import TestCase import json
from django.core.urlresolvers import reverse
from account.models import User, ADMIN, SUPER_ADMIN
from contest.models import Contest, ContestProblem
from submission.models import Submission
from rest_framework.test import APITestCase, APIClient
# Create your tests here. # Create your tests here.
class SubmissionAPITest(APITestCase):
def setUp(self):
self.client = APIClient()
self.url = reverse('contest_submission_admin_api_view')
self.userA = User.objects.create(username="test1", admin_type=ADMIN)
self.userA.set_password("testaa")
self.userA.save()
self.userS = User.objects.create(username="test2", admin_type=SUPER_ADMIN)
self.userS.set_password("testbb")
self.userS.save()
self.global_contest = Contest.objects.create(title="titlex", description="descriptionx", mode=1,
contest_type=2, show_rank=True, show_user_submission=True,
start_time="2015-08-15T10:00:00.000Z",
end_time="2015-08-15T12:00:00.000Z",
password="aacc", created_by=self.userS
)
self.problem = ContestProblem.objects.create(title="title1",
description="description1",
input_description="input1_description",
output_description="output1_description",
test_case_id="1",
sort_index="1",
samples=json.dumps([{"input": "1 1", "output": "2"}]),
time_limit=100,
memory_limit=1000,
hint="hint1",
contest=self.global_contest,
created_by=self.userS)
self.submission = Submission.objects.create(user_id=self.userA.id,
language=1,
code='#include "stdio.h"\nint main(){\n\treturn 0;\n}',
problem_id=self.problem.id)
self.submissionS = Submission.objects.create(user_id=self.userS.id,
language=2,
code='#include "stdio.h"\nint main(){\n\treturn 0;\n}',
problem_id=self.problem.id)
def test_submission_contest_does_not_exist(self):
self.client.login(username="test2", password="testbb")
response = self.client.get(self.url + "?contest_id=99")
self.assertEqual(response.data["code"], 1)
def test_submission_contest_parameter_error(self):
self.client.login(username="test2", password="testbb")
response = self.client.get(self.url)
self.assertEqual(response.data["code"], 1)
def test_submission_access_denied(self):
self.client.login(username="test1", password="testaa")
response = self.client.get(self.url + "?problem_id=" + str(self.problem.id))
self.assertEqual(response.data["code"], 1)
def test_submission_access_denied_with_contest_id(self):
self.client.login(username="test1", password="testaa")
response = self.client.get(self.url + "?contest_id=" + str(self.global_contest.id))
self.assertEqual(response.data["code"], 1)
def test_get_submission_successfully(self):
self.client.login(username="test2", password="testbb")
response = self.client.get(
self.url + "?contest_id=" + str(self.global_contest.id) + "&problem_id=" + str(self.problem.id))
self.assertEqual(response.data["code"], 0)
def test_get_submission_successfully_problem(self):
self.client.login(username="test2", password="testbb")
response = self.client.get(self.url + "?problem_id=" + str(self.problem.id))
self.assertEqual(response.data["code"], 0)
def test_get_submission_problem_do_not_exist(self):
self.client.login(username="test2", password="testbb")
response = self.client.get(self.url + "?problem_id=9999")
self.assertEqual(response.data["code"], 1)

View File

@ -21,6 +21,7 @@ from utils.shortcuts import serializer_invalid_response, error_response, success
from submission.models import Submission from submission.models import Submission
from .serializers import CreateContestSubmissionSerializer from .serializers import CreateContestSubmissionSerializer
from submission.serializers import SubmissionSerializer
class ContestSubmissionAPIView(APIView): class ContestSubmissionAPIView(APIView):
@ -76,7 +77,8 @@ def contest_problem_my_submissions_list_page(request, contest_id, contest_proble
contest_problem = ContestProblem.objects.get(id=contest_problem_id, visible=True) contest_problem = ContestProblem.objects.get(id=contest_problem_id, visible=True)
except Problem.DoesNotExist: except Problem.DoesNotExist:
return error_page(request, u"比赛问题不存在") return error_page(request, u"比赛问题不存在")
submissions = Submission.objects.filter(user_id=request.user.id, problem_id=contest_problem.id).order_by("-create_time"). \ submissions = Submission.objects.filter(user_id=request.user.id, problem_id=contest_problem.id).order_by(
"-create_time"). \
values("id", "result", "create_time", "accepted_answer_time", "language") values("id", "result", "create_time", "accepted_answer_time", "language")
return render(request, "oj/contest/my_submissions_list.html", return render(request, "oj/contest/my_submissions_list.html",
{"submissions": submissions, "problem": contest_problem}) {"submissions": submissions, "problem": contest_problem})
@ -112,4 +114,38 @@ def contest_problem_submissions_list_page(request, contest_id, page=1):
return render(request, "oj/contest/submissions_list.html", return render(request, "oj/contest/submissions_list.html",
{"submissions": current_page, "page": int(page), {"submissions": current_page, "page": int(page),
"previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20, "previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20,
"contest": contest}) "contest": contest})
class ContestSubmissionAdminAPIView(APIView):
def get(self, request):
"""
查询比赛提交,单个比赛题目提交的adminAPI
---
response_serializer: SubmissionSerializer
"""
problem_id = request.GET.get("problem_id", None)
contest_id = request.GET.get("contest_id", None)
if contest_id:
try:
contest = Contest.objects.get(pk=contest_id)
except Contest.DoesNotExist:
return error_response(u"比赛不存在!")
if request.user.admin_type != SUPER_ADMIN and contest.created_by != request.user:
return error_response(u"您无权查看该信息!")
submissions = Submission.objects.filter(contest_id=contest_id).order_by("-create_time")
else:
if problem_id:
try:
contest_problem = ContestProblem.objects.get(pk=problem_id)
except ContestProblem.DoesNotExist:
return error_response(u"问题不存在!")
if request.user.admin_type != SUPER_ADMIN and contest_problem.contest.created_by != request.user:
return error_response(u"您无权查看该信息!")
submissions = Submission.objects.filter(contest_id=contest_problem.contest_id).order_by("-create_time")
else:
return error_response(u"参数错误!")
if problem_id:
submissions = submissions.filter(problem_id=problem_id)
return paginate(request, submissions, SubmissionSerializer)

View File

@ -17,7 +17,7 @@ from admin.views import AdminTemplateView
from problem.views import TestCaseUploadAPIView, ProblemTagAdminAPIView, ProblemAdminAPIView from problem.views import TestCaseUploadAPIView, ProblemTagAdminAPIView, ProblemAdminAPIView
from submission.views import SubmissionAPIView, SubmissionAdminAPIView from submission.views import SubmissionAPIView, SubmissionAdminAPIView
from contest_submission.views import ContestSubmissionAPIView from contest_submission.views import ContestSubmissionAPIView, ContestSubmissionAdminAPIView
from monitor.views import QueueLengthMonitorAPIView from monitor.views import QueueLengthMonitorAPIView
from contest_submission.views import contest_problem_my_submissions_list_page from contest_submission.views import contest_problem_my_submissions_list_page
@ -65,7 +65,7 @@ urlpatterns = [
name="join_group_request_admin_api"), name="join_group_request_admin_api"),
url(r'^api/admin/submission/$', SubmissionAdminAPIView.as_view(), name="submission_admin_api_view"), url(r'^api/admin/submission/$', SubmissionAdminAPIView.as_view(), name="submission_admin_api_view"),
url(r'^api/admin/monitor/$', QueueLengthMonitorAPIView.as_view(), name="queue_length_monitor_api"), url(r'^api/admin/monitor/$', QueueLengthMonitorAPIView.as_view(), name="queue_length_monitor_api"),
url(r'^api/admin/contest_submission/$', ContestSubmissionAdminAPIView.as_view(), name="contest_submission_admin_api_view"),
url(r'^contest/(?P<contest_id>\d+)/problem/(?P<contest_problem_id>\d+)/$', "contest.views.contest_problem_page", url(r'^contest/(?P<contest_id>\d+)/problem/(?P<contest_problem_id>\d+)/$', "contest.views.contest_problem_page",

View File

@ -55,3 +55,12 @@
list-style-type: none; list-style-type: none;
margin: 5px; margin: 5px;
} }
.error-info {
color: #dd4b39;
font-family:
Arial,Helvetica,sans-serif;
font-size: 13px;
line-height: 1.4;
font-weight: 600;
}

View File

@ -133,11 +133,17 @@ define("admin", ["jquery", "avalon"], function ($, avalon) {
vm.template_url = "template/contest/edit_problem.html"; vm.template_url = "template/contest/edit_problem.html";
}); });
vm.$watch("showContestListPage", function (problemId) { vm.$watch("showContestListPage", function () {
vm.problemId = problemId;
vm.template_url = "template/contest/contest_list.html"; vm.template_url = "template/contest/contest_list.html";
}); });
vm.$watch("showContestSubmissionPage", function (problemId, contestId, contestMode) {
vm.$problemId = problemId;
vm.$contestId = contestId;
vm.$contestMode = contestMode
vm.template_url = "template/contest/submission_list.html";
});
avalon.scan(); avalon.scan();
window.onhashchange = function () { window.onhashchange = function () {

View File

@ -1,163 +1,163 @@
require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "validator"], require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "validator"],
function ($, avalon, csrfTokenHeader, bsAlert, editor) { function ($, avalon, csrfTokenHeader, bsAlert, editor) {
avalon.ready(function () { avalon.ready(function () {
avalon.vmodels.announcement = null;
var createAnnouncementEditor = editor("#create-announcement-editor"); var createAnnouncementEditor = editor("#create-announcement-editor");
var editAnnouncementEditor = editor("#edit-announcement-editor"); var editAnnouncementEditor = editor("#edit-announcement-editor");
if (avalon.vmodels.announcement){
var vm = avalon.vmodels.announcement;
announcementList = [];
}
else {
var vm = avalon.define({ var vm = avalon.define({
$id: "announcement", $id: "announcement",
//通用变量 //通用变量
announcementList: [], // 公告列表数据项 announcementList: [], // 公告列表数据项
previousPage: 0, // 之前的页数 previousPage: 0, // 之前的页数
nextPage: 0, // 之后的页数 nextPage: 0, // 之后的页数
page: 1, // 当前页数 page: 1, // 当前页数
editingAnnouncementId: 0, // 正在编辑的公告的ID 为零说明未在编辑 editingAnnouncementId: 0, // 正在编辑的公告的ID 为零说明未在编辑
totalPage: 1, // 总页数 totalPage: 1, // 总页数
showVisibleOnly: false, //仅显示可见公告 showVisibleOnly: false, //仅显示可见公告
// 编辑 // 编辑
newTitle: "", newTitle: "",
announcementVisible: 0, announcementVisible: 0,
showGlobalViewRadio: true, showGlobalViewRadio: true,
isGlobal: true, isGlobal: true,
allGroups: [], allGroups: [],
getState: function (el) { //获取公告当前状态,显示 getNext: function () {
if (el.visible) if (!vm.nextPage)
return "可见"; return;
else getPageData(vm.page + 1);
return "隐藏"; },
}, getPrevious: function () {
getNext: function () { if (!vm.previousPage)
if (!vm.nextPage) return;
return; getPageData(vm.page - 1);
getPageData(vm.page + 1); },
}, getBtnClass: function (btnType) {
getPrevious: function () { if (btnType == "next") {
if (!vm.previousPage) return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled";
return; }
getPageData(vm.page - 1); else {
}, return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
getBtnClass: function (btnType) { }
if (btnType == "next") { },
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled"; editAnnouncement: function (announcement) {
} vm.newTitle = announcement.title;
else { editAnnouncementEditor.setValue(announcement.content);
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled"; vm.announcementVisible = announcement.visible;
} if (vm.editingAnnouncementId == announcement.id)
vm.editingAnnouncementId = 0;
}, else
editAnnouncement: function (announcement) { vm.editingAnnouncementId = announcement.id;
vm.newTitle = announcement.title; vm.isGlobal = announcement.is_global;
editAnnouncementEditor.setValue(announcement.content); for (var i = 0; i < announcement.groups.length; i++) {
vm.announcementVisible = announcement.visible; for (var j = 0; j < vm.allGroups.length; j++) {
if (vm.editingAnnouncementId == announcement.id) if (announcement.groups[i] == vm.allGroups[j].id) {
vm.allGroups[j].isSelected = true;
}
}
}
editAnnouncementEditor.focus();
},
cancelEdit: function () {
vm.editingAnnouncementId = 0; vm.editingAnnouncementId = 0;
else },
vm.editingAnnouncementId = announcement.id; submitChange: function () {
vm.isGlobal = announcement.is_global; var title = vm.newTitle;
for (var i = 0; i < announcement.groups.length; i++) { var content = editAnnouncementEditor.getValue();
for (var j = 0; j < vm.allGroups.length; j++) {
if (announcement.groups[i] == vm.allGroups[j].id) { if (content == "" || title == "") {
vm.allGroups[j].isSelected = true; bsAlert("标题和内容都不能为空");
return false;
}
var selectedGroups = [];
if (!vm.isGlobal) {
for (var i = 0; i < vm.allGroups.length; i++) {
if (vm.allGroups[i].isSelected) {
selectedGroups.push(vm.allGroups[i].id);
}
} }
} }
}
editAnnouncementEditor.focus();
},
cancelEdit: function () {
vm.editingAnnouncementId = 0;
},
submitChange: function () {
var title = vm.newTitle;
var content = editAnnouncementEditor.getValue();
if (content == "" || title == "") { if (!vm.isGlobal && !selectedGroups.length) {
bsAlert("标题和内容都不能为空"); bsAlert("请至少选择一个小组");
return false; return false;
}
var selectedGroups = [];
if (!vm.isGlobal) {
for (var i = 0; i < vm.allGroups.length; i++) {
if (vm.allGroups[i].isSelected) {
selectedGroups.push(vm.allGroups[i].id);
}
} }
}
if (!vm.isGlobal && !selectedGroups.length) { $.ajax({
bsAlert("请至少选择一个小组"); beforeSend: csrfTokenHeader,
return false; url: "/api/admin/announcement/",
} contentType: "application/json",
dataType: "json",
$.ajax({ method: "put",
beforeSend: csrfTokenHeader, data: JSON.stringify({
url: "/api/admin/announcement/", id: vm.editingAnnouncementId,
contentType: "application/json", title: title,
dataType: "json", content: content,
method: "put", visible: vm.announcementVisible,
data: JSON.stringify({ is_global: vm.isGlobal,
id: vm.editingAnnouncementId, groups: selectedGroups
title: title, }),
content: content, success: function (data) {
visible: vm.announcementVisible, if (!data.code) {
is_global: vm.isGlobal, bsAlert("修改成功");
groups: selectedGroups vm.editingAnnouncementId = 0;
}), getPageData(1);
success: function (data) { }
if (!data.code) { else {
bsAlert("修改成功"); bsAlert(data.data);
vm.editingAnnouncementId = 0; }
getPageData(1);
} }
else { });
bsAlert(data.data);
}
}
});
} }
}); });
vm.$watch("showVisibleOnly", function () { vm.$watch("showVisibleOnly", function () {
getPageData(1); getPageData(1);
}); });
}
getPageData(1); getPageData(1);
$.ajax({
url: "/api/admin/group/",
method: "get",
dataType: "json",
success: function (data) {
if (!data.code) {
if (!data.data.length) {
bsAlert("您的用户权限只能创建组内公告,但是您还没有创建过小组");
return;
}
for (var i = 0; i < data.data.length; i++) {
var item = data.data[i];
item["isSelected"] = false;
vm.allGroups.push(item);
}
}
else {
bsAlert(data.data);
}
}
});
$.ajax({ $.ajax({
url: "/api/user/", url: "/api/user/",
method: "get", method: "get",
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (!data.code) { if (!data.code) {
var admin_type = data.data.admin_type;
if (data.data.admin_type == 1) { if (data.data.admin_type == 1) {
vm.isGlobal = false; vm.isGlobal = false;
vm.showGlobalViewRadio = false; vm.showGlobalViewRadio = false;
} }
} }
$.ajax({
url: "/api/admin/group/",
method: "get",
dataType: "json",
success: function (data) {
if (!data.code) {
if (!data.data.length) {
if (admin_type != 2)
bsAlert("您的用户权限只能创建组内公告,但是您还没有创建过小组");
return;
}
for (var i = 0; i < data.data.length; i++) {
var item = data.data[i];
item["isSelected"] = false;
vm.allGroups.push(item);
}
}
else {
bsAlert(data.data);
}
}
});
} }
}); });

View File

@ -131,7 +131,6 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
success: function (data) { success: function (data) {
if (!data.code) { if (!data.code) {
if (!data.data.length) { if (!data.data.length) {
bsAlert("您的用户权限只能创建组内比赛,但是您还没有创建过小组");
return; return;
} }
for (var i = 0; i < data.data.length; i++) { for (var i = 0; i < data.data.length; i++) {

View File

@ -234,15 +234,17 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker",
vm.groupList[vm.choseGroupList[groupIndex].index].chose = false; vm.groupList[vm.choseGroupList[groupIndex].index].chose = false;
vm.choseGroupList.remove(vm.choseGroupList[groupIndex]); vm.choseGroupList.remove(vm.choseGroupList[groupIndex]);
}, },
add_problem: function () { addProblem: function () {
vm.$fire("up!showContestProblemPage", 0, vm.contestList[vm.editingProblemContestIndex-1].id, vm.editMode); vm.$fire("up!showContestProblemPage", 0, vm.contestList[vm.editingProblemContestIndex-1].id, vm.editMode);
}, },
showProblemEditor: function(el) { showProblemEditPage: function(el) {
vm.$fire("up!showContestProblemPage", el.id, vm.contestList[vm.editingProblemContestIndex-1].id, vm.editMode); vm.$fire("up!showContestProblemPage", el.id, vm.contestList[vm.editingProblemContestIndex-1].id, vm.editMode);
}, },
getYesOrNo: function(yORn) { showSubmissionPage: function(el) {
if (yORn) return "是"; var problemId = 0
return "否"; if (el)
problemId = el.id;
vm.$fire("up!showContestSubmissionPage", problemId, vm.contestList[vm.editingProblemContestIndex-1].id, vm.editMode);
} }
}); });
vm.$watch("showVisibleOnly", function() { vm.$watch("showVisibleOnly", function() {

View File

@ -0,0 +1,88 @@
require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) {
avalon.ready(function () {
if (avalon.vmodels.contestSubmissionList){
var vm = avalon.vmodels.contestSubmissionList;
}
else {
var vm = avalon.define({
$id: "contestSubmissionList",
submissionList: [],
previousPage: 0,
nextPage: 0,
page: 1,
totalPage: 1,
results : {
0: "Accepted",
1: "Runtime Error",
2: "Time Limit Exceeded",
3: "Memory Limit Exceeded",
4: "Compile Error",
5: "Format Error",
6: "Wrong Answer",
7: "System Error",
8: "Waiting"
},
getNext: function () {
if (!vm.nextPage)
return;
getPageData(vm.page + 1);
},
getPrevious: function () {
if (!vm.previousPage)
return;
getPageData(vm.page - 1);
},
getBtnClass: function (btn) {
if (btn == "next") {
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled";
}
else {
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
}
},
getPage: function (page_index) {
if (!page_index)
var page_index = vm.page;
getPageData(page_index);
},
showSubmissionDetailPage: function (submissionId) {
},
goBack: function(check){
vm.$fire("up!showContestListPage");
}
});
}
getPageData(1);
function getPageData(page) {
var url = "/api/admin/contest_submission/?paging=true&page=" + page + "&page_size=10&contest_id=" + avalon.vmodels.admin.$contestId;
if (avalon.vmodels.admin.$problemId)
url += "&problem_id=" + avalon.vmodels.admin.$problemId
$.ajax({
url: url,
dataType: "json",
method: "get",
success: function (data) {
if (!data.code) {
vm.submissionList = data.data.results;
vm.totalPage = data.data.total_page;
vm.previousPage = data.data.previous_page;
vm.nextPage = data.data.next_page;
vm.page = page;
}
else {
bsAlert(data.data);
}
}
});
}
});
avalon.scan();
});

View File

@ -1,51 +1,57 @@
require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) { require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) {
avalon.ready(function () { avalon.ready(function () {
avalon.vmodels.group = null; //avalon.vmodels.group = null;
var vm = avalon.define({ if (avalon.vmodels.group) {
$id: "group", var vm = avalon.vmodels.group;
//通用变量 }
groupList: [], // 用户列表数据项 else {
previousPage: 0, // 之前的页数
nextPage: 0, // 之后的页数
page: 1, // 当前页数
totalPage: 1, // 总页数
keyword: "",
getNext: function () { var vm = avalon.define({
if (!vm.nextPage) $id: "group",
return; //通用变量
getPageData(vm.page + 1); groupList: [], // 用户列表数据项
}, previousPage: 0, // 之前的页数
getPrevious: function () { nextPage: 0, // 之后的页数
if (!vm.previousPage) page: 1, // 当前页数
return; totalPage: 1, // 总页数
getPageData(vm.page - 1); keyword: "",
},
getBtnClass: function (btnType) { getNext: function () {
if (btnType == "next") { if (!vm.nextPage)
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled"; return;
} getPageData(vm.page + 1);
else { },
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled"; getPrevious: function () {
} if (!vm.previousPage)
return;
getPageData(vm.page - 1);
},
getBtnClass: function (btnType) {
if (btnType == "next") {
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled";
}
else {
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
}
},
search: function(){
getPageData(1);
},
getGroupSettingString: function (setting) {
return {0: "允许任何人加入", 1: "提交请求后管理员审核", 2: "不允许任何人加入"}[setting]
},
showGroupDetailPage: function (groupId) {
vm.$fire("up!showGroupDetailPage", groupId);
}
});
}
},
search: function(){
getPageData(1);
},
getGroupSettingString: function (setting) {
return {0: "允许任何人加入", 1: "提交请求后管理员审核", 2: "不允许任何人加入"}[setting]
},
showGroupDetailPage: function (groupId) {
vm.$fire("up!showGroupDetailPage", groupId);
}
});
getPageData(1); getPageData(1);
function getPageData(page) { function getPageData(page) {
var url = "/api/admin/group/?paging=true&page=" + page + "&page_size=2"; var url = "/api/admin/group/?paging=true&page=" + page + "&page_size=10";
if (vm.keyword) if (vm.keyword)
url += "&keyword=" + vm.keyword; url += "&keyword=" + vm.keyword;
$.ajax({ $.ajax({

View File

@ -3,55 +3,60 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "validator"], function ($,
// avalon:定义模式 group_list // avalon:定义模式 group_list
avalon.ready(function () { avalon.ready(function () {
avalon.vmodels.groupDetail = null;
var vm = avalon.define({
$id: "groupDetail",
//通用变量
memberList: [],
previousPage: 0,
nextPage: 0,
page: 1,
totalPage: 1,
name: "",
description: "",
checkedSetting: "0",
getNext: function () { if (avalon.vmodels.groupDetail) {
if (!vm.nextPage) var vm = avalon.vmodels.groupDetail;
return; }
getPageData(vm.page + 1); else {
}, var vm = avalon.define({
getPrevious: function () { $id: "groupDetail",
if (!vm.previousPage) //通用变量
return; memberList: [],
getPageData(vm.page - 1); previousPage: 0,
}, nextPage: 0,
getBtnClass: function (btn) { page: 1,
if (btn == "next") { totalPage: 1,
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled"; name: "",
} description: "",
else { checkedSetting: "0",
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
}
},
removeMember: function (relation) { getNext: function () {
$.ajax({ if (!vm.nextPage)
beforeSend: csrfTokenHeader, return;
url: "/api/admin/group_member/", getPageData(vm.page + 1);
method: "put", },
data: JSON.stringify({group_id: relation.group, members: [relation.user.id]}), getPrevious: function () {
contentType: "application/json", if (!vm.previousPage)
success: function (data) { return;
vm.memberList.remove(relation); getPageData(vm.page - 1);
bsAlert(data.data); },
getBtnClass: function (btn) {
if (btn == "next") {
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled";
} }
}) else {
}, return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
showGroupListPage: function () { }
vm.$fire("up!showGroupListPage"); },
}
}); removeMember: function (relation) {
$.ajax({
beforeSend: csrfTokenHeader,
url: "/api/admin/group_member/",
method: "put",
data: JSON.stringify({group_id: relation.group, members: [relation.user.id]}),
contentType: "application/json",
success: function (data) {
vm.memberList.remove(relation);
bsAlert(data.data);
}
})
},
showGroupListPage: function () {
vm.$fire("up!showGroupListPage");
}
});
}
avalon.scan(); avalon.scan();
getPageData(1); getPageData(1);

View File

@ -1,51 +1,57 @@
require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function ($, avalon, csrfTokenHeader, bsAlert) { require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) {
// avalon:定义模式 group_list // avalon:定义模式 group_list
avalon.ready(function () { avalon.ready(function () {
avalon.vmodels.requestList = null;
var vm = avalon.define({
$id: "requestList",
//通用变量
requestList: [], // 列表数据项
previousPage: 0, // 之前的页数
nextPage: 0, // 之后的页数
page: 1, // 当前页数
totalPage: 1, // 总页数
getNext: function () { if (avalon.vmodels.requestList) {
if (!vm.nextPage) var vm = avalon.vmodels.requestList;
return; }
getPageData(vm.page + 1); else {
},
getPrevious: function () { var vm = avalon.define({
if (!vm.previousPage) $id: "requestList",
return; //通用变量
getPageData(vm.page - 1); requestList: [], // 列表数据项
}, previousPage: 0, // 之前的页数
getBtnClass: function (btn) { //上一页/下一页按钮启用禁用逻辑 nextPage: 0, // 之后的页数
if (btn == "next") { page: 1, // 当前页数
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled"; totalPage: 1, // 总页数
}
else { getNext: function () {
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled"; if (!vm.nextPage)
} return;
}, getPageData(vm.page + 1);
getPage: function (page_index) { },
getPageData(page_index); getPrevious: function () {
}, if (!vm.previousPage)
processRequest: function(request, status){ return;
$.ajax({ getPageData(vm.page - 1);
beforeSend: csrfTokenHeader, },
url: "/api/admin/join_group_request/", getBtnClass: function (btn) { //上一页/下一页按钮启用禁用逻辑
method: "put", if (btn == "next") {
data: {request_id: request.id, status: status}, return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled";
success: function(data){
vm.requestList.remove(request);
bsAlert(data.data);
} }
}) else {
} return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
}); }
},
getPage: function (page_index) {
getPageData(page_index);
},
processRequest: function(request, status){
$.ajax({
beforeSend: csrfTokenHeader,
url: "/api/admin/join_group_request/",
method: "put",
data: {request_id: request.id, status: status},
success: function(data){
vm.requestList.remove(request);
bsAlert(data.data);
}
})
}
});
}
avalon.scan(); avalon.scan();
getPageData(1); getPageData(1);
@ -72,78 +78,6 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function
}); });
} }
/*$("#edit_user-form")
.formValidation({
framework: "bootstrap",
fields: {
username: {
validators: {
notEmpty: {
message: "请填写用户名"
},
stringLength: {
min: 3,
max: 30,
message: '用户名长度必须在3到30位之间'
}
}
},
real_name: {
validators: {
notEmpty: {
message: "请填写真实姓名"
}
}
},
email: {
validators: {
notEmpty: {
message: "请填写电子邮箱邮箱地址"
},
emailAddress: {
message: "请填写有效的邮箱地址"
}
}
},
password: {
validators: {
stringLength: {
min: 6,
max: 30,
message: '密码长度必须在6到30位之间'
}
}
}
}
}
).on('success.form.fv', function (e) {
e.preventDefault();
var data = {
username: vm.username,
real_name: vm.real_name,
email: vm.email,
id: vm.id,
admin_type: vm.admin_type
};
if ($("#password").val() !== "")
data.password = $("#password").val();
$.ajax({
beforeSend: csrfHeader,
url: "/api/admin/user/",
data: data,
dataType: "json",
method: "put",
success: function (data) {
if (!data.code) {
bsAlert("提交成功!");
getPageData(1);
$("#password").val("");
} else {
bsAlert(data.data);
}
}
})
});*/
}); });
}); });

View File

@ -3,6 +3,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
avalon.ready(function () { avalon.ready(function () {
if(avalon.vmodels.problemList){ if(avalon.vmodels.problemList){
vm = avalon.vmodels.problemList; vm = avalon.vmodels.problemList;
problemList = [];
} }
else { else {
var vm = avalon.define({ var vm = avalon.define({
@ -13,6 +14,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
page: 1, page: 1,
totalPage: 1, totalPage: 1,
keyword: "", keyword: "",
showVisibleOnly: false,
getNext: function () { getNext: function () {
if (!vm.nextPage) if (!vm.nextPage)
return; return;
@ -41,12 +43,17 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
vm.$fire("up!showProblemSubmissionPage", problemId); vm.$fire("up!showProblemSubmissionPage", problemId);
} }
}); });
vm.$watch("showVisibleOnly", function () {
getPageData(1);
});
} }
getPageData(1); getPageData(1);
function getPageData(page) { function getPageData(page) {
var url = "/api/admin/problem/?paging=true&page=" + page + "&page_size=10"; var url = "/api/admin/problem/?paging=true&page=" + page + "&page_size=10";
if (vm.keyword != "") if (vm.keyword != "")
url += "&keyword=" + vm.keyword; url += "&keyword=" + vm.keyword;
if (vm.showVisibleOnly)
url += "&visible=true";
$.ajax({ $.ajax({
url: url, url: url,
dataType: "json", dataType: "json",

View File

@ -1,53 +1,59 @@
require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) { require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) {
avalon.ready(function () { avalon.ready(function () {
avalon.vmodels.submissionList = null;
var vm = avalon.define({
$id: "submissionList",
submissionList: [],
previousPage: 0,
nextPage: 0,
page: 1,
totalPage: 1,
results : {
0: "Accepted",
1: "Runtime Error",
2: "Time Limit Exceeded",
3: "Memory Limit Exceeded",
4: "Compile Error",
5: "Format Error",
6: "Wrong Answer",
7: "System Error",
8: "Waiting"
},
getNext: function () {
if (!vm.nextPage)
return;
getPageData(vm.page + 1);
},
getPrevious: function () {
if (!vm.previousPage)
return;
getPageData(vm.page - 1);
},
getBtnClass: function (btn) {
if (btn == "next") {
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled";
}
else {
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
}
},
getPage: function (page_index) {
getPageData(page_index);
},
showSubmissionDetailPage: function (submissionId) {
}, if (avalon.vmodels.submissionList){
showProblemListPage: function(){ var vm = avalon.vmodels.submissionList;
vm.$fire("up!showProblemListPage"); }
} else {
});
var vm = avalon.define({
$id: "submissionList",
submissionList: [],
previousPage: 0,
nextPage: 0,
page: 1,
totalPage: 1,
results : {
0: "Accepted",
1: "Runtime Error",
2: "Time Limit Exceeded",
3: "Memory Limit Exceeded",
4: "Compile Error",
5: "Format Error",
6: "Wrong Answer",
7: "System Error",
8: "Waiting"
},
getNext: function () {
if (!vm.nextPage)
return;
getPageData(vm.page + 1);
},
getPrevious: function () {
if (!vm.previousPage)
return;
getPageData(vm.page - 1);
},
getBtnClass: function (btn) {
if (btn == "next") {
return vm.nextPage ? "btn btn-primary" : "btn btn-primary disabled";
}
else {
return vm.previousPage ? "btn btn-primary" : "btn btn-primary disabled";
}
},
getPage: function (page_index) {
getPageData(page_index);
},
showSubmissionDetailPage: function (submissionId) {
},
showProblemListPage: function(){
vm.$fire("up!showProblemListPage");
}
});
}
getPageData(1); getPageData(1);

View File

@ -3,12 +3,12 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "validator"], function ($,
// avalon:定义模式 userList // avalon:定义模式 userList
avalon.ready(function () { avalon.ready(function () {
//avalon.vmodels.userList = null;
if (avalon.vmodels.userList) { if (avalon.vmodels.userList) {
var vm = avalon.vmodels.userList; var vm = avalon.vmodels.userList;
// initialize avalon object // initialize avalon object
userList = []; previousPage= 0; nextPage= 0; page = 1; userList = []; //previousPage= 0; nextPage= 0; page = 1;
editingUserId= 0; totalPage = 1; keyword= ""; showAdminOnly= false; //editingUserId= 0; totalPage = 1; keyword= ""; showAdminOnly= false;
//user editor fields //user editor fields
username= ""; realName= ""; email= ""; adminType= 0; id= 0; username= ""; realName= ""; email= ""; adminType= 0; id= 0;
} }

View File

@ -41,7 +41,7 @@ class SubmissionsListPageTest(TestCase):
def test_submissionsListPage_page_not_exist(self): def test_submissionsListPage_page_not_exist(self):
self.client.login(username="gogoing", password="666666") self.client.login(username="gogoing", password="666666")
response = self.client.get('/submissions/5/') response = self.client.get('/submissions/999/')
self.assertTemplateUsed(response, "utils/error.html") self.assertTemplateUsed(response, "utils/error.html")
def test_submissionsListPage_have_no_submission(self): def test_submissionsListPage_have_no_submission(self):

View File

@ -7,8 +7,8 @@
<th>创建时间</th> <th>创建时间</th>
<th>更新时间</th> <th>更新时间</th>
<th>创建者</th> <th>创建者</th>
<td>可见范围</td> <th>类型</th>
<th>状态</th> <th>可见</th>
<th></th> <th></th>
</tr> </tr>
<tr ms-repeat="announcementList"> <tr ms-repeat="announcementList">
@ -18,7 +18,7 @@
<td>{{ el.last_update_time|date("yyyy-MM-dd HH:mm:ss")}}</td> <td>{{ el.last_update_time|date("yyyy-MM-dd HH:mm:ss")}}</td>
<td>{{ el.created_by.username }}</td> <td>{{ el.created_by.username }}</td>
<td ms-text="el.is_global?'全局可见':'组内可见'"></td> <td ms-text="el.is_global?'全局可见':'组内可见'"></td>
<td>{{ getState(el)}}</td> <td ms-text="el.visible?'可见':'不可见'"></td>
<td> <td>
<button class="btn-sm btn-info" ms-click="editAnnouncement(el)">编辑</button> <button class="btn-sm btn-info" ms-click="editAnnouncement(el)">编辑</button>
</td> </td>
@ -38,7 +38,8 @@
<div class="form-group"> <div class="form-group">
<label>标题</label> <label>标题</label>
<input name="title" type="text" class="form-control" id="newTitle" placeholder="公告标题" value="" ms-duplex="newTitle"></div> <input name="title" type="text" class="form-control" id="newTitle" placeholder="公告标题" value=""
ms-duplex="newTitle"></div>
<div class="form-group"> <div class="form-group">
<label>内容</label> <label>内容</label>
<textarea id="edit-announcement-editor"></textarea> <textarea id="edit-announcement-editor"></textarea>
@ -66,7 +67,7 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<button ms-click="submitChange()" class="btn btn-primary">提交</button> <button ms-click="submitChange()" class="btn btn-success">保存修改</button>
&nbsp;&nbsp; &nbsp;&nbsp;
<button ms-click="cancelEdit()" class="btn btn-danger">取消</button> <button ms-click="cancelEdit()" class="btn btn-danger">取消</button>
</div> </div>
@ -78,12 +79,14 @@
<label>标题</label> <label>标题</label>
<input name="title" type="text" class="form-control" id="title" placeholder="公告标题" <input name="title" type="text" class="form-control" id="title" placeholder="公告标题"
data-error="请填写公告标题(标题不得超过50字)" maxlength="50" required> data-error="请填写公告标题(标题不得超过50字)" maxlength="50" required>
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>内容</label> <label>内容</label>
<textarea id="create-announcement-editor" placeholder="公告内容" maxlength="10000" required> <textarea id="create-announcement-editor" placeholder="公告内容" maxlength="10000" required>
</textarea> </textarea>
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -91,10 +94,16 @@
<div> <div>
<span ms-if="showGlobalViewRadio"> <span ms-if="showGlobalViewRadio">
<input type="radio" value="true" name="isGlobal" ms-duplex-boolean="isGlobal">全局可见 <label>
<small><input type="radio" value="true" name="isGlobal" ms-duplex-boolean="isGlobal">全局可见
</small>
</label>
</span> </span>
<span> <span>
<input type="radio" value="false" name="isGlobal" ms-duplex-boolean="isGlobal">小组内可见 <label>
<small><input type="radio" value="false" name="isGlobal" ms-duplex-boolean="isGlobal">小组内可见
</small>
</label>
</span> </span>
</div> </div>
@ -106,7 +115,7 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-primary">提交</button> <button type="submit" class="btn btn-success">发布公告</button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -18,9 +18,7 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<textarea id="editor" placeholder="这里输入内容" autofocus ms-duplex="description"></textarea> <textarea id="editor" placeholder="这里输入内容" autofocus ms-duplex="description"></textarea>
<p class="error-info" ms-visible="description==''">请填写比赛描述</p>
<div class="help-block with-errors"></div>
<small ms-visible="description==''" style="color:red">请填写比赛描述</small>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">

View File

@ -15,22 +15,22 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>比赛</th> <th>比赛</th>
<th>公开排名</th> <th>排名</th>
<th>可见</th>
<th>创建时间</th> <th>创建时间</th>
<th>创建者</th> <th>创建者</th>
<th>可见</th>
<th></th> <th></th>
</tr> </tr>
<tr ms-repeat="contestList"> <tr ms-repeat="contestList">
<td>{{ el.id }}</td> <td>{{ el.id }}</td>
<td>{{ el.title }}</td> <td>{{ el.title }}</td>
<td>{{ getYesOrNo(el.show_rank) }}</td> <td ms-text="el.show_rank?'公开':'不公开'"></td>
<td>{{ getYesOrNo(el.visible) }}</td>
<td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td> <td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td>
<td>{{ el.created_by.username }}</td> <td>{{ el.created_by.username }}</td>
<td ms-text="el.visible?'可见':'不可见'"></td>
<td> <td>
<a class="btn btn-info" href="javascript:void(0)" ms-click="showEditContestArea($index+1)">编辑</a> <a class="btn btn-info btn-sm" href="javascript:void(0)" ms-click="showEditContestArea($index+1)">编辑</a>
<a class="btn btn-primary" href="javascript:void(0)" ms-click="showEditProblemArea($index+1)">编辑问</a> <a class="btn btn-info btn-sm" href="javascript:void(0)" ms-click="showEditProblemArea($index+1)"></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -63,7 +63,7 @@
<textarea id="editor" placeholder="这里输入内容" autofocus ms-duplex="editDescription"></textarea> <textarea id="editor" placeholder="这里输入内容" autofocus ms-duplex="editDescription"></textarea>
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
<small ms-visible="editDescription==''" style="color:red">请填写比赛描述</small> <p class="error-info" ms-visible="editDescription==''" >请填写比赛描述</p>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@ -152,13 +152,14 @@
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<button class="btn btn-primary" type="submit">保存修改</button> <button class="btn btn-success" type="submit">保存修改</button>
</div> </div>
</form> </form>
</div> </div>
<div class="col-md-12" ms-visible="editingProblemContestIndex"> <div class="col-md-12" ms-visible="editingProblemContestIndex">
<label>题目列表</label> <label>题目列表</label>
<a href="javascript:void(0)" class="btn btn-success btn-sm" ms-click="add_problem()">添加</a> <a href="javascript:void(0)" class="btn btn-primary btn-sm" ms-click="addProblem()">添加题目</a>
<a href="javascript:void(0)" class="btn btn-info btn-sm" ms-click="showSubmissionPage()">查看提交</a>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>编号</th> <th>编号</th>
@ -176,7 +177,9 @@
<td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss") }}</td> <td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss") }}</td>
<td> <td>
<a href="javascript:void(0)" class="btn-sm btn-info" <a href="javascript:void(0)" class="btn-sm btn-info"
ms-click="showProblemEditor(el)">编辑</a> ms-click="showProblemEditPage(el)">编辑</a>
<a href="javascript:void(0)" class="btn-sm btn-info"
ms-click="showSubmissionPage(el)">提交</a>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -23,7 +23,7 @@
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label>题目描述</label> <label>题目描述</label>
<textarea id="problemDescription" placeholder="这里输入内容(此内容不能为空)" ms-duplex="description"></textarea> <textarea id="problemDescription" placeholder="这里输入内容(此内容不能为空)" ms-duplex="description"></textarea>
<small ms-visible="description==''" style="color:red">请填写题目描述</small> <p class="error-info" ms-visible="description==''">请填写题目描述</p>
</div> </div>
@ -130,7 +130,7 @@
<textarea id="hint" placeholder="这里输入内容" ms-duplex="hint"></textarea> <textarea id="hint" placeholder="这里输入内容" ms-duplex="hint"></textarea>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<input type="submit" class="btn btn-success btn-lg" value="发布题目" id="submitBtn"> <button type="submit" class="btn btn-success btn-lg">发布题目</button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -0,0 +1,37 @@
<div ms-controller="contestSubmissionList" class="col-md-9">
<nav>
<ul class="pager">
<li class="previous" ms-click="goBack()"><a href="javascript:void(0)"><span
aria-hidden="true">&larr;</span> 返回</a></li>
</ul>
</nav>
<h1>提交列表</h1>
<a href="javascript:void(0)" class="btn btn-sm btn-primary" ms-click="getPage(1)">
<span class="glyphicon glyphicon-refresh"></span> 刷新
</a>
<table class="table table-striped">
<tr>
<th>ID</th>
<th>创建时间</th>
<th>作者</th>
<td>结果</td>
<td></td>
</tr>
<tr ms-repeat="submissionList">
<td>{{ el.id }}</td>
<td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td>
<td>{{ el.user }}</td>
<td>{{ results[el.result] }}</td>
<td>
<a class="btn btn-info" ms-attr-href="'/submission/' + el.id + '/'" target="_blank">详情</a>
</td>
</tr>
</table>
<div class="text-right">
页数:{{ page }}/{{ totalPage }}&nbsp;&nbsp;
<button ms-attr-class="getBtnClass('pre')" ms-click="getPrevious">上一页</button>
<button ms-attr-class="getBtnClass('next')" ms-click="getNext">下一页</button>
</div>
</div>
<script src="/static/js/app/admin/contest/submissionList.js"></script>

View File

@ -11,7 +11,7 @@
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label>题目描述</label> <label>题目描述</label>
<textarea id="problemDescription" placeholder="这里输入内容(此内容不能为空)" ms-duplex="description"></textarea> <textarea id="problemDescription" placeholder="这里输入内容(此内容不能为空)" ms-duplex="description"></textarea>
<small ms-visible="description==''" style="color:red">请填写题目描述</small> <p class="error-info" ms-visible="description==''">请填写题目描述</p>
</div> </div>

View File

@ -17,7 +17,7 @@
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label>题目描述</label> <label>题目描述</label>
<textarea id="problemDescription" placeholder="这里输入内容(此内容不能为空)" ms-duplex="description"></textarea> <textarea id="problemDescription" placeholder="这里输入内容(此内容不能为空)" ms-duplex="description"></textarea>
<small ms-visible="description==''" style="color:red">请填写题目描述</small> <p class="error-info" ms-visible="description==''">请填写题目描述</p>
</div> </div>

View File

@ -17,7 +17,8 @@
<th>题目</th> <th>题目</th>
<th>创建时间</th> <th>创建时间</th>
<th>作者</th> <th>作者</th>
<td>通过次数/提交总数</td> <th>可见</th>
<th>通过次数/提交总数</th>
<td></td> <td></td>
</tr> </tr>
<tr ms-repeat="problemList"> <tr ms-repeat="problemList">
@ -25,6 +26,7 @@
<td>{{ el.title }}</td> <td>{{ el.title }}</td>
<td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td> <td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss")}}</td>
<td>{{ el.created_by.username }}</td> <td>{{ el.created_by.username }}</td>
<td ms-text="el.visible?'可见':'不可见'">{{ getYesOrNo(el.visible) }}</td>
<td>{{ el.total_accepted_number }}/{{ el.total_submit_number }}</td> <td>{{ el.total_accepted_number }}/{{ el.total_submit_number }}</td>
<td> <td>
<button class="btn-sm btn-info" ms-click="showEditProblemPage(el.id)">编辑</button> <button class="btn-sm btn-info" ms-click="showEditProblemPage(el.id)">编辑</button>
@ -32,6 +34,9 @@
</td> </td>
</tr> </tr>
</table> </table>
<div class="form-group">
<label>仅显示可见 <input ms-duplex-checked="showVisibleOnly" type="checkbox"/></label>
</div>
<div class="text-right"> <div class="text-right">
页数:{{ page }}/{{ totalPage }}&nbsp;&nbsp; 页数:{{ page }}/{{ totalPage }}&nbsp;&nbsp;
<button ms-attr-class="getBtnClass('pre')" ms-click="getPrevious">上一页</button> <button ms-attr-class="getBtnClass('pre')" ms-click="getPrevious">上一页</button>

View File

@ -21,7 +21,7 @@
<td>{{ el.user }}</td> <td>{{ el.user }}</td>
<td>{{ results[el.result] }}</td> <td>{{ results[el.result] }}</td>
<td> <td>
<a class="btn btn-info" ms-attr-href="'/my_submission/' + el.id + '/'" target="_blank">详情</a> <a class="btn btn-info" ms-attr-href="'/submission/' + el.id + '/'" target="_blank">详情</a>
</td> </td>
</tr> </tr>
</table> </table>