summaryrefslogtreecommitdiff
path: root/app/views/shared/projects/_list.html.haml
blob: 6fae6a155679e52111d32c0cb2eab34d76830150 (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
61
62
63
64
65
- projects_limit = 20 unless local_assigns[:projects_limit]
- avatar = true unless local_assigns[:avatar] == false
- use_creator_avatar = false unless local_assigns[:use_creator_avatar] == true
- stars = true unless local_assigns[:stars] == false
- pipeline_status = true unless local_assigns[:pipeline_status] == false
- skip_namespace = false unless local_assigns[:skip_namespace] == true
- user = local_assigns[:user]
- show_last_commit_as_description = false unless local_assigns[:show_last_commit_as_description] == true
- remote = false unless local_assigns[:remote] == true
- skip_pagination = false unless local_assigns[:skip_pagination] == true
- compact_mode = false unless local_assigns[:compact_mode] == true
- css_classes = "#{'compact' if compact_mode} #{'explore' if explore_projects_tab?}"
- contributed_projects_illustration_path = 'illustrations/profile-page/contributed-projects.svg'
- contributed_projects_current_user_empty_message_header = s_('UserProfile|Explore public groups to find projects to contribute to.')
- contributed_projects_visitor_empty_message = s_('UserProfile|This user hasn\'t contributed to any projects')
- starred_projects_illustration_path = 'illustrations/starred_empty.svg'
- starred_projects_current_user_empty_message_header = s_('UserProfile|Star projects to track their progress and show your appreciation.')
- starred_projects_visitor_empty_message = s_('UserProfile|This user hasn\'t starred any projects')
- own_projects_illustration_path = 'illustrations/profile-page/personal-project.svg'
- own_projects_current_user_empty_message_header = s_('UserProfile|You haven\'t created any personal projects.')
- own_projects_current_user_empty_message_description = s_('UserProfile|Your projects can be available publicly, internally, or privately, at your choice.')
- own_projects_visitor_empty_message = s_('UserProfile|This user doesn\'t have any personal projects')
- explore_page_empty_message = s_('UserProfile|Explore public groups to find projects to contribute to.')
- new_project_button_label = _('New project')
- new_project_button_link = new_project_path
- explore_projects_button_label = _('Explore projects')
- explore_projects_button_link = explore_projects_path
- explore_groups_button_label = _('Explore groups')
- explore_groups_button_link = explore_groups_path

.js-projects-list-holder{ data: { qa_selector: 'projects_list' } }
  - if any_projects?(projects)
    - load_pipeline_status(projects) if pipeline_status
    - load_max_project_member_accesses(projects) # Prime cache used in shared/projects/project view rendered below
    %ul.projects-list{ class: css_classes }
      - projects.each_with_index do |project, i|
        - css_class = (i >= projects_limit) || project.pending_delete? ? 'hide' : nil
        = render "shared/projects/project", project: project, skip_namespace: skip_namespace,
          avatar: avatar, stars: stars, css_class: css_class, use_creator_avatar: use_creator_avatar,
          forks: project.forking_enabled?, show_last_commit_as_description: show_last_commit_as_description, user: user,
          merge_requests: project.merge_requests_enabled?, issues: project.issues_enabled?,
          pipeline_status: pipeline_status, compact_mode: compact_mode
    = paginate_collection(projects, remote: remote) unless skip_pagination
  - else
    - if @contributed_projects
      = render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: contributed_projects_illustration_path,
        current_user_empty_message_header: contributed_projects_current_user_empty_message_header,
        primary_button_label: new_project_button_label,
        primary_button_link: new_project_button_link,
        secondary_button_label: explore_groups_button_label,
        secondary_button_link: explore_groups_button_link,
        visitor_empty_message: contributed_projects_visitor_empty_message }
    - elsif @starred_projects
      = render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: starred_projects_illustration_path,
        current_user_empty_message_header: starred_projects_current_user_empty_message_header,
        primary_button_label: explore_projects_button_label,
        primary_button_link: explore_projects_button_link,
        visitor_empty_message: starred_projects_visitor_empty_message }
    - else
      = render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: own_projects_illustration_path,
        current_user_empty_message_header: own_projects_current_user_empty_message_header,
        current_user_empty_message_description: own_projects_current_user_empty_message_description,
        primary_button_label: new_project_button_label,
        primary_button_link: new_project_button_link,
        visitor_empty_message: defined?(explore_page) && explore_page ? explore_page_empty_message : own_projects_visitor_empty_message }