summaryrefslogtreecommitdiff
path: root/app/views/projects/_gitlab.html.haml
blob: 11f58668026b3f9c9677748cfaa3573c3480e8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.clearfix.light
  .pull-left.fetch-status
    Fetched from GitLab (#{link_to GitlabCi.config.gitlab_server.url, GitlabCi.config.gitlab_server.url, no_turbolink})
    - if params[:search].present?
      by keyword: "#{params[:search]}",
    #{time_ago_in_words(current_user.sync_at)} ago.
    = link_to gitlab_projects_path(reset_cache: true, search: params[:search]), remote: true, class: 'sync-now btn btn-small btn-default' do
      %i.icon-refresh
      Sync now
    %br

  .pull-right
    #{@total_count} projects, #{@projects.size} of them added to CI
%br

%table.table.projects-table
  %thead
    %tr
      %th ID
      %th Project Name
      %th Last commit
      %th Access
      %th Commits

  = render @projects

  - @gl_projects.sort_by(&:name_with_namespace).each do |project|
    %tr.light
      %td
        \-
      %td
        = project.name_with_namespace
      %td
        %small Not added to CI
      %td
      %td
        - if Project.already_added?(project)
          %strong.cgreen
            Added
        - else
          = form_tag projects_path do
            = hidden_field_tag :project, project.to_yaml
            = submit_tag 'Add project to CI', class: 'btn btn-default btn-small'

%ul.pagination.gitlab-projects-pagination
  - if @page > 1
    %li
      = link_to gitlab_projects_path(page: @page - 1), class: 'btn', remote: true do
        %i.icon-angle-left
        Previous
   
  - if @total_count == @per_page
    %li
      = link_to gitlab_projects_path(page: @page + 1, search: params[:search]), class: 'btn', remote: true do
        Next
        %i.icon-angle-right

:coffeescript
  $('.gitlab-projects-pagination').on 'ajax:before', ->
    $('.projects').html('<h1><i class="icon-spinner icon-spin"/></h1>')