diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 5cb646c8e..9319c4db2 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -649,7 +649,8 @@ class StudentWorkController < ApplicationController if revise_attachments.count == 2 revise_attachments.last.destroy end - #@attachment = @work.attachments.where("attachtype = 7").order("created_on desc").first + attachment = @work.attachments.where("attachtype = 7").first + attachment.update_attributes(:description => params[:description]) respond_to do |format| format.js end diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 2a4430935..d66c6a30d 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -17,6 +17,7 @@ class ZipdownController < ApplicationController begin if params[:base64file] file = Base64.decode64(params[:base64file]) + file = file.sub('*', '+') send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file) else send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file]) @@ -118,11 +119,15 @@ class ZipdownController < ApplicationController [{files:[out_file.file_path], count: 1, index: 1, real_file: out_file.file_path, file: File.basename(out_file.file_path), - base64file: Base64.encode64(File.basename(out_file.file_path)), + base64file: encode64(File.basename(out_file.file_path)), size:(out_file.pack_size / 1024.0 / 1024.0).round(2) }] end + def encode64(str) + Base64.encode64(str).sub('+', '*') + end + def zip_homework_common homework_common bid_homework_path = [] digests = [] @@ -142,7 +147,7 @@ class ZipdownController < ApplicationController [{files:[out_file.file_path], count: 1, index: 1, real_file: out_file.file_path, file: File.basename(out_file.file_path), - base64file: Base64.encode64(File.basename(out_file.file_path)), + base64file: encode64(File.basename(out_file.file_path)), size:(out_file.pack_size / 1024.0 / 1024.0).round(2) }] end diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 5945fece4..52f6570da 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -41,7 +41,7 @@ <% end %> <% if issues.count == 10%> - <%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> + <%= link_to "点击展开更多",project_issues_path({:project_id => project.id,:page => issue_pages.page}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%> <% end%> diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 880be0ffa..f7ecb0ccf 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -115,8 +115,20 @@ $('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); } - function submit_files(){ - $("#upload_form").submit(); + function regex_des() { + if ($.trim($("#attachment_des").val()) == "") { + $("#hint_message").text("附件描述不能为空"); + $("#hint_message").css('color','#ff0000'); + return false; + } else { + $("#hint_message").text(""); + return true; + } + } + function submit_revise_files(){ + if (regex_des()) { + $("#upload_form").submit(); + } } function closeModal(){ hideModal($(".uploadBoxContainer")); diff --git a/app/views/student_work/_revise_attachment.html.erb b/app/views/student_work/_revise_attachment.html.erb index 4d85b1813..2279856da 100644 --- a/app/views/student_work/_revise_attachment.html.erb +++ b/app/views/student_work/_revise_attachment.html.erb @@ -7,8 +7,12 @@
<%=revise_attachment.description %>
+ <% end %><%=revise_attachment.description %>
+ <% end %>