From 5d4531db2555d3051fc47e9268728a670ece95f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Mon, 17 Oct 2016 17:58:57 +0200 Subject: Gogs Importer --- app/helpers/import_helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/helpers/import_helper.rb') diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb index 021d2b14718..29df2703d52 100644 --- a/app/helpers/import_helper.rb +++ b/app/helpers/import_helper.rb @@ -8,6 +8,10 @@ module ImportHelper link_to path_with_namespace, github_project_url(path_with_namespace), target: '_blank' end + def gogs_project_link(path_with_namespace) + link_to path_with_namespace, gogs_project_url(path_with_namespace), target: '_blank' + end + private def github_project_url(path_with_namespace) @@ -20,4 +24,8 @@ module ImportHelper provider = Gitlab.config.omniauth.providers.find { |p| p.name == 'github' } @github_url = provider.fetch('url', 'https://github.com') if provider end + + def gogs_project_url(path_with_namespace) + "#{@gogs_root_url}/#{path_with_namespace}" + end end -- cgit v1.2.1 From 103114e3d73819f76bed9d8ad1bbdb8964875579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 15 Dec 2016 17:31:14 +0100 Subject: Rename Gogs to Gitea, DRY the controller and improve views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- app/helpers/import_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/helpers/import_helper.rb') diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb index 29df2703d52..fb79e2a4eef 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 gogs_project_link(path_with_namespace) - link_to path_with_namespace, gogs_project_url(path_with_namespace), target: '_blank' + def gitea_project_link(root_url, path_with_namespace) + link_to path_with_namespace, gitea_project_url(root_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 gogs_project_url(path_with_namespace) - "#{@gogs_root_url}/#{path_with_namespace}" + def gitea_project_url(root_url, path_with_namespace) + "#{root_url}/#{path_with_namespace}" end end -- cgit v1.2.1 From 99ddd1dcbed35b642d7bd8a52cc6e5e5453b9f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 15 Dec 2016 17:36:53 +0100 Subject: Modify GithubImport to support Gitea MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/helpers/import_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/helpers/import_helper.rb') 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 -- cgit v1.2.1 From 20aff5cd2b782fa47fe6c15aad07a547179ee147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 16 Dec 2016 10:47:26 +0100 Subject: Reduce duplication for GitHubish import status view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- app/helpers/import_helper.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app/helpers/import_helper.rb') diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb index f52a0f176e9..a0642a1894b 100644 --- a/app/helpers/import_helper.rb +++ b/app/helpers/import_helper.rb @@ -4,12 +4,10 @@ module ImportHelper "#{namespace}/#{name}" end - def github_project_link(path_with_namespace) - link_to path_with_namespace, github_project_url(path_with_namespace), target: '_blank' - end + def provider_project_link(provider, path_with_namespace) + url = __send__("#{provider}_project_url", path_with_namespace) - def gitea_project_link(path_with_namespace) - link_to path_with_namespace, gitea_project_url(path_with_namespace), target: '_blank' + link_to path_with_namespace, url, target: '_blank' end private -- cgit v1.2.1