修改message_controller与课程相关方法及视图

This commit is contained in:
nwb 2014-06-12 10:53:34 +08:00
parent 863dec03d2
commit 517a29116f
3 changed files with 25 additions and 5 deletions

View File

@ -49,7 +49,7 @@ class MessagesController < ApplicationController
all
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @message.board.project.project_type ==1
if @course
render :action => "show", :layout => "base_courses"#by young
else
render :action => "show", :layout => "base_projects"#by young
@ -138,8 +138,14 @@ private
end
def find_board
@board = Board.find(params[:board_id], :include => :project)
#modify by nwb
@board = Board.find(params[:board_id])
if @board.project_id != -1 && @board.project_id != nil
@project = @board.project
elsif @board.course_id
@course = @board.course
end
rescue ActiveRecord::RecordNotFound
render_404
nil

View File

@ -92,7 +92,11 @@
</div>
<div class="memo-section">
<div class="memo-title <%= @topic.sticky? ? 'sticky' : '' %> <%= @topic.locked? ? 'locked' : '' %>">
<% if @project %>
<%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, project_boards_path(@topic.project) %>
<% elsif @course %>
<%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, course_boards_path(@topic.course) %>
<% end %>
</div>
<div class="memo-content">
<%= textilizable(@topic, :content) %>

View File

@ -118,10 +118,20 @@ Redmine::AccessControl.map do |map|
map.permission :comment_news, {:comments => :create}
end
#作业模块权限
map.project_module :bids do |map|
map.course_module :bids do |map|
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true
end
map.course_module :boards do |map|
map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true
map.permission :add_messages, {:messages => [:new, :reply, :quote]}
map.permission :edit_messages, {:messages => :edit}, :require => :member
map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin
map.permission :delete_messages, {:messages => :destroy}, :require => :member
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
end
#end
map.project_module :issue_tracking do |map|