Commit 6552ec3d authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'fork-layout-cleanup' into 'master'

Cleanup the fork layout

See merge request gitlab-org/gitlab-ce!14617
parents 8ace5fc1 193bc526
export default () => { export default () => {
$('.fork-thumbnail a').on('click', function forkThumbnailClicked() { $('.js-fork-thumbnail').on('click', function forkThumbnailClicked() {
if ($(this).hasClass('disabled')) return false; if ($(this).hasClass('disabled')) return false;
$('.fork-namespaces').hide(); return $('.js-fork-content').toggle();
return $('.save-project-loader').show();
}); });
}; };
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
&.s60 { @include avatar-size(60px, 12px); } &.s60 { @include avatar-size(60px, 12px); }
&.s70 { @include avatar-size(70px, 14px); } &.s70 { @include avatar-size(70px, 14px); }
&.s90 { @include avatar-size(90px, 15px); } &.s90 { @include avatar-size(90px, 15px); }
&.s100 { @include avatar-size(100px, 15px); }
&.s110 { @include avatar-size(110px, 15px); } &.s110 { @include avatar-size(110px, 15px); }
&.s140 { @include avatar-size(140px, 15px); } &.s140 { @include avatar-size(140px, 15px); }
&.s160 { @include avatar-size(160px, 20px); } &.s160 { @include avatar-size(160px, 20px); }
...@@ -78,6 +79,7 @@ ...@@ -78,6 +79,7 @@
&.s60 { font-size: 32px; line-height: 58px; } &.s60 { font-size: 32px; line-height: 58px; }
&.s70 { font-size: 34px; line-height: 70px; } &.s70 { font-size: 34px; line-height: 70px; }
&.s90 { font-size: 36px; line-height: 88px; } &.s90 { font-size: 36px; line-height: 88px; }
&.s100 { font-size: 36px; line-height: 98px; }
&.s110 { font-size: 40px; line-height: 108px; font-weight: $gl-font-weight-normal; } &.s110 { font-size: 40px; line-height: 108px; font-weight: $gl-font-weight-normal; }
&.s140 { font-size: 72px; line-height: 138px; } &.s140 { font-size: 72px; line-height: 138px; }
&.s160 { font-size: 96px; line-height: 158px; } &.s160 { font-size: 96px; line-height: 158px; }
......
...@@ -499,22 +499,17 @@ a.deploy-project-label { ...@@ -499,22 +499,17 @@ a.deploy-project-label {
} }
} }
.fork-namespaces { .fork-thumbnail {
.row { height: 200px;
-webkit-flex-wrap: wrap; width: calc((100% / 2) - #{$gl-padding * 2});
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
.fork-thumbnail { @media (min-width: $screen-md-min) {
border-radius: $border-radius-base; width: calc((100% / 4) - #{$gl-padding * 2});
background-color: $white-light; }
border: 1px solid $border-white-light;
height: 202px; @media (min-width: $screen-lg-min) {
margin: $gl-padding; width: calc((100% / 5) - #{$gl-padding * 2});
text-align: center; }
width: 169px;
&:hover:not(.disabled), &:hover:not(.disabled),
&.forked { &.forked {
...@@ -522,18 +517,11 @@ a.deploy-project-label { ...@@ -522,18 +517,11 @@ a.deploy-project-label {
border-color: $row-hover-border; border-color: $row-hover-border;
} }
.no-avatar { .avatar-container,
width: 100px; .identicon {
height: 100px; float: none;
background-color: $gray-light; margin-left: auto;
border: 1px solid $white-normal; margin-right: auto;
margin: 0 auto;
border-radius: 50%;
i {
font-size: 100px;
color: $white-normal;
}
} }
a { a {
...@@ -541,28 +529,23 @@ a.deploy-project-label { ...@@ -541,28 +529,23 @@ a.deploy-project-label {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-top: $gl-padding; padding-top: $gl-padding;
color: $gl-text-color; text-decoration: none;
&.disabled { &.disabled {
opacity: .3; opacity: .3;
cursor: not-allowed; cursor: not-allowed;
&:hover {
text-decoration: none;
} }
} }
}
.caption { .fork-thumbnail-container {
min-height: 30px; display: flex;
padding: $gl-padding 0; flex-wrap: wrap;
} margin-left: -$gl-padding;
} margin-right: -$gl-padding;
img { > h5 {
border-radius: 50%; width: 100%;
max-width: 100px;
}
}
} }
} }
......
...@@ -9,50 +9,36 @@ ...@@ -9,50 +9,36 @@
%br %br
Forking a repository allows you to make changes without affecting the original project. Forking a repository allows you to make changes without affecting the original project.
.col-lg-9 .col-lg-9
.fork-namespaces
- if @namespaces.present? - if @namespaces.present?
%label.label-light .fork-thumbnail-container.js-fork-content
%span %h5.prepend-top-0.append-bottom-0.prepend-left-default.append-right-default
Click to fork the project Click to fork the project
- @namespaces.in_groups_of(6, false) do |group| - @namespaces.each do |namespace|
.row
- group.each do |namespace|
- avatar = namespace_icon(namespace, 100) - avatar = namespace_icon(namespace, 100)
- if fork = namespace.find_fork_of(@project)
.fork-thumbnail.forked
= link_to project_path(fork) do
- if /no_((\w*)_)*avatar/.match(avatar)
.no-avatar
= icon 'question'
- else
= image_tag avatar
.caption
= namespace.human_name
- else
- can_create_project = current_user.can?(:create_projects, namespace) - can_create_project = current_user.can?(:create_projects, namespace)
.fork-thumbnail{ class: ("disabled" unless can_create_project) } - forked_project = namespace.find_fork_of(@project)
= link_to project_forks_path(@project, namespace_key: namespace.id), - fork_path = forked_project ? project_path(forked_project) : project_forks_path(@project, namespace_key: namespace.id)
.bordered-box.fork-thumbnail.text-center.prepend-left-default.append-right-default.prepend-top-default.append-bottom-default{ class: [("disabled" unless can_create_project), ("forked" if forked_project)] }
= link_to fork_path,
method: "POST", method: "POST",
class: ("disabled has-tooltip" unless can_create_project), class: [("js-fork-thumbnail" unless forked_project), ("disabled has-tooltip" unless can_create_project)],
title: (_('You have reached your project limit') unless can_create_project) do title: (_('You have reached your project limit') unless can_create_project) do
- if /no_((\w*)_)*avatar/.match(avatar) - if /no_((\w*)_)*avatar/.match(avatar)
.no-avatar = project_identicon(namespace, class: "avatar s100 identicon")
= icon 'question'
- else - else
= image_tag avatar .avatar-container.s100
.caption = image_tag(avatar, class: "avatar s100")
%h5.prepend-top-default
= namespace.human_name = namespace.human_name
- else - else
%label.label-light %strong
%span
No available namespaces to fork the project. No available namespaces to fork the project.
%br %p.prepend-top-default
%small
You must have permission to create a project in a namespace before forking. You must have permission to create a project in a namespace before forking.
.save-project-loader.hide .save-project-loader.hide.js-fork-content
.center %h2.text-center
%h2 = icon('spinner spin')
%i.fa.fa-spinner.fa-spin
Forking repository Forking repository
%p Please wait a moment, this page will automatically refresh when ready. %p.text-center
Please wait a moment, this page will automatically refresh when ready.
...@@ -26,7 +26,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps ...@@ -26,7 +26,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end end
step 'I fork to my namespace' do step 'I fork to my namespace' do
page.within '.fork-namespaces' do page.within '.fork-thumbnail-container' do
click_link current_user.name click_link current_user.name
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment