From bfcb68efab7b818c6decf4207ef1bbb899f7a4c3 Mon Sep 17 00:00:00 2001 From: huangjingquan Date: Thu, 14 Nov 2013 19:29:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=20=E9=99=90=E5=88=B6=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E4=B8=8B=E4=BD=9C=E4=B8=9A=20=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=9D=83=E9=99=90=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 12 ++++++------ app/views/bids/_homework_list.html.erb | 2 ++ app/views/boards/index.html.erb | 2 +- app/views/layouts/base_courses.html.erb | 9 ++++++--- config/locales/zh.yml | 1 + 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 2d1d0bba7..dc4ccbc67 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -30,13 +30,15 @@ class BoardsController < ApplicationController def index @boards = @project.boards.includes(:last_message => :author).all # show the board if there is only one + unless @project.project_type == 1 if @boards.size == 1 @board = @boards.first show end + end if @project.project_type == 1 - render :layout => 'base_courses' - else + render :layout => 'base_courses' + else render :layout => false if request.xhr? end end @@ -85,12 +87,10 @@ class BoardsController < ApplicationController end end - def create + def create @board = @project.boards.build @board.safe_attributes = params[:board] - if @project.project_type == 1 - render :layout => 'base_courses' - end + if @board.save flash[:notice] = l(:notice_successful_create) #Modified by young diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 0a40e3d0e..ba6faa650 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -31,11 +31,13 @@ + <% unless User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>

<% options = {:author => true, :deletable => attach_delete(homework)} %> <%= render :partial => 'attachments/links', :locals => {:attachments => homework.attachments, :options => options} %>

+ <% end %> diff --git a/app/views/boards/index.html.erb b/app/views/boards/index.html.erb index c7e4f5b54..614066613 100644 --- a/app/views/boards/index.html.erb +++ b/app/views/boards/index.html.erb @@ -1,5 +1,5 @@
- <% if User.current.logged? %> + <% if User.current.logged? && User.current.member_of?(@project) %> <%= link_to l(:label_board_new), new_project_board_path(@project), :class => 'icon icon-add' %> <% end %>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 145457a61..7bcb78ad5 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -210,20 +210,23 @@