题库的私有作业显示作业详情
This commit is contained in:
parent
c3ec7289b7
commit
820e594fec
|
@ -727,21 +727,21 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_homework_detail
|
def show_homework_detail
|
||||||
homework = HomeworkCommon.find params[:homework].to_i
|
@homework = HomeworkCommon.find params[:homework].to_i
|
||||||
if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) && User.current != homework.user
|
# if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) && User.current != homework.user
|
||||||
ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework].to_i)
|
# ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework].to_i)
|
||||||
if ah.empty?
|
# if ah.empty?
|
||||||
@status = 2
|
# @status = 2
|
||||||
@homework = nil
|
# @homework = nil
|
||||||
elsif ah.first.status != 2
|
# elsif ah.first.status != 2
|
||||||
@status = ah.first.status
|
# @status = ah.first.status
|
||||||
@homework = nil
|
# @homework = nil
|
||||||
elsif ah.first.status == 2
|
# elsif ah.first.status == 2
|
||||||
@homework = homework
|
# @homework = homework
|
||||||
end
|
# end
|
||||||
else
|
# else
|
||||||
@homework = homework
|
# @homework = homework
|
||||||
end
|
# end
|
||||||
@is_import = params[:is_import]
|
@is_import = params[:is_import]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="subjectDetail fl mt10">
|
<div class="subjectDetail fl mt10">
|
||||||
<div class="subjectInfo">题目信息</div>
|
<div class="subjectInfo">题目信息</div>
|
||||||
<div class="subject-content-wrapper">
|
<div class="subject-content-wrapper">
|
||||||
<% if homework.nil? && status == 0 %>
|
<% if homework.nil? %>
|
||||||
<span id="homework_notice_span"><span class="center db">本题库遵循创作共用许可证</span><br>
|
<span id="homework_notice_span"><span class="center db">本题库遵循创作共用许可证</span><br>
|
||||||
|
|
||||||
教师给学生出题本质上是一种创作行为,题目的作者通常为此付出大量时间和精力。好的题目不仅能加深学生对知识点的理解,还能激发学生兴趣,提升学习效率。为此,本网站的题库许可证基于创作共用许可证( Creative Commons License )建立,其核心条款包括:<br/><br/>
|
教师给学生出题本质上是一种创作行为,题目的作者通常为此付出大量时间和精力。好的题目不仅能加深学生对知识点的理解,还能激发学生兴趣,提升学习效率。为此,本网站的题库许可证基于创作共用许可证( Creative Commons License )建立,其核心条款包括:<br/><br/>
|
||||||
|
@ -14,14 +14,14 @@
|
||||||
|
|
||||||
对此许可证的支持或反对,请在网站中留言,我们不断完善,谢谢!
|
对此许可证的支持或反对,请在网站中留言,我们不断完善,谢谢!
|
||||||
</span>
|
</span>
|
||||||
<% elsif homework.nil? && status == 1 %>
|
<!-- <%# elsif homework.nil? && status == 1 %>
|
||||||
<span class="c_red">您选中的作业目前为私有作业,您的分享请求已发送至老师,请耐心等待老师的同意。</span>
|
<span class="c_red">您选中的作业目前为私有作业,您的分享请求已发送至老师,请耐心等待老师的同意。</span>
|
||||||
<% elsif homework.nil? && status == 2 %>
|
<%# elsif homework.nil? && status == 2 %>
|
||||||
<span class="c_red">您选中的作业目前为私有作业,请点击“请求分享”按钮向题目的作者发送分享请求吧!<br/>
|
<span class="c_red">您选中的作业目前为私有作业,请点击“请求分享”按钮向题目的作者发送分享请求吧!<br/>
|
||||||
祝您成功:)
|
祝您成功:)
|
||||||
</span>
|
</span>
|
||||||
<% elsif homework.nil? && status == 3 %>
|
<%# elsif homework.nil? && status == 3 %>
|
||||||
<span class="c_red">您选中的作业目前为私有作业,您的分享请求已被老师拒绝,暂时不可查看作业详情。</span>
|
<span class="c_red">您选中的作业目前为私有作业,您的分享请求已被老师拒绝,暂时不可查看作业详情。</span>-->
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="subjectIntro mb15">标题:<%=homework.name %><br />
|
<div class="subjectIntro mb15">标题:<%=homework.name %><br />
|
||||||
来源:<%=homework.course.name %><br />
|
来源:<%=homework.course.name %><br />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<% if @is_import.to_i == 1 %>
|
<% if @is_import.to_i == 1 %>
|
||||||
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>");
|
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>");
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework,:status=>@status}) %>");
|
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework}) %>");
|
||||||
<% end %>
|
<% end %>
|
|
@ -6,7 +6,7 @@ $("#homework_search_input").html("<%=escape_javascript(render :partial=>'homewor
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>''})%>');
|
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>''})%>');
|
||||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil, :status => 0}) %>");
|
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||||
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
|
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
|
||||||
$("#homework_type_all").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>');
|
$("#homework_type_all").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>');
|
||||||
$("#homework_type_nor").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>');
|
$("#homework_type_nor").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>');
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %>
|
<%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %>
|
||||||
</div>
|
</div>
|
||||||
<div id="homework_repository_detail">
|
<div id="homework_repository_detail">
|
||||||
<%=render :partial => 'homework_repository_detail', :locals => {:homework => nil, :status => 0} %>
|
<%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*$("#homework_repository").html('<%#= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');*/
|
/*$("#homework_repository").html('<%#= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');*/
|
||||||
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => 0,:property => @property,:search=>''})%>');
|
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => 0,:property => @property,:search=>''})%>');
|
||||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil, :status => 0}) %>");
|
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||||
|
|
|
@ -5,5 +5,5 @@ $("#homework_detail_information").html("<%=escape_javascript(render :partial =>
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>@search})%>');
|
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>@search})%>');
|
||||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil, :status => 0}) %>");
|
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||||
<% end %>
|
<% end %>
|
Loading…
Reference in New Issue