测试作业下载

This commit is contained in:
yanxd 2014-04-16 10:42:49 +08:00
parent 30a70bba74
commit 6f5fcd0dee
6 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,11 @@
source 'https://rubygems.org'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
gem 'iconv'
gem 'rubyzip'
gem 'zip-zip'
end
gem "rails", "3.2.13"
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"

View File

@ -30,7 +30,7 @@ class TestController < ApplicationController
input_filename = files_path
zipfile_name = "#{Rails.root}/tmp/archiveZip/archive_#{Time.now.to_i}.zip"
Dir.mkdir(File.dirname(zipfile_name)) if File.exist?(File.dirname(zipfile_name))
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
input_filename.each do |filename|
zipfile.add(ic.iconv(filename_to_real(File.basename(filename))), folder + '/' + filename)

View File

@ -14,6 +14,10 @@
</div>
<% end %>
<% display_id = im_watching_student_id? @bid%>
<%= link_to "作业打包下载", test_zip_path(homework_id: @bid), remote: true, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;display: inline-block;" if( User.current.admin? ||
!(User.current.roles_for_project(@bid.courses.first).map(&:id) &
([7,9, 10])).empty?
) && Rails.env.development? %>
<% @homework_list.each do |homework|%>
<% if homework.attachments.any?%>
<table width="660px" border="0" align="center">

View File

@ -1,6 +1,6 @@
<!-- fq -->
<% if @bid.homework_type == 1%>
<% if @bid.homework_type == Bid::HomeworkFile %>
<%= render :partial => 'homework' %>
<% else %>

View File

@ -22,7 +22,7 @@
<% course.homeworks.each do |homework| %>
<% homeworks_attach_path = [] %>
<div class="homeworks">
<%= homework.name %>(<%=homework.homeworks.count %>)<%#Bid%>
<%= link_to homework.name, respond_path(homework) %>(<%=homework.homeworks.count %>)<%#Bid%>
<div class="attach_item">
<%= link_to "package", test_zip_path(:homework_id => homework.id)%><br/>
<% homework.homeworks.each do |homeattach|%><%#homework.class == Bid %>

View File

@ -1907,6 +1907,10 @@ input[type="submit"], .button_submit {
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2), 0px 1px 0px rgb(255, 255, 255);
cursor: pointer;
}
.button_submit_font_white{
color: white !important ;
font-weight: 400;
}
input[type="button-submit"] {
padding-bottom: 5px;