1、搜索课程报500

2、课程讨论区描述换行显示
This commit is contained in:
sw 2015-04-10 15:01:33 +08:00
parent 9ebed65fde
commit 6b758375f8
3 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,5 @@
class CoursesController < ApplicationController class CoursesController < ApplicationController
layout 'base_courses' # layout 'base_courses'
include CoursesHelper include CoursesHelper
include ActivitiesHelper include ActivitiesHelper
helper :activities helper :activities
@ -73,6 +73,7 @@ class CoursesController < ApplicationController
if @course.errors.full_messages.count <= 0 if @course.errors.full_messages.count <= 0
respond_to do |format| respond_to do |format|
format.html { format.html {
# render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to settings_course_url(@course) redirect_to settings_course_url(@course)
} }
@ -82,7 +83,7 @@ class CoursesController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { format.html {
settings settings
render :action => 'settings' redirect_to settings_course_url(@course)
} }
format.api { render_validation_errors(@course) } format.api { render_validation_errors(@course) }
end end
@ -407,6 +408,10 @@ class CoursesController < ApplicationController
@roles = Role.givable.all[3..5] @roles = Role.givable.all[3..5]
@members = @course.member_principals.includes(:roles, :principal).all.sort @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 else
render_403 render_403
end end
@ -424,6 +429,7 @@ class CoursesController < ApplicationController
else else
respond_to do |format| respond_to do |format|
format.html { format.html {
render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
if params[:continue] if params[:continue]
redirect_to new_course_url(attrs, :course => '0') redirect_to new_course_url(attrs, :course => '0')

View File

@ -20,7 +20,7 @@ module CoursesHelper
# 返回教师数量即roles表中定义的Manager # 返回教师数量即roles表中定义的Manager
def teacherCount project def teacherCount project
project.members.count - studentCount(project).to_i project ? project.members.count - studentCount(project).to_i : 0
# or # or
# searchTeacherAndAssistant(project).count # searchTeacherAndAssistant(project).count
end end
@ -152,7 +152,7 @@ module CoursesHelper
# 学生人数计算 # 学生人数计算
# add by nwb # add by nwb
def studentCount course def studentCount course
course.student.count.to_s#course.student.count course ? course.student.count.to_s : 0#course.student.count
end end
#课程成员数计算 #课程成员数计算
@ -782,6 +782,7 @@ module CoursesHelper
end end
def visable_attachemnts_incourse course def visable_attachemnts_incourse course
return[] unless course
result = [] result = []
course.attachments.each do |attachment| course.attachments.each do |attachment|
if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin? if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin?

View File

@ -44,7 +44,7 @@
<%= f.kindeditor :content, :editor_id => 'message_content_editor', <%= f.kindeditor :content, :editor_id => 'message_content_editor',
:owner_id => @message.nil? ? 0: @message.id, :owner_id => @message.nil? ? 0: @message.id,
:owner_type => OwnerTypeHelper::MESSAGE, :owner_type => OwnerTypeHelper::MESSAGE,
:width => '91%', :width => '90%',
:height => 300, :height => 300,
:class => 'talk_text fl', :class => 'talk_text fl',
:input_html => { :id => 'message_content', :input_html => { :id => 'message_content',