diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index bdbbb8e37..a301d270d 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -42,12 +42,19 @@ class BoardsController < ApplicationController elsif @course if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) @boards = @course.boards.includes(:last_message => :author).all - @boards = [] << @boards[0] if @boards.any? + if @course.boards.empty? + @board = @course.boards.build + @board.name = " #{l(:label_borad_course) }" + @board.description = @course.name.to_s + @board.project_id = -1 + if @board.save + @boards = @course.boards.includes(:last_message => :author).all + end + end if @boards.size == 1 - @board = @boards.first - show and return + @board = @course.boards.first end - render :layout => 'base_courses' + show and return else render_403 end @@ -65,7 +72,7 @@ class BoardsController < ApplicationController 'replies' => "#{Message.table_name}.replies_count", 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)" - @topic_count = @board.topics.count + @topic_count = @board ? @board.topics.count : 0 if @project @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] @topics = @board.topics. @@ -77,14 +84,13 @@ class BoardsController < ApplicationController preload(:author, {:last_reply => :author}). all elsif @course - board_topics = @board.topics. - reorder("#{Message.table_name}.sticky DESC"). + board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC"). includes(:last_reply). # limit(@topic_pages.per_page). # offset(@topic_pages.offset). order(sort_clause). preload(:author, {:last_reply => :author}). - all + all : [] @topics = paginateHelper board_topics,10 end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 680a13963..3d6772ea8 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -81,9 +81,10 @@ class WordsController < ApplicationController @journal_destroyed = JournalsForMessage.delete_message(params[:object_id]) if @journal_destroyed.jour_type == "Bid" @bid = Bid.find(@journal_destroyed.jour_id) - end - if @bid @jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count + elsif @journal_destroyed.jour_type == "Course" + @course = Course.find @journal_destroyed.jour_id + @jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count end respond_to do |format| format.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 20175dc57..484a3189c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -633,7 +633,7 @@ module ApplicationHelper def principals_check_box_tags_li(name, principals) s = '' principals.each do |principal| - s << "
  • #{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id), :class => "c_blue" }
  • \n" + s << "
  • #{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id) }
  • \n" end s.html_safe end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 34c6dad15..06b154d36 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -32,7 +32,7 @@ module MembersHelper #获取项目可邀请的成员列表 def render_project_members project - if params[:q] && params[:q] != "" + if params[:q] && params[:q].lstrip.rstrip != "" scope = Principal.active.sorted.not_member_of(project).like(params[:q]) else scope = [] @@ -48,7 +48,7 @@ module MembersHelper # add by nwb # 课程可添加的成员列表 def render_principals_for_new_course_members(course) - if params[:q] && params[:q] != "" + if params[:q] && params[:q].lstrip.rstrip != "" scope = Principal.active.sorted.not_member_of_course(course).like(params[:q]) else scope = [] @@ -63,19 +63,6 @@ module MembersHelper s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links") end - # 项目配置中添加成员列表 - def render_principals_for_new_project_members(project) - scope = Principal.active.sorted.not_member_of(project).like(params[:q]) - principals = paginateHelper scope,10 - s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') - - links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true) {|text, parameters, options| - link_to text, appliedproject_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true - } - - s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links") - end - # 新申请加入项目成员列表 def render_principals_for_applied_members_new project scope = project.applied_projects.map(&:user) diff --git a/app/views/courses/_searchmembers.html.erb b/app/views/courses/_searchmembers.html.erb index c6b577c8d..1956f34c4 100644 --- a/app/views/courses/_searchmembers.html.erb +++ b/app/views/courses/_searchmembers.html.erb @@ -1,5 +1,5 @@ <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生姓名、学号进行搜索'%> + <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生昵称、姓名、学号进行搜索'%> <% if @group %> <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %> diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 2f4ec56a0..c105dc2b8 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -17,11 +17,12 @@

    (<%= l(:label_memos_max_length) %>)

    -

    +

    <%= l(:label_attachment_plural) %>
    <%= render :partial => 'attachments/form', :locals => {:container => @memo} %>

    +
    <%= f.submit :value => l(:label_memo_create) %> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %> diff --git a/app/views/layouts/_new_header.html.erb b/app/views/layouts/_new_header.html.erb index a430a8e8f..489612c9a 100644 --- a/app/views/layouts/_new_header.html.erb +++ b/app/views/layouts/_new_header.html.erb @@ -18,8 +18,8 @@ <% if User.current.logged? -%>
  • - <%= link_to_user_header(User.current,false,:class =>'parent')%> -