diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-15 19:36:53 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-19 19:35:51 +0300 |
commit | 99ddd1dcbed35b642d7bd8a52cc6e5e5453b9f8b (patch) | |
tree | 9dd65c4f4cd9d396f4360331bfce519109bab5c1 /app | |
parent | 103114e3d73819f76bed9d8ad1bbdb8964875579 (diff) |
Modify GithubImport to support Gitea
The reason is that Gitea plan to be GitHub-compatible so it makes sense
to just modify GitHubImport a bit for now, and hopefully we can change
it to GitHubishImport once Gitea is 100%-compatible.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/import/gitea_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/import_helper.rb | 8 | ||||
-rw-r--r-- | app/views/import/gitea/status.html.haml | 8 | ||||
-rw-r--r-- | app/views/import/github/status.html.haml | 5 |
4 files changed, 11 insertions, 12 deletions
diff --git a/app/controllers/import/gitea_controller.rb b/app/controllers/import/gitea_controller.rb index c82a20be04c..3bc21e62a1e 100644 --- a/app/controllers/import/gitea_controller.rb +++ b/app/controllers/import/gitea_controller.rb @@ -11,7 +11,7 @@ class Import::GiteaController < Import::GithubController end def status - @gitea_root_url = session[:host_url] + @gitea_host_url = session[:host_url] super end diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb index fb79e2a4eef..f52a0f176e9 100644 --- a/app/helpers/import_helper.rb +++ b/app/helpers/import_helper.rb @@ -8,8 +8,8 @@ module ImportHelper link_to path_with_namespace, github_project_url(path_with_namespace), target: '_blank' end - def gitea_project_link(root_url, path_with_namespace) - link_to path_with_namespace, gitea_project_url(root_url, path_with_namespace), target: '_blank' + def gitea_project_link(path_with_namespace) + link_to path_with_namespace, gitea_project_url(path_with_namespace), target: '_blank' end private @@ -25,7 +25,7 @@ module ImportHelper @github_url = provider.fetch('url', 'https://github.com') if provider end - def gitea_project_url(root_url, path_with_namespace) - "#{root_url}/#{path_with_namespace}" + def gitea_project_url(path_with_namespace) + "#{@gitea_host_url.sub(%r{/+\z}, '')}/#{path_with_namespace}" end end diff --git a/app/views/import/gitea/status.html.haml b/app/views/import/gitea/status.html.haml index 2b25892c0da..a7321632994 100644 --- a/app/views/import/gitea/status.html.haml +++ b/app/views/import/gitea/status.html.haml @@ -1,8 +1,8 @@ -- page_title "Gitea import" +- page_title "Gitea Import" - header_title "Projects", root_path %h3.page-title = custom_icon('go_logo') - Import projects from Gitea + Import Projects from Gitea %p.light Select projects you want to import. @@ -26,7 +26,7 @@ - @already_added_projects.each do |project| %tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"} %td - = gitea_project_link(@gitea_root_url, project.import_source) + = gitea_project_link(project.import_source) %td = link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] %td.job-status @@ -43,7 +43,7 @@ - @repos.each do |repo| %tr{id: "repo_#{repo.id}"} %td - = gitea_project_link(@gitea_root_url, repo.full_name) + = gitea_project_link(repo.full_name) %td.import-target %fieldset.row .input-group diff --git a/app/views/import/github/status.html.haml b/app/views/import/github/status.html.haml index 4c721d40b55..70b18ee217d 100644 --- a/app/views/import/github/status.html.haml +++ b/app/views/import/github/status.html.haml @@ -1,8 +1,7 @@ -- page_title "GitHub import" +- page_title "GitHub Import" - header_title "Projects", root_path %h3.page-title - %i.fa.fa-github - Import projects from GitHub + = icon 'github', text: 'Import Projects from GitHub' %p.light Select projects you want to import. |