Show More
Commit Description:
add jquery to manage problem, now we can select a range of problem
Commit Description:
add jquery to manage problem, now we can select a range of problem
References:
File last commit:
Show/Diff file:
Action:
app/views/problems/manage.html.haml
| 85 lines
| 2.4 KiB
| text/x-haml
| HamlLexer
|
|
r201 | - content_for :head do | ||
= stylesheet_link_tag 'problems' | ||||
r456 | = javascript_include_tag 'local_jquery' | |||
:javascript | ||||
$(document).ready( function() { | ||||
function shiftclick(start,stop,value) { | ||||
$('tr input').each( function(id,input) { | ||||
var $input=$(input); | ||||
var iid=parseInt($input.attr('id').split('-')[2]); | ||||
if(iid>=start&&iid<=stop){ | ||||
$input.prop('checked',value) | ||||
} | ||||
}); | ||||
} | ||||
$('tr input').click( function(e) { | ||||
if (e.shiftKey) { | ||||
stop = parseInt($(this).attr('id').split('-')[2]); | ||||
var orig_stop = stop | ||||
if (typeof start !== 'undefined') { | ||||
if (start > stop) { | ||||
var tmp = start; | ||||
start = stop; | ||||
stop = tmp; | ||||
} | ||||
shiftclick(start,stop,$(this).is(':checked') ) | ||||
} | ||||
start = orig_stop | ||||
} else { | ||||
start = parseInt($(this).attr('id').split('-')[2]); | ||||
} | ||||
}); | ||||
}); | ||||
|
r201 | |||
%h1 Manage problems | ||||
%p= link_to '[Back to problem list]', :action => 'list' | ||||
|
r321 | = form_tag :action=>'do_manage' do | ||
|
r201 | .submitbox | ||
r456 | What do you want to do to the selected problem? | |||
|
r201 | %br/ | ||
r456 | (You can shift-click to select a range of problems) | |||
|
r201 | %ul | ||
%li | ||||
Change date added to | ||||
= select_date Date.current, :prefix => 'date_added' | ||||
| ||||
= submit_tag 'Change', :name => 'change_date_added' | ||||
r456 | %li | |||
Set available to | ||||
= submit_tag 'True', :name => 'enable_problem' | ||||
= submit_tag 'False', :name => 'disable_problem' | ||||
|
r279 | |||
|
r320 | - if GraderConfiguration.multicontests? | ||
|
r279 | %li | ||
Add to | ||||
= select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) | ||||
= submit_tag 'Add', :name => 'add_to_contest' | ||||
|
r201 | %table | ||
r456 | %tr{style: "text-align: left;"} | |||
%th= check_box_tag 'select_all' | ||||
|
r201 | %th Name | ||
%th Full name | ||||
r456 | %th Available | |||
|
r201 | %th Date added | ||
|
r320 | - if GraderConfiguration.multicontests? | ||
|
r279 | %th Contests | ||
|
r201 | |||
r456 | - num = 0 | |||
|
r201 | - for problem in @problems | ||
r456 | - num += 1 | |||
|
r201 | %tr{:id => "row-prob-#{problem.id}", :name=> "prob-#{problem.id}"} | ||
r456 | %td= check_box_tag "prob-#{problem.id}-#{num}" | |||
|
r201 | %td= problem.name | ||
%td= problem.full_name | ||||
r456 | %td= problem.available | |||
|
r201 | %td= problem.date_added | ||
|
r320 | - if GraderConfiguration.multicontests? | ||
|
r279 | %td | ||
- problem.contests.each do |contest| | ||||
= "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])" | ||||