Merge branch 'szzh' into develop
This commit is contained in:
commit
db5b1e4192
|
@ -71,7 +71,7 @@ class BlogCommentsController < ApplicationController
|
||||||
else#如果是回复被删,
|
else#如果是回复被删,
|
||||||
if params[:course_id] #如果带了course_id过来了,那么这是要跳到课程大纲去的
|
if params[:course_id] #如果带了course_id过来了,那么这是要跳到课程大纲去的
|
||||||
@article.delete
|
@article.delete
|
||||||
redirect_to show_course_outline_course_path(:id=>params[:course_id])
|
redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||||
else
|
else
|
||||||
root = @article.root
|
root = @article.root
|
||||||
@article.delete
|
@article.delete
|
||||||
|
@ -131,7 +131,7 @@ class BlogCommentsController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的
|
if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的
|
||||||
redirect_to show_course_outline_course_path(:id=>params[:course_id])
|
redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||||
else
|
else
|
||||||
redirect_to user_blog_blog_comment_path(:user_id=>@article.author_id,:blog_id=>@article.blog_id,:id=>@article)
|
redirect_to user_blog_blog_comment_path(:user_id=>@article.author_id,:blog_id=>@article.blog_id,:id=>@article)
|
||||||
end
|
end
|
||||||
|
|
|
@ -740,7 +740,7 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
#显示课程大纲
|
#显示课程大纲
|
||||||
def show_course_outline
|
def syllabus
|
||||||
@article = BlogComment.find(@course.outline)
|
@article = BlogComment.find(@course.outline)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {render :layout => 'base_courses'}
|
format.html {render :layout => 'base_courses'}
|
||||||
|
|
|
@ -368,12 +368,22 @@ class UsersController < ApplicationController
|
||||||
if User.current == @user
|
if User.current == @user
|
||||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||||
user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
||||||
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
|
|
||||||
if @is_teacher
|
#判断当前用户在当前课程的身份
|
||||||
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
|
visibleCourse = @user.courses.empty? ? [] : @user.courses.visible
|
||||||
else
|
homework_ids = []
|
||||||
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
visibleCourse.each do |course|
|
||||||
|
if User.current.allowed_to?(:as_teacher,course)
|
||||||
|
homeworks = HomeworkCommon.where("course_id = #{course.id}")
|
||||||
|
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
|
||||||
|
else
|
||||||
|
homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'")
|
||||||
|
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")"
|
||||||
|
@homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10)
|
||||||
|
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
|
||||||
@is_in_course = params[:is_in_course].to_i || 0
|
@is_in_course = params[:is_in_course].to_i || 0
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<div class="f16 fontBlue fb fl">请选择课程大纲</div>
|
<div class="f16 fontBlue fb fl">请选择课程大纲</div>
|
||||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>-->
|
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>-->
|
||||||
<div class="fl">
|
<div class="fl">
|
||||||
<form class="blogSearchBox">
|
<div class="blogSearchBox">
|
||||||
<input type="text" name="course_outline_search" id="course_outline_search" placeholder="请输入大纲名称搜索" class="blogSearchContent" />
|
<input type="text" name="course_outline_search" id="course_outline_search" placeholder="请输入大纲名称搜索" class="blogSearchContent" />
|
||||||
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
|
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
|
||||||
<!--<input class="searchIconPopup" name="commit" onfocus="this.blur();" style="border-style:none" type="submit" value="">-->
|
<!--<input class="searchIconPopup" name="commit" onfocus="this.blur();" style="border-style:none" type="submit" value="">-->
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="f12 c_red fl mb8" id="course_outline_hint" style="display: none">未搜索到对应大纲,请重新输入</span>
|
<span class="f12 c_red fl mb8" id="course_outline_hint" style="display: none">未搜索到对应大纲,请重新输入</span>
|
||||||
<%= form_tag(url_for(:controller=>'courses',:action=>'set_course_outline',:id=>course.id),:method=>'post',:remote=>'true') do %>
|
<%= form_tag(url_for(:controller=>'courses',:action=>'set_course_outline',:id=>course.id),:method=>'post',:remote=>'true') do %>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
hideModal();
|
hideModal();
|
||||||
<%if @course.tea_id == User.current.id && @course.outline == 0 %>
|
<%if @course.tea_id == User.current.id && @course.outline == 0 %>
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#course_outline_bar").html('<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>')
|
$("#course_outline_bar").html('<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>')
|
||||||
<%end %>
|
<%end %>
|
||||||
<%if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%>
|
<%if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%>
|
||||||
window.location.href='<%=show_course_outline_course_path(@course) %>';
|
window.location.href='<%=syllabus_course_path(@course) %>';
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -22,8 +22,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt5">
|
<div class="mt5">
|
||||||
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">
|
<!--<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">-->
|
||||||
<%= l(:label_technical_support) %>白 羽</a>
|
<%#= l(:label_technical_support) %>
|
||||||
|
<!--白 羽</a>-->
|
||||||
|
<a target="hiddentab" href="http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad" style="color: #269ac9;">
|
||||||
|
请加入:师姐答疑群</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="side_bottom"></div>
|
<div class="side_bottom"></div>
|
||||||
|
|
|
@ -89,11 +89,11 @@
|
||||||
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
|
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
|
||||||
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
|
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
|
||||||
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
|
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
|
||||||
<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||||
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course)%>
|
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%>
|
||||||
<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||||
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public?%>
|
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%>
|
||||||
<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||||
<%else%>
|
<%else%>
|
||||||
<%end %>
|
<%end %>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -554,14 +554,14 @@
|
||||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您增加了新的课程成员:</span>
|
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您增加了新的课程成员:</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%= link_to User.find(ma.course_message_id), user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
<%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
||||||
:onmouseover => "message_titile_show($(this),event)",
|
:onmouseover => "message_titile_show($(this),event)",
|
||||||
:onmouseout => "message_titile_hide($(this))" %></a>
|
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||||
</li>
|
</li>
|
||||||
<div style="display: none" class="message_title_red system_message_style">
|
<div style="display: none" class="message_title_red system_message_style">
|
||||||
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
|
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
|
||||||
<p>您增加了新的课程成员,详情如下:</p>
|
<p>您增加了新的课程成员,详情如下:</p>
|
||||||
<p>成员:<%= User.find(ma.course_message_id) %></p>
|
<p>成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %></p>
|
||||||
<p>课程名称:<%= ma.course.name %></p>
|
<p>课程名称:<%= ma.course.name %></p>
|
||||||
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
|
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
|
||||||
<p>课程ID:<%= ma.course.id %></p>
|
<p>课程ID:<%= ma.course.id %></p>
|
||||||
|
|
|
@ -792,7 +792,7 @@ RedmineApp::Application.routes.draw do
|
||||||
get 'course_outline'
|
get 'course_outline'
|
||||||
post 'search_course_outline'
|
post 'search_course_outline'
|
||||||
post 'set_course_outline'
|
post 'set_course_outline'
|
||||||
get 'show_course_outline'
|
get 'syllabus'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
match 'join_private_courses', :via => [:get, :post]
|
match 'join_private_courses', :via => [:get, :post]
|
||||||
|
|
1766
db/schema.rb
1766
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue