Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
4d2215646a
|
@ -522,6 +522,7 @@ class UsersController < ApplicationController
|
|||
@atta_count = @attachments.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@attachments = paginateHelper @attachments,7
|
||||
respond_to do |format|
|
||||
|
@ -555,6 +556,7 @@ class UsersController < ApplicationController
|
|||
@atta_count = @attachments.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@attachments = paginateHelper @attachments,7
|
||||
respond_to do |format|
|
||||
|
@ -586,6 +588,7 @@ class UsersController < ApplicationController
|
|||
@atta_count = @attachments.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@attachments = paginateHelper @attachments,7
|
||||
respond_to do |format|
|
||||
|
@ -596,8 +599,8 @@ class UsersController < ApplicationController
|
|||
#将资源批量引入
|
||||
def import_resources_to_homework
|
||||
@attachments = []
|
||||
unless params[:checkbox1].nil? || params[:checkbox1].blank?
|
||||
params[:checkbox1].each do |id|
|
||||
unless session[:seleted_resource_ids].nil? || session[:seleted_resource_ids].blank?
|
||||
session[:seleted_resource_ids].each do |id|
|
||||
atta = Attachment.find(id)
|
||||
att_copy = atta.copy
|
||||
att_copy.container_id = nil
|
||||
|
@ -608,11 +611,23 @@ class UsersController < ApplicationController
|
|||
@attachments << att_copy
|
||||
end
|
||||
end
|
||||
session[:seleted_resource_ids] = [] #保存后清空
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# ajax 用session保存选择的资源id
|
||||
def store_selected_resource
|
||||
session[:seleted_resource_ids] = [] if session[:seleted_resource_ids].nil?
|
||||
if params[:save] == 'y'
|
||||
session[:seleted_resource_ids] << params[:res_id]
|
||||
else
|
||||
session[:seleted_resource_ids].delete( params[:res_id])
|
||||
end
|
||||
render :nothing => true
|
||||
end
|
||||
|
||||
|
||||
include CoursesHelper
|
||||
def user_courses
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
$('#reply_content_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
|
||||
});
|
||||
</script>
|
||||
<% if activity %>
|
||||
<% if activity && activity.course_act%>
|
||||
<% act = activity.course_act %>
|
||||
<% case activity.course_act_type.to_s %>
|
||||
<% when 'HomeworkCommon' %>
|
||||
|
|
|
@ -21,6 +21,19 @@
|
|||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed");
|
||||
}
|
||||
|
||||
// 点击 checkbox选中引用的资源的时候,保存该资源的id到session里去
|
||||
function store_seleted_resource(dom){
|
||||
if(dom.attr('checked') == 'checked' ){
|
||||
$.get(
|
||||
'<%= store_selected_resource_user_path(User.current) %>'+'?save=y&res_id='+dom.val()
|
||||
)
|
||||
}else {
|
||||
$.get(
|
||||
'<%= store_selected_resource_user_path(User.current) %>'+'?save=n&res_id='+dom.val()
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="homepageRightBanner mb10">
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
<% if attachments.nil? || attachments.empty? %>
|
||||
<!--<p class="nodata">-->
|
||||
<!--<%#= l(:label_no_data) %>-->
|
||||
<!--</p>-->
|
||||
<% else %>
|
||||
<% attachments.each do |attach| %>
|
||||
<ul class="resourcesList">
|
||||
<li class="resourcesListCheckbox fl">
|
||||
<input name="checkbox1[]" type="checkbox" onclick="store_seleted_resource($(this));" <%=seleted_resources.include?(attach.id.to_s) ? 'checked':'' %> value="<%= attach.id%>" class="resourcesCheckbox" />
|
||||
</li>
|
||||
<li class="resourcesListName fl">
|
||||
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
|
||||
<%= link_to truncate(attach.filename,:length=>30), download_named_attachment_path(attach.id, attach.filename),
|
||||
:title => attach.filename,:class=>'resourcesBlack'%>
|
||||
</li>
|
||||
<li class="resourcesListSize fl"><%= number_to_human_size(attach.filesize) %></li>
|
||||
<li class="resourcesListType fl"><%= get_resource_type(attach.container_type)%></li>
|
||||
<li class="resourcesListUploader fl"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
|
||||
<li style="display: none"><%= attach.author_id %></li>
|
||||
<li class="resourcesListTime fl"><%= format_date(attach.created_on) %></li>
|
||||
<li style="display: none"><%= attach.id %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -51,7 +51,7 @@
|
|||
<%= form_tag(import_resources_to_homework_user_path(user),:method => 'post',:remote=>'true') do %>
|
||||
<input type="hidden" name="homework_id" value="<%= homework_id%>"/>
|
||||
<div style="height: 300px" id="user_ref_resources">
|
||||
<%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %>
|
||||
<%= render :partial => 'homework_ref_resources_list' ,:locals=>{ :attachments => @attachments,:seleted_resources=>seleted_resources} %>
|
||||
</div>
|
||||
<div >
|
||||
<ul class="wlist" id="resource_ref_pages" style="margin-top: 5px;margin-right: 20px">
|
||||
|
|
|
@ -7,6 +7,19 @@
|
|||
homework_description_editor.html("");
|
||||
$("#homework_editor").toggle();
|
||||
}
|
||||
|
||||
// 点击 checkbox选中引用的资源的时候,保存该资源的id到session里去
|
||||
function store_seleted_resource(dom){
|
||||
if(dom.attr('checked') == 'checked' ){
|
||||
$.get(
|
||||
'<%= store_selected_resource_user_path %>'+'?save=y&res_id='+dom.val()
|
||||
)
|
||||
}else {
|
||||
$.get(
|
||||
'<%= store_selected_resource_user_path %>'+'?save=n&res_id='+dom.val()
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRightBanner mb10">
|
||||
<div class="NewsBannerName">作业</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_resource',:locals => {:user => @user,:homework_id=>@homework_id}) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_resource',:locals => {:user => @user,:homework_id=>@homework_id,:seleted_resources=>@seleted_resources}) %>');
|
||||
showModal('ajax-modal', '730px');
|
||||
$('#ajax-modal').css('height','500px').css("width","730px");
|
||||
$('#ajax-modal').siblings().remove();
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'resources_list',:locals=>{:attachments => @attachments})%>');
|
||||
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'homework_ref_resources_list',:locals=>{:attachments => @attachments,:seleted_resources=>@seleted_resources})%>');
|
||||
$("#resource_ref_pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
|
@ -1,2 +1,2 @@
|
|||
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'resources_list',:locals=>{:attachments => @attachments})%>');
|
||||
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'homework_ref_resources_list',:locals=>{:attachments => @attachments,:seleted_resources=>@seleted_resources})%>');
|
||||
$("#resource_ref_pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
|
@ -386,6 +386,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'user_resource_type'
|
||||
get 'user_ref_resource_search'
|
||||
post 'import_resources_to_homework'
|
||||
get 'store_selected_resource'
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -747,8 +747,8 @@ ul.list_watch{
|
|||
.w450{width: 450px;}
|
||||
|
||||
/*引用资源库弹窗*/
|
||||
.referenceResourcesPopup {width:710px; height:500px !important; border:3px solid #269ac9 !important; padding-left:20px; padding-right:20px; padding-bottom:35px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
|
||||
.referenceText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight:bold;}
|
||||
.referenceResourcesPopup {width:750px !important; height:500px !important; overflow: hidden !important; border:3px solid #269ac9 !important; padding-left:20px; padding-right:20px; padding-bottom:35px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
|
||||
.referenceText {font-size:16px; color:#269ac9; line-height:16px; display:inline-block; font-weight:bold;}
|
||||
.referenceSearchBox {border:1px solid #e6e6e6; width:235px; height:32px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
|
||||
.searchReferencePopup {border:none; outline:none; background-color:#ffffff; width:190px; height:32px; padding-left:10px; display:inline-block; float:left;}
|
||||
.referenceSearchIcon{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon2.png) -180px -270px no-repeat; display:inline-block; float:left;}
|
||||
|
|
|
@ -624,8 +624,8 @@ a.loginChooseTab {color:#484848; height:30px; display:block;}
|
|||
|
||||
/*引用资源库弹窗*/
|
||||
.popbox{position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;}
|
||||
.referenceResourcesPopup {width:710px; height:500px !important; border:3px solid #269ac9 !important; padding-left:16px !important; padding-right:16px !important; padding-bottom:16px !important; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
|
||||
.referenceText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight:bold;}
|
||||
.referenceResourcesPopup {width:750px !important; height:500px !important; border:3px solid #269ac9 !important; padding-left:16px !important; padding-right:16px !important; padding-bottom:16px !important; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
|
||||
.referenceText {font-size:16px; color:#269ac9; line-height:16px; display:inline-block; font-weight:bold;}
|
||||
.referenceSearchBox {border:1px solid #e6e6e6; width:235px; height:32px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
|
||||
.searchReferencePopup {border:none; outline:none; background-color:#ffffff; width:190px; height:32px; padding-left:10px; display:inline-block; float:left;}
|
||||
.referenceSearchIcon{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon2.png) -180px -270px no-repeat; display:inline-block; float:left;}
|
||||
|
|
Loading…
Reference in New Issue