diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e321f2dc..af489ef8 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -37,6 +37,9 @@ class RepositoriesController < ApplicationController accept_rss_auth :revisions # hidden repositories filter // 隐藏代码过滤器 before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ] + helper :repositories + include RepositoriesHelper + #@root_path = RepositoriesHelper::ROOT_PATH rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed @@ -90,7 +93,7 @@ class RepositoriesController < ApplicationController def create ##xianbo - @root_path="/home/pdl/redmine-2.3.2-0/apache2/" + @root_path=RepositoriesHelper::ROOT_PATH @repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git" @project_path=@root_path+"htdocs/"+@repository_name @repository_tag=params[:repository][:upassword] @@ -189,7 +192,7 @@ class RepositoriesController < ApplicationController end def destroy - @root_path="/home/pdl/redmine-2.3.2-0/apache2/" + @root_path=RepositoriesHelper::ROOT_PATH @repo_name=User.current.login.to_s+"_"+@repository.identifier.to_s @repository_name=User.current.login.to_s+"/"+@repository.identifier.to_s+".git" @middle=User.current.login.to_s+"_"+@repository.identifier.to_s+"-write:" @@ -222,6 +225,10 @@ class RepositoriesController < ApplicationController @entries = @repository.entries(@path, @rev) @changeset = @repository.find_changeset_by_name(@rev) + + #@project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT + #@ip = RepositoriesHelper::REPO_IP_ADDRESS + if request.xhr? @entries ? render(:partial => 'dir_list_content') : render(:nothing => true) else diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 4b5bcfb4..d0286376 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -18,6 +18,10 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module RepositoriesHelper + ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/" + PROJECT_PATH_CUT = 40 + REPO_IP_ADDRESS = "repository.trustie.net" + def format_revision(revision) if revision.respond_to? :format_identifier revision.format_identifier diff --git a/app/views/projects/settings/_repositories.html.erb b/app/views/projects/settings/_repositories.html.erb index 83da6f79..bb42e7a5 100644 --- a/app/views/projects/settings/_repositories.html.erb +++ b/app/views/projects/settings/_repositories.html.erb @@ -1,5 +1,5 @@ -<% project_path_cut = 40 %> -<% ip = "repository.trustie.net" %> +<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %> +<% ip = RepositoriesHelper::REPO_IP_ADDRESS %> <% if @project.repositories.any? %>