diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index a7c0e7b95..b5c174b0c 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -10,7 +10,7 @@ class AvatarController < ApplicationController unless request.content_type == 'application/octet-stream' @source_type = params[:source_type] @source_id = params[:source_id] - @temp_file = params[:avatar][:image] + @temp_file = params[:avatar][:image] @image_file = @temp_file.original_filename else unless request.raw_post.nil? @@ -23,7 +23,7 @@ class AvatarController < ApplicationController #image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding) else @image_file=params[:filename] - end + end @temp_file = StringIO.new(@temp_file) end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 70794fa71..279975c77 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -39,17 +39,17 @@ class CoursesController < ApplicationController end limit = 15 course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id) - @orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit) - @org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count - # if course_org_ids.empty? - # @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) - # @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count - # else - # course_org_ids = "(" + course_org_ids.join(',') + ")" - # @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) - # @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count - # end - # @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count + #@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit) + #@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count + if course_org_ids.empty? + @orgs_not_in_course = User.current.organizations.where("name like ?",condition).page((params[:page].to_i || 1)).per(limit) + @org_count = @orgs_not_in_course.count + else + course_org_ids = "(" + course_org_ids.join(',') + ")" + @orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids} and organizations.name like ?", condition).page((params[:page].to_i || 1)).per(limit) + @org_count = @orgs_not_in_course.empty? ? 0 : @orgs_not_in_course.count + end + @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count @orgs_page = Paginator.new @org_count, limit,params[:page] @hint_flag = params[:hint_flag] #render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index bca9de22b..70a0b76b8 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -230,6 +230,7 @@ class FilesController < ApplicationController @order = "" @is_remote = false if params[:project_id] + @page = params[:page] ? params[:page].to_i + 1 : 2 @container_type = 0 if params[:sort] params[:sort].split(",").each do |sort_type| diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 91a0bc902..4aa959e81 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -412,6 +412,7 @@ class IssuesController < ApplicationController if params[:issue_id] @issue_id = params[:issue_id] end + @priorities = IssuePriority.active respond_to do |format| format.js end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 56ef460a0..9b7888bf2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -59,6 +59,19 @@ module ApplicationHelper end end + # 判断组织左侧展开或者隐藏 + def is_hide_org_left obj + if obj.nil? + return true + else + if obj.hide == 0 + return true + else + return false + end + end + end + # Time 2015-03-24 16:38:05 # Author lizanle # Description after save后需要进行资源记录的更新 diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index d4debb601..a759946f6 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -37,7 +37,10 @@