diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0a3c61c90..1a561006a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -107,7 +107,7 @@ class CoursesController < ApplicationController courses = Course.visible @courses = paginateHelper courses,10 else - courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'") + courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc") @courses = paginateHelper courses,10 end @name = params[:name] diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 8a1b3bbe0..0acf75c62 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -215,11 +215,11 @@ update end end - unless @repository.gitlab? - # redirect_to to_gitlab_project_repository_path(@project, @repository) - render :to_gitlab - return - end + # unless @repository.gitlab? + # # redirect_to to_gitlab_project_repository_path(@project, @repository) + # render :to_gitlab + # return + # end #if( !User.current.member_of?(@project) || @project.hidden_repo) @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? @@ -252,11 +252,10 @@ update project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT ip = RepositoriesHelper::REPO_IP_ADDRESS gitlab_address = Redmine::Configuration['gitlab_address'] - if @repository.type.to_s=="Repository::Gitlab" + if @repository.type.to_s == "Repository::Gitlab" @repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git" else - @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+ - @repository.url.slice(project_path_cut, @repository.url.length).to_s + @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s end if @course_tag == 1 render :action => 'show', :layout => 'base_courses' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 84364b4f6..01b126c26 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -609,6 +609,12 @@ module ApplicationHelper return @result end + # 判断版本库是否初始为gitlab + def rep_is_gitlab?(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") + return rep.blank? ? true :false + end + # 判断当前用户是否为项目管理员 def is_project_manager?(user_id, project_id) @result = false diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 41f25d1a3..48766813c 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -117,6 +117,22 @@ module ProjectsHelper end end + # 获取新增gitlab版本库 + def rep_gitlab(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") + end + + # 获取新项目的版本库地址 + def rep_gitlab_url(project) + gitlab_address = Redmine::Configuration['gitlab_address'] + url = gitlab_address.to_s+"/"+project.owner.to_s+"/"+project.identifier+"."+"git" + end + + # # 获取Forge历史版本库 + def rep_forge(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Git") + end + # Added by young def course_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, diff --git a/app/views/members/update.js.erb b/app/views/members/update.js.erb index c5ef983e7..7c27e39fc 100644 --- a/app/views/members/update.js.erb +++ b/app/views/members/update.js.erb @@ -2,6 +2,8 @@ $('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>'); <%elsif @course%> $('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); +$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>") +$("#student_number").html("<%= studentCount(@course) %>"); <%end%> hideOnLoad(); diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 7e39ad5fa..be178607f 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -17,7 +17,7 @@