parent
814233d245
commit
70901832a8
|
@ -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
|
||||
|
|
|
@ -88,8 +88,12 @@ class NewsController < ApplicationController
|
|||
def show
|
||||
@comments = @news.comments
|
||||
@comments.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
if @project.project_type == 1
|
||||
render :layout => 'base_courses'
|
||||
#modify by nwb
|
||||
if @news.course_id
|
||||
@course = Course.find(@news.course_id)
|
||||
if @course
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -29,6 +29,19 @@ module BoardsHelper
|
|||
breadcrumb links
|
||||
end
|
||||
|
||||
# add by nwb
|
||||
def course_board_breadcrumb(item)
|
||||
board = item.is_a?(Message) ? item.board : item
|
||||
links = [link_to(l(:label_board_plural), course_boards_path(item.course))]
|
||||
boards = board.ancestors.reverse
|
||||
if item.is_a?(Message)
|
||||
boards << board
|
||||
end
|
||||
links += boards.map {|ancestor| link_to(h(ancestor.name), course_board_path(ancestor.course, ancestor))}
|
||||
breadcrumb links
|
||||
end
|
||||
|
||||
|
||||
def boards_options_for_select(boards)
|
||||
options = []
|
||||
Board.board_tree(boards) do |board, level|
|
||||
|
|
|
@ -567,6 +567,7 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
resources :news, :except => [:show, :edit, :update, :destroy]
|
||||
resources :boards
|
||||
end # end of resources :courses
|
||||
match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback'
|
||||
match '/courses/search', :controller => 'courses', :action => 'search', :via => [:get, :post]
|
||||
|
|
Loading…
Reference in New Issue