diff --git a/app/views/users/profile.html.haml b/app/views/users/profile.html.haml new file mode 100644 --- /dev/null +++ b/app/views/users/profile.html.haml @@ -0,0 +1,66 @@ +- content_for :header do + = javascript_include_tag 'local_jquery' + +:javascript + $(function () { + $('#submission_table').tablesorter({widgets: ['zebra']}); + }); + +:css + .fix-width { + font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier; + } + +%h1= @user.full_name + +Login: #{@user.login}
+Full name: #{@user.full_name}
+ + +%h2 Problem Stat +%table.info + %thead + %tr.info-head + %th Stat + %th Value + %tbody + %tr{class: cycle('info-even','info-odd')} + %td.info_param Submissions + %td= @summary[:count] + %tr{class: cycle('info-even','info-odd')} + %td.info_param Solved/Attempted Problem + %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) + +%h2 Submission History + +=render partial: 'application/bar_graph', locals: {histogram: @histogram, param: {bar_width: 7}} + + +%table.tablesorter-cafe#submission_table + %thead + %tr + %th ID + %th Problem code + %th Problem full name + %th Language + %th Submitted at + %th Result + %th Score + - if session[:admin] + %th IP + %tbody + - @submission.each do |s| + - next unless s.problem + %tr + %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id + %td= link_to s.problem.name, controller: "problems", action: "stat", id: s.problem + %td= s.problem.full_name + %td= s.language.pretty_name + %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) + %td.fix-width= s.grader_comment + %td= (s.points*100)/s.problem.full_score + - if session[:admin] + %td= s.ip_address + + +