From b9a825620db8897e02a148d0de6617214b34f028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Thu, 21 Jul 2016 11:24:10 +0200 Subject: [PATCH] Include gogs as builtin --- CHANGELOG.md | 2 + app/coffee/app.coffee | 6 ++ app/coffee/modules/admin/third-parties.coffee | 47 ++++++++++++++++ app/coffee/modules/base.coffee | 1 + app/locales/taiga/locale-ca.json | 6 +- app/locales/taiga/locale-de.json | 6 +- app/locales/taiga/locale-en.json | 4 ++ app/locales/taiga/locale-es.json | 6 +- app/locales/taiga/locale-fi.json | 6 +- app/locales/taiga/locale-fr.json | 6 +- app/locales/taiga/locale-it.json | 6 +- app/locales/taiga/locale-nl.json | 6 +- app/locales/taiga/locale-pl.json | 6 +- app/locales/taiga/locale-pt-br.json | 6 +- app/locales/taiga/locale-ru.json | 6 +- app/locales/taiga/locale-sv.json | 6 +- app/locales/taiga/locale-tr.json | 6 +- app/locales/taiga/locale-zh-hant.json | 6 +- .../admin/admin-third-parties-gitlab.jade | 2 +- .../admin/admin-third-parties-gogs.jade | 56 +++++++++++++++++++ .../modules/admin-submenu-third-parties.jade | 3 + 21 files changed, 185 insertions(+), 14 deletions(-) create mode 100644 app/partials/admin/admin-third-parties-gogs.jade diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e9cc8f..f1fe705a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ - Drag & Drop ordering for wiki links. - Add a list of all wiki pages - Add Wiki history +- Third party integrations: + - Included gogs as builtin integration. ### Misc - Lots of small and not so small bugfixes. diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index a1840ebf..7827d1a7 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -341,6 +341,12 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven section: "admin" } ) + $routeProvider.when("/project/:pslug/admin/third-parties/gogs", + { + templateUrl: "admin/admin-third-parties-gogs.html", + section: "admin" + } + ) # Admin - Contrib Plugins $routeProvider.when("/project/:pslug/admin/contrib/:plugin", {templateUrl: "contrib/main.html"}) diff --git a/app/coffee/modules/admin/third-parties.coffee b/app/coffee/modules/admin/third-parties.coffee index 076bf552..74ea9ed7 100644 --- a/app/coffee/modules/admin/third-parties.coffee +++ b/app/coffee/modules/admin/third-parties.coffee @@ -586,3 +586,50 @@ ValidOriginIpsDirective = -> } module.directive("tgValidOriginIps", ValidOriginIpsDirective) + +############################################################################# +## Gogs Controller +############################################################################# + +class GogsController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin) + @.$inject = [ + "$scope", + "$tgRepo", + "$tgResources", + "$routeParams", + "tgAppMetaService", + "$translate" + ] + + constructor: (@scope, @repo, @rs, @params, @appMetaService, @translate) -> + bindMethods(@) + + @scope.sectionName = @translate.instant("ADMIN.GOGS.SECTION_NAME") + @scope.project = {} + + promise = @.loadInitialData() + + promise.then () => + title = @translate.instant("ADMIN.GOGS.PAGE_TITLE", {projectName: @scope.project.name}) + description = @scope.project.description + @appMetaService.setAll(title, description) + + promise.then null, @.onInitialDataError.bind(@) + + loadModules: -> + return @rs.modules.list(@scope.projectId, "gogs").then (gogs) => + @scope.gogs = gogs + + loadProject: -> + return @rs.projects.getBySlug(@params.pslug).then (project) => + @scope.projectId = project.id + @scope.project = project + @scope.$emit('project:loaded', project) + return project + + loadInitialData: -> + promise = @.loadProject() + promise.then(=> @.loadModules()) + return promise + +module.controller("GogsController", GogsController) diff --git a/app/coffee/modules/base.coffee b/app/coffee/modules/base.coffee index 75b0e23e..c4448294 100644 --- a/app/coffee/modules/base.coffee +++ b/app/coffee/modules/base.coffee @@ -108,6 +108,7 @@ urls = { "project-admin-third-parties-github": "/project/:project/admin/third-parties/github" "project-admin-third-parties-gitlab": "/project/:project/admin/third-parties/gitlab" "project-admin-third-parties-bitbucket": "/project/:project/admin/third-parties/bitbucket" + "project-admin-third-parties-gogs": "/project/:project/admin/third-parties/gogs" "project-admin-contrib": "/project/:project/admin/contrib/:plugin" # User settings diff --git a/app/locales/taiga/locale-ca.json b/app/locales/taiga/locale-ca.json index dfa78e74..b8ae371d 100644 --- a/app/locales/taiga/locale-ca.json +++ b/app/locales/taiga/locale-ca.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Search results" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-de.json b/app/locales/taiga/locale-de.json index 5ec14239..42af6566 100644 --- a/app/locales/taiga/locale-de.json +++ b/app/locales/taiga/locale-de.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Suchergebnisse" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-en.json b/app/locales/taiga/locale-en.json index 16777909..41abba09 100644 --- a/app/locales/taiga/locale-en.json +++ b/app/locales/taiga/locale-en.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", diff --git a/app/locales/taiga/locale-es.json b/app/locales/taiga/locale-es.json index 41fdf455..09f50131 100644 --- a/app/locales/taiga/locale-es.json +++ b/app/locales/taiga/locale-es.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Resultados de búsqueda" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-fi.json b/app/locales/taiga/locale-fi.json index 4a7c2af8..99cad17b 100644 --- a/app/locales/taiga/locale-fi.json +++ b/app/locales/taiga/locale-fi.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhookit", @@ -1628,4 +1632,4 @@ "RESULTS": "Search results" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-fr.json b/app/locales/taiga/locale-fr.json index 1e5348e7..d17a58e0 100644 --- a/app/locales/taiga/locale-fr.json +++ b/app/locales/taiga/locale-fr.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Résultats de la recherche" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-it.json b/app/locales/taiga/locale-it.json index 86db70c8..a683b8f9 100644 --- a/app/locales/taiga/locale-it.json +++ b/app/locales/taiga/locale-it.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Risultati della ricerca" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-nl.json b/app/locales/taiga/locale-nl.json index 0caba2ba..a730cce8 100644 --- a/app/locales/taiga/locale-nl.json +++ b/app/locales/taiga/locale-nl.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Search results" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-pl.json b/app/locales/taiga/locale-pl.json index 8818b746..34ca3e7a 100644 --- a/app/locales/taiga/locale-pl.json +++ b/app/locales/taiga/locale-pl.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Search results" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-pt-br.json b/app/locales/taiga/locale-pt-br.json index c7974d9a..af05d090 100644 --- a/app/locales/taiga/locale-pt-br.json +++ b/app/locales/taiga/locale-pt-br.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Resultado de pesquisa." } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-ru.json b/app/locales/taiga/locale-ru.json index 00488431..080afeda 100644 --- a/app/locales/taiga/locale-ru.json +++ b/app/locales/taiga/locale-ru.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Веб-хуки - {{projectName}}", "SECTION_NAME": "Веб-хуки", @@ -1628,4 +1632,4 @@ "RESULTS": "Результаты поиска" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-sv.json b/app/locales/taiga/locale-sv.json index 7560899b..ab8efca2 100644 --- a/app/locales/taiga/locale-sv.json +++ b/app/locales/taiga/locale-sv.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webbkrok - {{projectName}}", "SECTION_NAME": "Webbkrokar", @@ -1628,4 +1632,4 @@ "RESULTS": "Search results" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-tr.json b/app/locales/taiga/locale-tr.json index 49f1bc7b..a03a4b38 100644 --- a/app/locales/taiga/locale-tr.json +++ b/app/locales/taiga/locale-tr.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Github", "PAGE_TITLE": "Github - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks - {{projectName}}", "SECTION_NAME": "Webhooks", @@ -1628,4 +1632,4 @@ "RESULTS": "Arama sonuçları" } } -} \ No newline at end of file +} diff --git a/app/locales/taiga/locale-zh-hant.json b/app/locales/taiga/locale-zh-hant.json index 135b08b8..93fd5ac0 100644 --- a/app/locales/taiga/locale-zh-hant.json +++ b/app/locales/taiga/locale-zh-hant.json @@ -598,6 +598,10 @@ "SECTION_NAME": "Githun", "PAGE_TITLE": "Gitlab - {{projectName}}" }, + "GOGS": { + "SECTION_NAME": "Gogs", + "PAGE_TITLE": "Gogs - {{projectName}}" + }, "WEBHOOKS": { "PAGE_TITLE": "Webhooks- {{projectName}}", "SECTION_NAME": "網頁觸發 ", @@ -1628,4 +1632,4 @@ "RESULTS": "搜尋結果" } } -} \ No newline at end of file +} diff --git a/app/partials/admin/admin-third-parties-gitlab.jade b/app/partials/admin/admin-third-parties-gitlab.jade index a8950fd1..2f2fbf71 100644 --- a/app/partials/admin/admin-third-parties-gitlab.jade +++ b/app/partials/admin/admin-third-parties-gitlab.jade @@ -60,7 +60,7 @@ div.wrapper.roles( ) a.help-button( - href="https://tree.taiga.io/support/integrations/gitlab-integration/" + href="https://tree.taiga.io/support/integrations/gogs-integration/" target="_blank" ) tg-svg(svg-icon="icon-question") diff --git a/app/partials/admin/admin-third-parties-gogs.jade b/app/partials/admin/admin-third-parties-gogs.jade new file mode 100644 index 00000000..b5763d6c --- /dev/null +++ b/app/partials/admin/admin-third-parties-gogs.jade @@ -0,0 +1,56 @@ +doctype html + +div.wrapper.roles( + tg-gogs-webhooks + ng-controller="GogsController as ctrl", + ng-init="section='admin'" +) + tg-project-menu + sidebar.menu-secondary.sidebar.settings-nav(tg-admin-navigation="third-parties") + include ../includes/modules/admin-menu + sidebar.menu-tertiary.sidebar(tg-admin-navigation="third-parties-gogs") + include ../includes/modules/admin-submenu-third-parties + + section.main.admin-common.admin-third-parties + include ../includes/components/mainTitle + + form + fieldset + label(for="secret-key", translate="ADMIN.THIRD_PARTIES.SECRET_KEY") + input( + id="secret-key" + type="text" + name="secret-key" + ng-model="gogs.secret" + placeholder="{{'ADMIN.THIRD_PARTIES.SECRET_KEY' | translate}}" + ) + + fieldset + .select-input-text(tg-select-input-text) + div + label(for="payload-url", translate="ADMIN.THIRD_PARTIES.PAYLOAD_URL") + .field-with-option + input( + id="payload-url" + type="text" + name="payload-url" + readonly="readonly" + ng-model="gogs.webhooks_url" + placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}" + ) + .option-wrapper.select-input-content + tg-svg(svg-icon="icon-clipboard") + .help-copy(translate="COMMON.COPY_TO_CLIPBOARD") + + button.button-green.submit-button( + type="submit" + title="{{'COMMON.SAVE' | translate}}" + translate="COMMON.SAVE" + ) + + a.help-button( + href="https://tree.taiga.io/support/integrations/gogs-integration/" + target="_blank" + ) + tg-svg(svg-icon="icon-question") + span(translate="ADMIN.HELP") diff --git a/app/partials/includes/modules/admin-submenu-third-parties.jade b/app/partials/includes/modules/admin-submenu-third-parties.jade index a0666cb1..ab39cb4c 100644 --- a/app/partials/includes/modules/admin-submenu-third-parties.jade +++ b/app/partials/includes/modules/admin-submenu-third-parties.jade @@ -13,3 +13,6 @@ section.admin-submenu li#adminmenu-third-parties-bitbucket a(href="", tg-nav="project-admin-third-parties-bitbucket:project=project.slug") span.title Bitbucket + li#adminmenu-third-parties-gogs + a(href="", tg-nav="project-admin-third-parties-gogs:project=project.slug") + span.title Gogs