课程上传资源是根据上传的类型,对资源添加默认的TAG
This commit is contained in:
parent
1dc8190aa0
commit
676cf8f180
|
@ -346,6 +346,27 @@ class FilesController < ApplicationController
|
|||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
|
||||
if params[:course_attachment_type] && params[:course_attachment_type] != "5"
|
||||
case params[:course_attachment_type]
|
||||
when "1"
|
||||
tag_name = l(:label_courseware)
|
||||
when "2"
|
||||
tag_name = l(:label_software)
|
||||
when "3"
|
||||
tag_name = l(:label_media)
|
||||
when "4"
|
||||
tag_name = l(:label_code)
|
||||
else
|
||||
tag_name = ""
|
||||
end
|
||||
if !attachments.empty? && attachments[:files] && tag_name != ""
|
||||
attachments[:files].each do |attachment|
|
||||
attachment.tag_list.add(tag_name)
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: 临时用 nyan
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
<script>
|
||||
function show_upload()
|
||||
function show_upload(obj)
|
||||
{
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course}) %>');
|
||||
switch(obj)
|
||||
{
|
||||
case 1:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 1}) %>');
|
||||
break;
|
||||
case 2:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 2}) %>');
|
||||
break;
|
||||
case 3:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 3}) %>');
|
||||
break;
|
||||
case 4:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 4}) %>');
|
||||
break;
|
||||
default:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 5}) %>');
|
||||
}
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
|
@ -45,14 +61,13 @@
|
|||
<% end %>
|
||||
<% if is_course_teacher(User.current,@course) %> <!-- show_window('light','fade','20%','35%')-->
|
||||
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||
|
||||
<p class="c_grey fr mt10 mr5">
|
||||
上传:
|
||||
<a href="javascript:void(0);" class=" c_dblue" >课件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue" >软件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue" > 媒体</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue" > 代码</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue"> 其他</a>
|
||||
<a href="javascript:void(0);" class=" c_dblue" onclick="show_upload(1);">课件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue" onclick="show_upload(2);">软件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue" onclick="show_upload(3);">媒体</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue" onclick="show_upload(4);">代码</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue" onclick="show_upload(5);">其他</a>
|
||||
</p>
|
||||
<% end %>
|
||||
</div><!---re_top end-->
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
|
||||
|
||||
<%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
|
||||
<input type="hidden" name="course_attachment_type" value="<%= course_attachment_type%>">
|
||||
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {}) %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').css('height','569px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
//$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
// "<a href='#' onclick='hidden_homework_atert_form("+
|
||||
// <#%= @cur_page%> + "," + <#%= @cur_type%> +
|
||||
// ");'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
||||
//$('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_show',:locals => {}) %>');
|
||||
//showModal('ajax-modal', '513px');
|
||||
//$('#ajax-modal').css('height','569px');
|
||||
//$('#ajax-modal').siblings().remove();
|
||||
////$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
//// "<a href='#' onclick='hidden_homework_atert_form("+
|
||||
// // <#%= @cur_page%> + "," + <#%= @cur_type%> +
|
||||
//// ");'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
//$('#ajax-modal').parent().css("top","").css("left","");
|
||||
//$('#ajax-modal').parent().addClass("alert_box");
|
|
@ -1974,3 +1974,8 @@ zh:
|
|||
label_show_non_project: 显示非项目信息
|
||||
label_hidden_non_project: 隐藏非项目信息
|
||||
|
||||
label_courseware: 课件
|
||||
label_software: 软件
|
||||
label_media: 媒体
|
||||
label_code: 代码
|
||||
|
||||
|
|
Loading…
Reference in New Issue