diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index e0bd9582d..a692acc12 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -140,7 +140,11 @@ private end def find_board_if_available - @board = @project.boards.find(params[:id]) if params[:id] + if @project + @board = @project.boards.find(params[:id]) if params[:id] + elsif @course + @board = @course.boards.find(params[:id]) if params[:id] + end rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e10d6df88..9db479eb5 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -155,7 +155,7 @@ class CoursesController < ApplicationController respond_to do |format| format.html { - render :layout => 'base' + render :layout => 'course_base' scope = Course unless params[:closed] scope = scope.active diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 2915ff8f8..90e0d937c 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -112,10 +112,19 @@ class MessagesController < ApplicationController (render_403; return false) unless @message.destroyable_by?(User.current) r = @message.to_param @message.destroy - if @message.parent - redirect_to board_message_path(@board, @message.parent, :r => r) - else - redirect_to project_board_path(@project, @board) + # modify by nwb + if @project + if @message.parent + redirect_to board_message_path(@board, @message.parent, :r => r) + else + redirect_to project_board_path(@project, @board) + end + elsif @course + if @message.parent + redirect_to board_message_path(@board, @message.parent, :r => r) + else + redirect_to course_board_path(@course, @board) + end end end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 8b3692449..a7bf1edb8 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -1,5 +1,5 @@ class SchoolController < ApplicationController - + layout 'course_base' before_filter :require_admin, :only => :upload_logo def upload diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index e971970bc..84aff1c25 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -26,11 +26,11 @@ module CoursesHelper end # 返回学生数量,即roles表中定义的Reporter - def studentCount project - searchStudent(project).count + #def studentCount project + # searchStudent(project).count # or # searchStudent(project).count - end + # end # 判断用户是否是课程的管理员 # add by nwb diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index 6b720229a..8e1a7950d 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -43,7 +43,8 @@

<%= content_tag('span', "#{garble @course.members.count}", :class => "info") %> - <%= content_tag('span', l(:label_x_member, :count => @course.members.count)) %> + <%#= content_tag('span', l(:label_x_member, :count => @course.members.count)) %> + <%= content_tag('span', l(:label_x_member, :count => studentCount(@course)+teacherCount(@course))) %>

diff --git a/app/views/layouts/base_stores.html.erb b/app/views/layouts/base_stores.html.erb index 05b66dfce..58f763756 100644 --- a/app/views/layouts/base_stores.html.erb +++ b/app/views/layouts/base_stores.html.erb @@ -1,3 +1,8 @@ +<% @nav_dispaly_home_path_label = 1 + @nav_dispaly_main_course_label = 1 + @nav_dispaly_main_project_label = 1 + @nav_dispaly_main_contest_label = 1 %> +<% @nav_dispaly_forum_label = 1%> diff --git a/app/views/layouts/course_base.html.erb b/app/views/layouts/course_base.html.erb new file mode 100644 index 000000000..198252a52 --- /dev/null +++ b/app/views/layouts/course_base.html.erb @@ -0,0 +1,49 @@ +<% @nav_dispaly_course_all_label = 1 + @nav_dispaly_forum_label = 1 + @nav_dispaly_course_label = nil + @nav_dispaly_store_all_label = 1 %> + + + + + <%=h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> + <%= javascript_include_tag "jquery.leanModal.min" %> + <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + + <%= yield :header_tags -%> + + +
+
+
+ <%=render :partial => 'layouts/base_header'%> +
+
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+ <%=render :partial => 'layouts/base_footer'%> +
+ +
+
+ + + + + +
+
+<%= call_hook :view_layouts_base_body_bottom %> + + diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 2ef952f6d..7b5d17e43 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -10,7 +10,7 @@

<%=h @news.title %>

-<% if authorize_for('news', 'edit') %> +<% if authorize_for_course('news', 'edit') %>