parent
9ebed65fde
commit
6b758375f8
|
@ -1,5 +1,5 @@
|
|||
class CoursesController < ApplicationController
|
||||
layout 'base_courses'
|
||||
# layout 'base_courses'
|
||||
include CoursesHelper
|
||||
include ActivitiesHelper
|
||||
helper :activities
|
||||
|
@ -73,6 +73,7 @@ class CoursesController < ApplicationController
|
|||
if @course.errors.full_messages.count <= 0
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# render :layout => 'base_courses'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to settings_course_url(@course)
|
||||
}
|
||||
|
@ -82,7 +83,7 @@ class CoursesController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.html {
|
||||
settings
|
||||
render :action => 'settings'
|
||||
redirect_to settings_course_url(@course)
|
||||
}
|
||||
format.api { render_validation_errors(@course) }
|
||||
end
|
||||
|
@ -407,6 +408,10 @@ class CoursesController < ApplicationController
|
|||
|
||||
@roles = Role.givable.all[3..5]
|
||||
@members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
respond_to do |format|
|
||||
format.html { render :layout => 'base_courses' }
|
||||
format.api { render_validation_errors(@course) }
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
|
@ -424,6 +429,7 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_courses'
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
if params[:continue]
|
||||
redirect_to new_course_url(attrs, :course => '0')
|
||||
|
|
|
@ -20,7 +20,7 @@ module CoursesHelper
|
|||
|
||||
# 返回教师数量,即roles表中定义的Manager
|
||||
def teacherCount project
|
||||
project.members.count - studentCount(project).to_i
|
||||
project ? project.members.count - studentCount(project).to_i : 0
|
||||
# or
|
||||
# searchTeacherAndAssistant(project).count
|
||||
end
|
||||
|
@ -152,7 +152,7 @@ module CoursesHelper
|
|||
# 学生人数计算
|
||||
# add by nwb
|
||||
def studentCount course
|
||||
course.student.count.to_s#course.student.count
|
||||
course ? course.student.count.to_s : 0#course.student.count
|
||||
end
|
||||
|
||||
#课程成员数计算
|
||||
|
@ -782,6 +782,7 @@ module CoursesHelper
|
|||
end
|
||||
|
||||
def visable_attachemnts_incourse course
|
||||
return[] unless course
|
||||
result = []
|
||||
course.attachments.each do |attachment|
|
||||
if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin?
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => @message.nil? ? 0: @message.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '91%',
|
||||
:width => '90%',
|
||||
:height => 300,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
|
|
Loading…
Reference in New Issue