导入作业功能完成
This commit is contained in:
parent
007a39b5d5
commit
2fa03c3102
|
@ -323,6 +323,29 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#导入作业,确定按钮
|
||||
def user_select_homework
|
||||
homework = HomeworkCommon.find_by_id params[:checkMenu]
|
||||
@homework = HomeworkCommon.new
|
||||
if homework
|
||||
@homework.name = homework.name
|
||||
@homework.description = homework.description
|
||||
@homework.end_time = homework.end_time
|
||||
@homework.course_id = homework.course_id
|
||||
homework.attachments.each do |attachment|
|
||||
att = attachment.copy
|
||||
att.container_id = nil
|
||||
att.container_type = nil
|
||||
att.copy_from = attachment.id
|
||||
att.save
|
||||
@homework.attachments << att
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def user_new_homework
|
||||
if params[:homework_common]
|
||||
homework = HomeworkCommon.new
|
||||
|
|
|
@ -9,16 +9,18 @@
|
|||
<a href="javascript:void(0);" class="searchIconPopup" onclick="search_homework_by_name('<%= user_search_homeworks_user_path(User.current.id)%>');"></a>
|
||||
</form>
|
||||
</div>
|
||||
<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">确定</a>
|
||||
</div>
|
||||
<div class="courseSendCancel">
|
||||
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal('#coursesChoosePopup')">取消</a>
|
||||
</div>
|
||||
</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>
|
|
@ -10,6 +10,7 @@
|
|||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% container.saved_attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>">
|
||||
|
@ -20,6 +21,7 @@
|
|||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
|
||||
<div class="mt10">
|
||||
<!--<input type="text" class="InputBox W700 SearchIcon" placeholder="发送到课程" />-->
|
||||
<%= select_tag :course_id,options_for_select(get_as_teacher_courses(User.current),homework.course_id), {:class => "InputBox W700 SearchIcon"} %>
|
||||
<%= select_tag :course_id,options_for_select(get_as_teacher_courses(User.current),homework.course_id), {:class => "InputBox w708 SearchIcon"} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= render :partial => 'users/user_homework_attachment', :locals => { :container => homework } %>
|
||||
<div id="homework_attachments">
|
||||
<%= render :partial => 'users/user_homework_attachment', :locals => { :container => homework } %>
|
||||
</div>
|
||||
|
||||
<div class="mt5 fr">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick=" submit_homework('new_homework_common');">发送</a>
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
</div>
|
||||
<% homework = HomeworkCommon.new %>
|
||||
<%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
|
||||
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
|
||||
<div id="HomeWorkCon">
|
||||
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
|
||||
</div>
|
||||
<% end%>
|
||||
</div><!----HomeWork end-->
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
//$("#HomeWorkCon").replaceWith("<%#= escape_javascript(render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:edit_mode => true })%>");
|
||||
hideModal('#coursesChoosePopup');
|
||||
$("#homework_name").val("<%= @homework.name%>");
|
||||
$("#homework_end_time").val("<%= @homework.end_time%>");
|
||||
$("#course_id").val("<%= @homework.course_id%>");
|
||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework })%>");
|
||||
homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>");
|
|
@ -309,6 +309,7 @@ RedmineApp::Application.routes.draw do
|
|||
collection do
|
||||
match "tag_saveEx" , :via => [:get, :post]
|
||||
post "user_new_homework"
|
||||
post 'user_select_homework'
|
||||
end
|
||||
member do
|
||||
match 'user_projects_index', :to => 'users#user_projects_index', :via => :get
|
||||
|
|
|
@ -859,7 +859,8 @@ a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#ffffff; l
|
|||
a:hover.BlueCirBtn{ background:#15bccf; color:#fff;}
|
||||
.W440{ width:440px;}
|
||||
.W120{ width:110px;}
|
||||
.W700{ width:700px;}
|
||||
.W700{ width:700px;max-width: 700px;min-width: 700px;}
|
||||
.w708{width: 708px;}
|
||||
a.AnnexBtn{ background: url(../images/homepage_icon.png) 0px -343px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
|
||||
a:hover.AnnexBtn{background: url(../images/homepage_icon.png) -90px -343px no-repeat; color:#15bccf;}
|
||||
a.FilesBtn{ background: url(../images/homepage_icon.png) 0px -373px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
|
||||
|
@ -919,7 +920,7 @@ img.ui-datepicker-trigger {
|
|||
#attachments_fields input.filename {
|
||||
border: 0;
|
||||
height: 1.8em;
|
||||
max-width: 670px;
|
||||
width: 630px;
|
||||
color: #7f7f7f;
|
||||
background-color: inherit;
|
||||
background: url(../images/pic_file.png) 0 3px no-repeat;
|
||||
|
@ -932,6 +933,7 @@ img.ui-datepicker-trigger {
|
|||
.description{display: none !important;}
|
||||
.ispublic-label{display: none !important;}
|
||||
.is_public_checkbox{display: none !important;}
|
||||
.is_public{display: none !important;}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue