Add "Import all projects" button to GitHub and GitLab import pages.

Closes #1963.
This commit is contained in:
Douwe Maan 2015-02-06 22:42:02 +01:00
parent bc57ff0ef0
commit db7921f2d8
3 changed files with 17 additions and 9 deletions

View file

@ -4,7 +4,7 @@ class @ImporterStatus
this.setAutoUpdate()
initStatusPage: ->
$(".btn-add-to-import").click (event) =>
$(".js-add-to-import").click (event) =>
new_namespace = null
tr = $(event.currentTarget).closest("tr")
id = tr.attr("id").replace("repo_", "")
@ -13,6 +13,10 @@ class @ImporterStatus
tr.find(".import-target").empty().append(new_namespace + "/" + tr.find(".import-target").data("project_name"))
$.post @import_url, {repo_id: id, new_namespace: new_namespace}, dataType: 'script'
$(".js-import-all").click (event) =>
$(".js-add-to-import").each ->
$(this).click()
setAutoUpdate: ->
setInterval (=>
$.get @jobs_url, (data) =>

View file

@ -4,8 +4,10 @@
%p.light
Select projects you want to import.
%hr
%p
= button_tag 'Import all projects', class: "btn btn-success js-import-all"
%table.table.import-jobs
%thead
%tr
@ -32,7 +34,7 @@
%td.import-target
= repo.full_name
%td.import-actions.job-status
= button_tag "Add", class: "btn btn-add-to-import"
= button_tag "Import", class: "btn js-add-to-import"
:coffeescript
$ ->

View file

@ -4,8 +4,10 @@
%p.light
Select projects you want to import.
%hr
%p
= button_tag 'Import all projects', class: "btn btn-success js-import-all"
%table.table.import-jobs
%thead
%tr
@ -32,8 +34,8 @@
%td.import-target
= repo["path_with_namespace"]
%td.import-actions.job-status
= button_tag "Add", class: "btn btn-add-to-import"
= button_tag "Import", class: "btn js-add-to-import"
:coffeescript
$ ->
new ImporterStatus("#{jobs_import_gitlab_path}", "#{import_gitlab_url}")
new ImporterStatus("#{jobs_import_gitlab_path}", "#{import_gitlab_path}")