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/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 @@
追加附件: <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> - 追加时间:<%=format_time revise_attachment.created_on.to_s %>  (<%=revise_attachment_status @homework,revise_attachment %>) + 追加时间:<%=format_time revise_attachment.created_on.to_s %>  (<%=revise_attachment_status @homework,revise_attachment %>)
+ <% unless revise_attachment.description == "" %> + 附件描述:

<%=revise_attachment.description %>

+ <% end %>
+
<% end %> <% if work.user == User.current %>
@@ -18,10 +22,14 @@
追加附件: <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> - 追加时间:<%=format_time revise_attachment.created_on.to_s %> + 追加时间:<%=format_time revise_attachment.created_on.to_s %>
+ <% unless revise_attachment.description == "" %> + 附件描述:

<%=revise_attachment.description %>

+ <% end %>
<% end %> -
+
+ <% end %> diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index f92614e10..662ddece4 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -113,8 +113,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/_upload_attachment.html.erb b/app/views/student_work/_upload_attachment.html.erb index d9c69fc17..02f05c4df 100644 --- a/app/views/student_work/_upload_attachment.html.erb +++ b/app/views/student_work/_upload_attachment.html.erb @@ -9,7 +9,7 @@
- + 选择文件 <%= file_field_tag 'attachments[dummy][file]', :id => '_file', @@ -37,9 +37,16 @@
最多只能上传一个小于50MB的附件
+
+ +
+
+

+
- <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> + 确定 + <%#= submit_tag '确定',:onclick=>'submit_revise_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
取消 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index b07e93701..86586243d 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1227,6 +1227,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .mb10 {margin-bottom: 10px} .mb15 {margin-bottom: 15px} div.disable_link {background-color: #c1c1c1 !important;} +.reUploadDetail{border:1px solid #dddddd; float:left; resize:none; width:400px; height:80px; overflow-y:auto;outline: none;} /*新课程资源库*/ .reCon{ margin:5px; width:710px;}