mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
User code problems admin view
Shows the most recent 1000 log entries Url: admin/user-code-problems
This commit is contained in:
parent
f4426f2e43
commit
185c977cdb
5 changed files with 77 additions and 1 deletions
|
@ -34,6 +34,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
'admin/level-sessions': go('admin/LevelSessionsView')
|
||||
'admin/users': go('admin/UsersView')
|
||||
'admin/base': go('admin/BaseView')
|
||||
'admin/user-code-problems': go('admin/UserCodeProblemsView')
|
||||
|
||||
'beta': go('HomeView')
|
||||
|
||||
|
|
|
@ -1052,8 +1052,10 @@
|
|||
av_entities_active_instances_url: "Active Instances"
|
||||
av_entities_employer_list_url: "Employer List"
|
||||
av_entities_candidates_list_url: "Candidate List"
|
||||
av_entities_user_code_problems_list_url: "User Code Problems List"
|
||||
av_other_sub_title: "Other"
|
||||
av_other_debug_base_url: "Base (for debugging base.jade)"
|
||||
u_title: "User List"
|
||||
ucp_title: "User Code Problems"
|
||||
lg_title: "Latest Games"
|
||||
clas: "CLAs"
|
||||
|
|
|
@ -33,7 +33,9 @@ block content
|
|||
a(href="/admin/employers", data-i18n="admin.av_entities_employer_list_url") Employer List
|
||||
li
|
||||
a(href="/admin/candidates", data-i18n="admin.av_entities_candidates_list_url") Candidate List
|
||||
|
||||
li
|
||||
a(href="/admin/user-code-problems", data-i18n="admin.av_entities_user_code_problems_list_url") User Code Problems List
|
||||
|
||||
h4(data-i18n="admin.av_other_sub_title") Other
|
||||
|
||||
ul
|
||||
|
|
33
app/templates/admin/user-code-problems.jade
Normal file
33
app/templates/admin/user-code-problems.jade
Normal file
|
@ -0,0 +1,33 @@
|
|||
extends /templates/base
|
||||
|
||||
block content
|
||||
|
||||
h1(data-i18n="admin.ucp_title") User Code Problems
|
||||
|
||||
table.table.table-striped.table-bordered.table-condensed#users
|
||||
thead(style='font-weight:bold')
|
||||
tr
|
||||
td language
|
||||
//- td errType
|
||||
//- td errLevel
|
||||
//- td errId
|
||||
td levelID
|
||||
td codeSnippet
|
||||
td errHint
|
||||
td errMessage
|
||||
//- td code
|
||||
td created
|
||||
|
||||
tbody
|
||||
each problem in userCodeProblems
|
||||
tr
|
||||
td #{problem.language}
|
||||
//- td #{problem.errType}
|
||||
//- td #{problem.errLevel}
|
||||
//- td #{problem.errId}
|
||||
td #{problem.levelID}
|
||||
td #{problem.codeSnippet}
|
||||
td #{problem.errHint}
|
||||
td #{problem.errMessage}
|
||||
//- td #{problem.code}
|
||||
td #{new Date(problem.created).toLocaleString()}
|
38
app/views/admin/UserCodeProblemsView.coffee
Normal file
38
app/views/admin/UserCodeProblemsView.coffee
Normal file
|
@ -0,0 +1,38 @@
|
|||
RootView = require 'views/kinds/RootView'
|
||||
template = require 'templates/admin/user-code-problems'
|
||||
UserCodeProblem = require 'models/UserCodeProblem'
|
||||
|
||||
module.exports = class UserCodeProblemsView extends RootView
|
||||
# TODO: Pagination, choosing filters on the page itself.
|
||||
|
||||
id: 'admin-user-code-problems-view'
|
||||
template: template
|
||||
|
||||
constructor: (options) ->
|
||||
super options
|
||||
@getUserCodeProblems()
|
||||
|
||||
getUserCodeProblems: ->
|
||||
# can have this page show arbitrary conditions, see mongoose queries
|
||||
# http://mongoosejs.com/docs/queries.html
|
||||
# Each list in conditions is a function call.
|
||||
# The first arg is the function name
|
||||
# The rest are the args for the function
|
||||
|
||||
conditions = [
|
||||
['limit', 1000]
|
||||
['sort', '-created']
|
||||
]
|
||||
conditions = $.param({conditions:JSON.stringify(conditions)})
|
||||
UserCodeProblemCollection = Backbone.Collection.extend({
|
||||
model: UserCodeProblem
|
||||
url: '/db/user.code.problem?' + conditions
|
||||
})
|
||||
@userCodeProblems = new UserCodeProblemCollection()
|
||||
@userCodeProblems.fetch()
|
||||
@listenTo(@userCodeProblems, 'all', @render)
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.userCodeProblems = (problem.attributes for problem in @userCodeProblems.models)
|
||||
c
|
Loading…
Reference in a new issue