资源的批量设置(未完成)

This commit is contained in:
cxt 2017-09-08 17:07:00 +08:00
parent f077204add
commit c1b912188b
3 changed files with 119 additions and 1 deletions

View File

@ -72,7 +72,7 @@ class AttachmentsController < ApplicationController
def batch_setting def batch_setting
@course = Course.find params[:course_id] @course = Course.find params[:course_id]
@attachments = @course.attachments @attachments = @course.attachments.reorder("created_on desc")
@limit = 10 @limit = 10
@attachment_count = @attachments.count @attachment_count = @attachments.count
@attachment_pages = Paginator.new @attachment_count, @limit, params['page'] || 1 @attachment_pages = Paginator.new @attachment_count, @limit, params['page'] || 1

View File

@ -0,0 +1,116 @@
<div id="muban_popup_box" style="width:550px;">
<div class="muban_popup_top">
<h3 class="fl">资源发布批量设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="$('#datetimepicker_mask').datetimepicker('destroy');"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<div style="border-bottom: 1px solid #eeeeee;">
<div id="source_list">
<table class="sy_new_table clear sy_new_table_width" cellpadding="0" cellspacing="0" id="student_list_table" style="border: none;text-align: left;">
<thead>
<tr class="clear">
<th><input type="checkbox" name="check_all" class="fl mr5 mt8 ml10" />资源名称</th>
<th>上传者</th>
</tr>
</thead>
<tbody>
<% @attachments.each do |attachment| %>
<tr>
<td><input type="checkbox" name="attachments[]" class="fl mr5 mt8 ml10" /><%= attachment.filename %></td>
<td><%= attachment.author.show_name %>/td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="clear">
<div class="resourcesSelectSendButton fl mt10 mr15 inactive-border">
<a href="javascript:void(0);" class="sendButtonBlue db inactive-text" data-remote="true">删除</a>
</div>
<ul class="wlist" id="pages" style="margin-top: 15px;">
<li><a href="" class="previous c_blue" data-remote="true">上一页</a></li>
<li class="wlist_select"><a class="current-page c_white">1</a></li>
<li><a href="" class="page c_blue" data-remote="true">2</a></li>
<li><a href="" class="next c_blue" data-remote="true">下一页</a></li>
</ul>
</div>
</div>
<ul class="ul-align">
<li class="clear">
<label class="fl">公开:&nbsp;</label>
<span>
<input type="checkbox" id="set_public" name="public" class="fl mt10 mr5" style="height: 20px;"/>
<label for="set_public">选中后所有用户可见,否则仅课堂成员可见</label>
</span>
</li>
<li class="clear">
<label class="fl">延期发布:&nbsp;</label>
<div class="calendar_div fl ml10">
<input type="text" name="publish_time" id="datetimepicker_mask" placeholder="发布时间(可选)" style="width: 130px;" class="InputBox fl calendar_input" readonly="readonly">
</div>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_publish_time();">清空</a>
<div class="cl"></div>
<span class="c_red f12" style="margin-top: 4px;" id="publish_time_notice"></span>
<input type="text" placeholder="发布时间(可选)" />
</li>
</ul>
<p class="clear mt5">
<a href="javascript:void(0);" onfocus="this.blur();" onclick="send_submit();" class="sy_btn_blue fr mr10">发&nbsp;&nbsp;送</a>
<a href="javascript:void(0);" onclick="hideModal();" class="sy_btn_grey fr mr10">取&nbsp;&nbsp;消</a>
</p>
</div>
</div>
<script>
function regex_publish_time()
{
var myDate = new Date();
if($.trim($("#datetimepicker_mask").val()) == "")
{
return true;
} else{
var publish_time = Date.parse($("#datetimepicker_mask").val());
if(Date.parse(formate_time(myDate)) > publish_time)
{
$("#publish_time_notice").text("发布时间不能小于当前时间");
return false;
}
else
{
$("#publish_time_notice").text("");
return true;
}
}
}
function submit_course_resource()
{
<% if User.current.allowed_to?(:as_teacher,course) %>
if(regex_publish_time()) {
$('#submit_resource').parent().submit();
}
<% else %>
$('#submit_resource').parent().submit();
<% end %>
}
function reset_publish_time(){
$("#datetimepicker_mask").val('');
$("#reset_time").hide();
}
$(function(){
$('#datetimepicker_mask').datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false,
onSelectDate:function() {
$("#reset_time").show();
},
onSelectTime:function() {
$("#reset_time").show();
}
});
});
</script>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= j(render :partial => 'attachments/batch_setting') %>";
pop_box_new(htmlvalue, 500, 500);