题库的分享请求
This commit is contained in:
parent
467af47386
commit
6c184b9248
|
@ -396,6 +396,19 @@ class UsersController < ApplicationController
|
|||
end
|
||||
# end
|
||||
|
||||
#引用作业请求弹框
|
||||
def apply_homework
|
||||
if User.current.logged?
|
||||
@homework = HomeworkCommon.find params[:homework_id]
|
||||
@state = 2
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#申请引用非公开作业
|
||||
def apply_for_homework
|
||||
if User.current.logged?
|
||||
|
@ -405,7 +418,7 @@ class UsersController < ApplicationController
|
|||
if ah.empty?
|
||||
ApplyHomework.create(:user_id => params[:id].to_i, :homework_common_id => params[:homework_id].to_i, :status => 1)
|
||||
Mailer.run.apply_for_homework_request(homework, User.current)
|
||||
CourseMessage.create(:user_id => homework.user_id, :course_id => homework.course.id, :viewed => false,:course_message_id=>params[:homework_id].to_i,:course_message_type=>'HomeworkCommon',:status=>5,:apply_user_id=>params[:id].to_i)
|
||||
CourseMessage.create(:user_id => homework.user_id, :course_id => homework.course.id, :viewed => false,:course_message_id=>params[:homework_id].to_i,:course_message_type=>'HomeworkCommon',:status=>5,:apply_user_id=>params[:id].to_i,:content=>params[:content])
|
||||
@state = 2
|
||||
@ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", params[:id].to_i, params[:homework_id].to_i).first
|
||||
@homework = homework
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<div>
|
||||
<div class="ni_con">
|
||||
<p class="mt30">
|
||||
<% if state == 2 %>
|
||||
请求已发送至<%=homework.user.show_name %>老师,希望他同意与你分享:)
|
||||
<% elsif state == 3 %>
|
||||
您已发送过分享请求,请勿重复发送。
|
||||
<% end %>
|
||||
</p>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="hideModal();" style="margin-bottom: 10px; margin-left: 60px; color: #fff;" >
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,27 @@
|
|||
<div>
|
||||
<div class="ni_con">
|
||||
<h2>请求分享</h2>
|
||||
<p>
|
||||
请求说明(可选):
|
||||
<textarea type="text" id="apply_content" class="apply_content mt10" style="outline:none;"></textarea>
|
||||
</p>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="apply_to();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function apply_to() {
|
||||
url = '/users/<%=User.current.id %>/apply_for_homework?homework_id=<%=homework.id %>&content='+$("#apply_content").val();
|
||||
$.get(
|
||||
url,
|
||||
{
|
||||
|
||||
},
|
||||
function (data) {
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
function (data) {
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="h450">
|
||||
|
@ -41,7 +41,7 @@
|
|||
<li class="fl subject-list-option" id="homework_apply_status_<%=homework.id %>">
|
||||
<% ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, homework.id).first %>
|
||||
<% if ah.nil? %>
|
||||
<%= link_to("请求分享", apply_for_homework_user_path(User.current.id,:homework_id => homework.id), :class => 'green_btn_share c_white', :remote => true) %>
|
||||
<%= link_to("请求分享", apply_homework_user_path(User.current.id,:homework_id => homework.id), :class => 'green_btn_share c_white', :remote => true) %>
|
||||
<% elsif ah.status == 1 %>
|
||||
待审核
|
||||
<% elsif ah.status == 2 %>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<div>
|
||||
<div class="ni_con">
|
||||
<p class="mt30">
|
||||
<% if status == 1 %>
|
||||
您的分享请求暂未通过审核,暂时不可发送至课程。
|
||||
<% elsif status == 2 %>
|
||||
您选中的作业目前为私有作业,请点击“请求分享”按钮向题目的作者发送分享请求吧!祝您成功:)
|
||||
<% elsif status == 3 %>
|
||||
您的分享请求已被老师拒绝,不可发送至课程。
|
||||
<% end %>
|
||||
</p>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="hideModal();" style="margin-bottom: 10px; margin-left: 60px; color: #fff;" >
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -237,7 +237,8 @@
|
|||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">您有了新的引用作业申请:</span>
|
||||
</li>
|
||||
<li class="homepageHomeworkContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<span title='<%=User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"" %>' class ='#{ma.viewed==0 ? "newsBlack" : "newsGrey"}'><%=User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"" %></span>
|
||||
<% content = ma.content.nil? ? '' : ':'+ ma.content.to_s %>
|
||||
<span title='<%=User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}" %>' class ='#{ma.viewed==0 ? "newsBlack" : "newsGrey"}'><%=User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}" %></span>
|
||||
<!--:onmouseover => "message_titile_show($(this),event)",-->
|
||||
<!--:onmouseout => "message_titile_hide($(this))" %>-->
|
||||
</a>
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
<% if @state == 1 %>
|
||||
alert("您还未登录");
|
||||
<% elsif @state == 2 %>
|
||||
alert("申请成功,请等待审核");
|
||||
$("#homework_apply_status_<%=@homework.id %>").html("待审核");
|
||||
<% elsif @state == 3 %>
|
||||
alert("您已经发送过申请了,请耐心等待");
|
||||
hideModal();
|
||||
alert("您还未登录");
|
||||
<% elsif @state == 2 || @state == 3 %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/apply_for_homework', :locals => {:homework => @homework, :state => @state}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
$("#homework_apply_status_<%=@homework.id %>").html("待审核");
|
||||
<% end %>
|
|
@ -0,0 +1,10 @@
|
|||
<% if @state == 1 %>
|
||||
alert("您还未登录");
|
||||
<% elsif @state == 2 %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/apply_homework', :locals => {:homework => @homework}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
<% end %>
|
|
@ -1,9 +1,10 @@
|
|||
<% if @status == 1 %>
|
||||
alert("您的申请尚未通过审核,暂时不可发送至课程");
|
||||
<% elsif @status == 2 %>
|
||||
alert("该作业是私有的,请先提交申请并通过审核后再发送");
|
||||
<% elsif @status == 3 %>
|
||||
alert("您的申请已被拒绝,不可发送至课程");
|
||||
<% if @status == 1 || @status == 2 || @status == 3 %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_notice', :locals => {:status => @status}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
<% else %>
|
||||
<% if params[:is_observe].nil? %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>');
|
||||
|
|
|
@ -515,6 +515,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get
|
||||
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
|
||||
match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :get
|
||||
match 'apply_homework', :to => 'users#apply_homework', :via => :get
|
||||
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
|
||||
match 'student_homeworks', :to => 'users#student_homeworks', :via => :get
|
||||
get 'user_import_homeworks'
|
||||
|
|
|
@ -1492,4 +1492,5 @@ a.st_down{ display: block; width:8px; float:left; height:13px; background:url(..
|
|||
a.st_img { display:block;width:32px; height:32px; border:1px solid #CCC; padding:1px;}
|
||||
|
||||
.green_btn_share{ background:#28be6c; padding:2px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
|
||||
.apply_content{ border:1px solid #ddd;line-height: 16px; height:80px;width:420px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue