Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
0815cde772
|
@ -163,9 +163,9 @@ class MembersController < ApplicationController
|
|||
#给新成员和老师发送加入课程的消息,发送者id放在CourseMessage的course_message_id字段中
|
||||
#course_message_type设置为JoinCourse
|
||||
#status = 0 表示给学生发,status = 1表示给老师发
|
||||
course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :viewed => false, :status => 0)
|
||||
course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :content => role, :viewed => false, :status => 0)
|
||||
course_join.save
|
||||
CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse", :viewed => false, status => 1)
|
||||
CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse",:content => role, :viewed => false, :status => 1)
|
||||
|
||||
members << member
|
||||
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
|
||||
|
|
|
@ -628,10 +628,10 @@ module CoursesHelper
|
|||
|
||||
#重启、关闭课程按钮
|
||||
def set_course_time course
|
||||
id = "finish_course_#{course.id}"
|
||||
linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
|
||||
desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
|
||||
link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
|
||||
# id = "finish_course_#{course.id}"
|
||||
# linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
|
||||
# desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
|
||||
# link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
|
||||
end
|
||||
|
||||
#加入课程、退出课程按钮
|
||||
|
|
|
@ -327,7 +327,7 @@ class CoursesService
|
|||
end
|
||||
else
|
||||
if params[:course_password] == course.password
|
||||
if params[:role] == "10"
|
||||
if params[:role] == "10" || params[:role] == nil
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
|
|
|
@ -4,7 +4,7 @@ $("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@c
|
|||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功");
|
||||
hidden_join_course_form();
|
||||
hideModal();
|
||||
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 1 %>
|
||||
|
|
|
@ -18,13 +18,6 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
function clickSure()
|
||||
{
|
||||
if ($('#new_join_course').submit())
|
||||
{
|
||||
hideModal("#popbox02");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
@ -40,7 +33,7 @@
|
|||
<label>请输入课程密码:</label>
|
||||
<%= text_field_tag 'course_password', nil, :style=>'width:300px;'%>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="clickSure();" >
|
||||
<a href="javascript:" class="tijiao" onclick="$('#new_join_course').submit();" >
|
||||
确 定
|
||||
</a>
|
||||
<a href="javascript:" class="tijiao" onclick="clickCanel();">
|
||||
|
|
|
@ -426,10 +426,16 @@
|
|||
</p>
|
||||
<p>课程名称:<%= ma.course_message.name %></p>
|
||||
<p>开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %></p>
|
||||
<div class="fl">课程描述:</div>
|
||||
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
|
||||
<p>学时总数:<%= ma.course_message.class_period%></p>
|
||||
<p>课程ID:<span style="color:red;"><%= ma.course_message.id %></span></p>
|
||||
<p>课程密码:<span style="color:red;"><%= ma.course_message.password %></span></p>
|
||||
<p>学时总数:<%= ma.course_message.class_period %></p>
|
||||
<p>创建时间:<%= format_time(ma.course_message.created_at) %></p>
|
||||
<p>您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。</p>
|
||||
<% if ma.course_message.is_public %>
|
||||
<p>您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。</p>
|
||||
<% else %>
|
||||
<p>您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
|
@ -505,7 +511,7 @@
|
|||
<% end %>
|
||||
|
||||
<!--被老师拉入课程-->
|
||||
<% if ma.course_message_type == "JoinCourse" %>
|
||||
<% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %></a>
|
||||
|
@ -521,8 +527,44 @@
|
|||
</li>
|
||||
<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? %>
|
||||
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
|
||||
<p>课程描述:<%= ma.course.description.blank? ? '无':ma.course.description %></p>
|
||||
<% teacher = User.find(ma.course_message_id) %>
|
||||
<p><%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:</p>
|
||||
<p>课程名称:<%= ma.course.name %></p>
|
||||
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
|
||||
<p>课程ID:<%= ma.course.id %></p>
|
||||
<p>课时总数:<%= ma.course.class_period %></p>
|
||||
<% else %>
|
||||
<p>
|
||||
您已经被移出该私有课程,非课程成员没有权限访问私有课程
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<!--被老师拉入课程-->
|
||||
<% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您增加了新的课程成员:</span>
|
||||
</li>
|
||||
<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"}",
|
||||
:onmouseover => "message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||
</li>
|
||||
<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? %>
|
||||
<p>您增加了新的课程成员,详情如下:</p>
|
||||
<p>成员:<%= User.find(ma.course_message_id) %></p>
|
||||
<p>课程名称:<%= ma.course.name %></p>
|
||||
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
|
||||
<p>课程ID:<%= ma.course.id %></p>
|
||||
<p>课时总数:<%= ma.course.class_period %></p>
|
||||
<% else %>
|
||||
<p>
|
||||
|
@ -551,8 +593,12 @@
|
|||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
|
||||
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
|
||||
<p>课程描述:<%= ma.course.description.blank? ? '无' : ma.course.description %></p>
|
||||
<p>您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:</p>
|
||||
<p>课程名称:<%= ma.course.name %></p>
|
||||
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
|
||||
<% if !ma.content.nil? %>
|
||||
<p>担任角色:<%= ma.content %></p>
|
||||
<% end %>
|
||||
<p>学时总数:<%= ma.course.class_period %></p>
|
||||
<% else %>
|
||||
<p>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<% if ma.project.is_public? || User.current.member_of?(ma.project) %>
|
||||
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
|
||||
<p>
|
||||
项目名称:<%= ma.project.name %>
|
||||
</p>
|
||||
|
@ -69,7 +69,7 @@
|
|||
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<% if ma.project.is_public? || User.current.member_of?(ma.project) %>
|
||||
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
|
||||
<p>
|
||||
项目名称:<%= ma.project.name %>
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue