|
|
|
@ -28,17 +28,25 @@ class BoardsController < ApplicationController
|
|
|
|
|
helper :watchers
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
@boards = @project.boards.includes(:last_message => :author).all
|
|
|
|
|
@boards = [] << @boards[0] if @boards.any?
|
|
|
|
|
if @boards.size == 1
|
|
|
|
|
@board = @boards.first
|
|
|
|
|
show and return
|
|
|
|
|
end
|
|
|
|
|
if @project.project_type == 1
|
|
|
|
|
render :layout => 'base_courses'
|
|
|
|
|
else
|
|
|
|
|
render :layout => false if request.xhr?
|
|
|
|
|
#modify by nwb
|
|
|
|
|
if @project
|
|
|
|
|
@boards = @project.boards.includes(:last_message => :author).all
|
|
|
|
|
@boards = [] << @boards[0] if @boards.any?
|
|
|
|
|
if @boards.size == 1
|
|
|
|
|
@board = @boards.first
|
|
|
|
|
show and return
|
|
|
|
|
end
|
|
|
|
|
render :layout => false if request.xhr?
|
|
|
|
|
elsif @course
|
|
|
|
|
@boards = @course.boards.includes(:last_message => :author).all
|
|
|
|
|
@boards = [] << @boards[0] if @boards.any?
|
|
|
|
|
if @boards.size == 1
|
|
|
|
|
@board = @boards.first
|
|
|
|
|
show and return
|
|
|
|
|
end
|
|
|
|
|
render :layout => 'base_courses'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
@ -60,10 +68,11 @@ class BoardsController < ApplicationController
|
|
|
|
|
preload(:author, {:last_reply => :author}).
|
|
|
|
|
all
|
|
|
|
|
@message = Message.new(:board => @board)
|
|
|
|
|
if @project.project_type ==1
|
|
|
|
|
render :action => 'show', :layout => 'base_courses'
|
|
|
|
|
else
|
|
|
|
|
#modify by nwb
|
|
|
|
|
if @project
|
|
|
|
|
render :action => 'show', :layout => !request.xhr?
|
|
|
|
|
elsif @course
|
|
|
|
|
render :action => 'show', :layout => 'base_courses'
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
format.atom {
|
|
|
|
@ -72,7 +81,12 @@ class BoardsController < ApplicationController
|
|
|
|
|
includes(:author, :board).
|
|
|
|
|
limit(Setting.feeds_limit.to_i).
|
|
|
|
|
all
|
|
|
|
|
render_feed(@messages, :title => "#{@project}: #{@board}")
|
|
|
|
|
if @project
|
|
|
|
|
render_feed(@messages, :title => "#{@project}: #{@board}")
|
|
|
|
|
elsif @course
|
|
|
|
|
render_feed(@messages, :title => "#{@course}: #{@board}")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|