%h3.page-title %i.fa.fa-github Import repositories from GitHub.com %p.light Select projects you want to import. %hr %table.table.import-jobs %thead %tr %th From GitHub %th To GitLab %th Status %tbody - @already_added_projects.each do |project| %tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"} %td= project.import_source %td %strong= link_to project.name_with_namespace, project %td.job-status - if project.import_status == 'finished' %span.cgreen %i.fa.fa-check done - else = project.human_import_status_name - @repos.each do |repo| %tr{id: "repo_#{repo.id}"} %td= repo.full_name %td.import-target = repo.full_name %td.import-actions.job-status = button_tag "Add", class: "btn btn-add-to-import" :coffeescript $(".btn-add-to-import").click () -> new_namespace = null tr = $(this).closest("tr") id = tr.attr("id").replace("repo_", "") if tr.find(".import-target input").length > 0 new_namespace = tr.find(".import-target input").prop("value") tr.find(".import-target").empty().append(new_namespace + "/" + tr.find(".import-target").data("project_name")) $.post "#{github_import_url}", {repo_id: id, new_namespace: new_namespace}, dataType: 'script' setInterval (-> $.get "#{jobs_github_import_path}", (data)-> $.each data, (i, job) -> job_item = $("#project_" + job.id) status_field = job_item.find(".job-status") if job.import_status == 'finished' job_item.removeClass("active").addClass("success") status_field.html(' done') else if job.import_status == 'started' status_field.html(" started") else status_field.html(job.import_status) ), 4000