_home_panel.html.haml 4.52 KB
Newer Older
1
- empty_repo = @project.empty_repo?
2
- show_auto_devops_callout = show_auto_devops_callout?(@project)
3
- max_project_topic_length = 15
4
.project-home-panel{ class: ("empty-project" if empty_repo) }
5 6
  .row.append-bottom-8
    .home-panel-title-row.col-md-12.col-lg-6.d-flex
7
      .avatar-container.rect-avatar.s64.home-panel-avatar.append-right-default.float-none
8 9 10
        = project_icon(@project, alt: @project.name, class: 'avatar avatar-tile s64', width: 64, height: 64)
      .d-flex.flex-column.flex-wrap.align-items-baseline
        .d-inline-flex.align-items-baseline
11
          %h1.home-panel-title.prepend-top-8.append-bottom-5.qa-project-name
12
            = @project.name
13
            %span.visibility-icon.text-secondary.prepend-left-4.has-tooltip{ data: { container: 'body' }, title: visibility_icon_description(@project) }
14
              = visibility_level_icon(@project.visibility_level, fw: false, options: {class: 'icon'})
15
        .home-panel-metadata.d-flex.flex-wrap.text-secondary
16 17 18 19 20 21 22
          - if can?(current_user, :read_project, @project)
            %span.text-secondary
              = s_('ProjectPage|Project ID: %{project_id}') % { project_id: @project.id }
          - if current_user
            %span.access-request-links.prepend-left-8
              = render 'shared/members/access_request_links', source: @project
          - if @project.tag_list.present?
23
            %span.home-panel-topic-list.mt-2.w-100.d-inline-flex
24
              = sprite_icon('tag', size: 16, css_class: 'icon append-right-4')
25 26

              - @project.topics_to_show.each do |topic|
27 28 29 30 31 32 33 34
                - project_topics_classes = "badge badge-pill badge-secondary append-right-5"
                - explore_project_topic_path = explore_projects_path(tag: topic)
                - if topic.length > max_project_topic_length
                  %a{ class: "#{ project_topics_classes } str-truncated-30 has-tooltip", data: { container: "body" }, title: topic, href: explore_project_topic_path }
                    = topic.titleize
                - else
                  %a{ class: project_topics_classes, href: explore_project_topic_path }
                    = topic.titleize
35

Martin Wortschack's avatar
Martin Wortschack committed
36
              - if @project.has_extra_topics?
37
                .text-nowrap.has-tooltip{ data: { container: 'body' }, title: @project.has_extra_topics? ? @project.topics_not_shown.join(', ') : nil }
38
                  = _("+ %{count} more") % { count: @project.count_of_extra_topics_not_shown }
39

Martin Wortschack's avatar
Martin Wortschack committed
40

41
    .project-repo-buttons.col-md-12.col-lg-6.d-inline-flex.flex-wrap.justify-content-lg-end
42 43
      - if current_user
        .d-inline-flex
44
          = render 'shared/notifications/new_button', notification_setting: @notification_setting, btn_class: 'btn-xs'
45

46
      .count-buttons.d-inline-flex
Phil Hughes's avatar
Phil Hughes committed
47 48
        = render 'projects/buttons/star'
        = render 'projects/buttons/fork'
49

50
      - if can?(current_user, :download_code, @project)
51
        .project-clone-holder.d-inline-flex.d-md-none.btn-block
52
          = render "shared/mobile_clone_panel"
53

54 55
        .project-clone-holder.d-none.d-md-inline-flex
          = render "projects/buttons/clone"
56

57 58
  - if can?(current_user, :download_code, @project)
    %nav.project-stats
59
      .nav-links.quick-links
60 61 62 63
        - if @project.empty_repo?
          = render 'stat_anchor_list', anchors: @project.empty_repo_statistics_anchors
        - else
          = render 'stat_anchor_list', anchors: @project.statistics_anchors(show_auto_devops_callout: show_auto_devops_callout)
64

65
  .home-panel-home-desc.mt-1
66
    - if @project.description.present?
67 68
      .home-panel-description
        .home-panel-description-markdown.read-more-container
69 70 71 72 73 74 75 76 77 78 79 80 81 82
          = markdown_field(@project, :description)
        %button.btn.btn-blank.btn-link.js-read-more-trigger.d-lg-none{ type: "button" }
          = _("Read more")

    - if @project.forked?
      %p
        - if @project.fork_source
          #{ s_('ForkedFromProjectPath|Forked from') }
          = link_to project_path(@project.fork_source) do
            = fork_source_name(@project)
        - else
          - deleted_message = s_('ForkedFromProjectPath|Forked from %{project_name} (deleted)')
          = deleted_message % { project_name: fork_source_name(@project) }

83
    = render_if_exists "projects/home_mirror"
84

85 86 87 88 89 90 91 92 93
  - if @project.badges.present?
    .project-badges.mb-2
      - @project.badges.each do |badge|
        %a.append-right-8{ href: badge.rendered_link_url(@project),
          target: '_blank',
          rel: 'noopener noreferrer' }>
          %img.project-badge{ src: badge.rendered_image_url(@project),
            'aria-hidden': true,
            alt: 'Project badge' }>