Merge branch 'szzh' into dev_hjq

This commit is contained in:
huang 2015-08-28 17:08:20 +08:00
commit 1f617035e9
10 changed files with 60 additions and 8 deletions

View File

@ -46,7 +46,7 @@ class UsersController < ApplicationController
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
:user_import_homeworks,:user_search_homeworks]
:user_import_homeworks,:user_search_homeworks,:user_import_resource]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
@ -379,6 +379,16 @@ class UsersController < ApplicationController
end
end
#用户从资源库导入资源到作业
def user_import_resource
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
respond_to do |format|
format.js
end
end
include CoursesHelper
def user_courses

View File

@ -57,7 +57,7 @@
<div class="cl"></div>
</div>
<div>
<div class="homepageSignature">
<div class="homepageSignature break_word">
<p id="user_brief_introduction_show">
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</p>

View File

@ -0,0 +1,26 @@
<div class="coursesChoosePopup" id="coursesChoosePopup">
<div>
<div class="sendText">资源库</div>
</div>
<div >
<form class="coursesSearchBox">
<input type="text" name="homework_name" placeholder="输入资源名称进行搜索" class="searchCoursesPopup" id="search_homework_name"/>
<a href="javascript:void(0);" class="searchIconPopup" onclick="search_homework_by_name('<%= user_search_homeworks_user_path(User.current.id)%>');"></a>
</form>
</div>
<%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
<div class="homeworkListForm mb10 " id="homework_list_form_show">
<%= render :partial => 'users/show_user_homework_form', :locals => {:user_homeworks => @user_homeworks}%>
</div>
<div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" class="sendSourceText" onclick="$('#select_homework_form').submit();">确定</a>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal('#coursesChoosePopup')">取消</a>
</div>
</div>
<% end%>
<div class="cl"></div>
</div>

View File

@ -47,7 +47,7 @@
<div class="mt5 fl">
<a href="javascript:void(0);" class="AnnexBtn fl mt3" onclick="$('#_file').click();">上传附件</a>
<!--<a href="javascript:void(0);" class="FilesBtn fl mr15 mt3">资源库</a>-->
<%= link_to "资源库", user_import_resource_user_path(User.current.id),:class => "FilesBtn fl mr15 mt3",:remote => true%>
</div>
<% content_for :header_tags do %>

View File

@ -1,6 +1,6 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<div class="HomeWorkCon">
<div class="mt15">
<div>
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox W700" maxlength="255" onkeyup="regex_homework_name();" placeholder="请输入作业标题" value="<%= homework.name%>" >
<p id="homework_name_span" class="c_red mt5"></p>
</div>
@ -38,7 +38,7 @@
<div class="mt5 fr">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick=" submit_homework('new_homework_common');">发送</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class=" fr mr10 mt3">取消</a>
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="reset_homework();">取消</a>
</div>
</div>
<div class="cl"></div>

View File

@ -11,6 +11,14 @@
}
};
$(window).scroll(scrollHandler);
function reset_homework(){
$("#homework_name").val("");
$("#homework_end_time").val("");
$("#course_id").val("");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
homework_description_editor.html("");
}
</script>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
@ -22,7 +30,7 @@
</div>
<div class="cl"></div>
<div class="HomeWork">
<div class="HomeWork mb10">
<% homework = HomeworkCommon.new %>
<%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
<div id="HomeWorkCon">

View File

@ -4,4 +4,4 @@ $('#ajax-modal').css('height','300px').css("width","580px");
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='javascript:void(0)' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","20%").css("left","25%");
$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed");

View File

@ -0,0 +1,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>');
showModal('ajax-modal', '580px');
$('#ajax-modal').css('height','300px').css("width","580px");
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='javascript:void(0)' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed");

View File

@ -329,6 +329,7 @@ RedmineApp::Application.routes.draw do
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
get 'user_import_homeworks'
get 'user_search_homeworks'
get 'user_import_resource'
match 'watch_projects', :to => 'users#watch_projects', :via => :get
#
# added by bai

View File

@ -691,7 +691,7 @@ a.referenceTypeBlock {color:#888888; display:inline-block; padding:0px 20px;}
/*底部*/
#Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}
.footerAbout{ width:455px; margin:0 auto;height:35px; line-height:35px;}
.footerAbout{ width:455px; margin:0 auto;height:35px; line-height:35px; }
.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}
.departments{ width:890px; margin:5px auto 0 auto;height:30px;line-height:30px;}
.copyright{ width:375px; margin:0 auto;height:20px;line-height:20px;}