Commit 0d525381 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'project-home-redesign' into 'master'

Project home redesign

* more focus for description and stars/forks
* rename activity -> to project tab
* put activity under tab: prepare place for README tab

Fixes #1534.

See merge request !1047
parents c1d2640b 2dc4c65a
...@@ -47,7 +47,7 @@ $ -> ...@@ -47,7 +47,7 @@ $ ->
$(@).parents('.no-ssh-key-message').hide() $(@).parents('.no-ssh-key-message').hide()
e.preventDefault() e.preventDefault()
$('.project-side .star').on 'ajax:success', (e, data, status, xhr) -> $('.project-home-panel .star').on 'ajax:success', (e, data, status, xhr) ->
$(@).toggleClass('on').find('.count').html(data.star_count) $(@).toggleClass('on').find('.count').html(data.star_count)
.on 'ajax:error', (e, xhr, status, error) -> .on 'ajax:error', (e, xhr, status, error) ->
new Flash('Star toggle failed. Try again later.', 'alert') new Flash('Star toggle failed. Try again later.', 'alert')
...@@ -35,39 +35,31 @@ ...@@ -35,39 +35,31 @@
width: 1%; width: 1%;
&.active { &.active {
a { a {
color: #333; color: $link_color;
font-weight: bold; font-weight: bold;
&:after { &:after {
content: ''; content: '';
display: block; display: block;
position: relative; position: relative;
bottom: 8px; bottom: -1px;
left: 50%; border-color: $link_color;
width: 0;
height: 0;
border-color: transparent transparent #333 transparent;
border-style: solid; border-style: solid;
border-width: 6px; border-width: 2px;
margin-left: -6px;
} }
} }
} }
&:hover { &:hover {
a { a {
color: $link_color; color: $link_hover_color;
&:after { &:after {
content: ''; content: '';
display: block; display: block;
position: relative; position: relative;
bottom: 8px; bottom: -1px;
left: 50%; border-color: $link_hover_color;
width: 0;
height: 0;
border-color: transparent transparent $link_color transparent;
border-style: solid; border-style: solid;
border-width: 6px; border-width: 2px;
margin-left: -6px;
} }
} }
} }
...@@ -90,7 +82,6 @@ ...@@ -90,7 +82,6 @@
line-height: 34px; line-height: 34px;
color: #777; color: #777;
text-shadow: 0 1px 1px white; text-shadow: 0 1px 1px white;
padding: 0 10px;
text-decoration: none; text-decoration: none;
padding-top: 2px; padding-top: 2px;
} }
......
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
} }
.project-home-panel { .project-home-panel {
border-bottom: 1px solid #DDD; margin-bottom: 15px;
padding-bottom: 15px;
margin-bottom: 30px;
&.empty-project { &.empty-project {
border-bottom: 0px; border-bottom: 0px;
...@@ -25,52 +23,56 @@ ...@@ -25,52 +23,56 @@
margin-bottom: 0px; margin-bottom: 0px;
} }
.project-home-title {
font-size: 18px;
color: #444;
margin: 0;
line-height: 32px;
}
.project-home-dropdown { .project-home-dropdown {
margin-left: 10px; margin-left: 10px;
float: right; float: right;
} }
.project-home-extra {
margin-top: 15px; .project-home-row {
@extend .clearfix;
margin-bottom: 15px;
.project-home-desc { .project-home-desc {
float: left; float: left;
color: #777; color: #666;
margin-bottom: 10px; font-size: 16px;
} }
.project-home-links { .star-fork-buttons {
float: right; float: right;
a { width: 200px;
margin-left: 10px; font-size: 14px;
font-weight: 500; font-weight: bold;
.star-buttons, .fork-buttons {
float: right;
margin-left: 20px;
.count {
margin-left: 5px;
}
} }
} }
} }
.visibility-level-label { .visibility-level-label {
font-size: 17px; color: #555;
background: #f1f1f1; font-weight: bold;
border-radius: 4px;
color: #444;
position: absolute;
margin-left: -55px;
text-shadow: 0 1px 1px #FFF;
width: 40px;
text-align: center;
padding: 6px;
i { i {
color: inherit; color: inherit;
} }
} }
} }
.project-home-links {
padding: 10px 0px;
float: right;
a {
margin-left: 10px;
font-weight: 500;
}
}
.git-clone-holder { .git-clone-holder {
.project-home-dropdown + & { .project-home-dropdown + & {
margin-right: 45px; margin-right: 45px;
...@@ -195,8 +197,8 @@ ul.nav.nav-projects-tabs { ...@@ -195,8 +197,8 @@ ul.nav.nav-projects-tabs {
white-space: normal; white-space: normal;
text-align: left; text-align: left;
padding: 10px 15px; padding: 10px 15px;
background-color: #F1f1f1; background-color: #F9F9F9;
border-color: #EEE; border-color: #DDD;
&:hover { &:hover {
background-color: #eee; background-color: #eee;
......
...@@ -123,7 +123,7 @@ module ProjectsHelper ...@@ -123,7 +123,7 @@ module ProjectsHelper
end end
def link_to_toggle_star(title, starred, signed_in) def link_to_toggle_star(title, starred, signed_in)
cls = 'btn btn-block' cls = 'star-btn'
cls += ' disabled' unless signed_in cls += ' disabled' unless signed_in
toggle_html = content_tag('span', class: 'toggle') do toggle_html = content_tag('span', class: 'toggle') do
...@@ -151,7 +151,7 @@ module ProjectsHelper ...@@ -151,7 +151,7 @@ module ProjectsHelper
content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do
link_to toggle_star_project_path(@project), link_opts do link_to toggle_star_project_path(@project), link_opts do
toggle_html + count_html toggle_html + ' ' + count_html
end end
end end
end end
......
%ul %ul
= nav_link(path: 'projects#show', html_options: {class: "home"}) do = nav_link(path: 'projects#show', html_options: {class: "home"}) do
= link_to project_path(@project), title: "Project" do = link_to project_path(@project), title: "Project" do
Activity Project
- if project_nav_tab? :files - if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree)) do = nav_link(controller: %w(tree blob blame edit_tree new_tree)) do
......
- empty_repo = @project.empty_repo? - empty_repo = @project.empty_repo?
.project-home-panel{:class => ("empty-project" if empty_repo)} .project-home-panel{:class => ("empty-project" if empty_repo)}
.visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(@project.visibility_level)} project" } .project-home-row
= visibility_level_icon(@project.visibility_level)
.row
.col-sm-6
%h4.project-home-title
= @project.name_with_namespace
.col-sm-6
- if current_user && !empty_repo
.project-home-dropdown
= render "dropdown"
= render "shared/clone_panel"
.project-home-extra.row
.col-md-7
.project-home-desc .project-home-desc
- if @project.description.present? - if @project.description.present?
= auto_link ERB::Util.html_escape(@project.description), link: :urls = auto_link ERB::Util.html_escape(@project.description), link: :urls
- if can?(current_user, :admin_project, @project) - if can?(current_user, :admin_project, @project)
– –
%strong= link_to 'Edit', edit_project_path = link_to 'Edit', edit_project_path
- elsif !@project.empty_repo? && @repository.readme - elsif !@project.empty_repo? && @repository.readme
- readme = @repository.readme - readme = @repository.readme
– –
= link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)) do = link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)) do
= readme.name = readme.name
.star-fork-buttons
- unless @project.empty_repo?
.fork-buttons
- if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
- if current_user.already_forked?(@project)
= link_to project_path(current_user.fork_of(@project)) do
%i.icon-code-fork
Fork
%span.count
= @project.forks_count
- else
= link_to fork_project_path(@project), title: "Fork", class: "btn btn-block", method: "POST" do
%i.icon-code-fork
Fork
%span.count
= @project.forks_count
.col-md-5 .star-buttons
.project-home-links %span.star.js-toggler-container{class: @show_star ? 'on' : ''}
- unless empty_repo - if current_user
= link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref) = link_to_toggle_star('Star this project.', false, true)
= link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project) = link_to_toggle_star('Unstar this project.', true, true)
= link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), project_tags_path(@project) - else
%span.light.prepend-left-20= repository_size = link_to_toggle_star('You must sign in to star a project.', false, false)
.project-home-row
- if current_user && !empty_repo
.project-home-dropdown
= render "dropdown"
- unless @project.empty_repo?
- if can? current_user, :download_code, @project
.pull-right.prepend-left-10
= render 'projects/repositories/download_archive', split_button: true
= render "shared/clone_panel"
= render "home_panel" = render "home_panel"
%ul.nav.nav-tabs
%li.active
= link_to project_path(@project) do
Activity
.project-home-links
- unless @project.empty_repo?
= link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref)
= link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project)
= link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), project_tags_path(@project)
%span.light.prepend-left-20= repository_size
.row .row
%section.col-md-9 %section.col-md-9
= render "events/event_last_push", event: @last_push = render "events/event_last_push", event: @last_push
...@@ -22,33 +33,7 @@ ...@@ -22,33 +33,7 @@
%br %br
= link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project) = link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project)
.star-buttons
%span.star.js-toggler-container{class: @show_star ? 'on' : ''}
- if current_user
= link_to_toggle_star('Star this project.', false, true)
= link_to_toggle_star('Unstar this project.', true, true)
- else
= link_to_toggle_star('You must sign in to star a project.', false, false)
- unless @project.empty_repo? - unless @project.empty_repo?
.fork-buttons
- if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
- if current_user.already_forked?(@project)
= link_to project_path(current_user.fork_of(@project)), class: 'btn btn-block' do
%i.icon-compass
Go to fork
%span.count
= @project.forks_count
- else
= link_to fork_project_path(@project), title: "Fork", class: "btn btn-block", method: "POST" do
%i.icon-code-fork
Fork repository
%span.count
= @project.forks_count
- unless @project.empty_repo?
- if can? current_user, :download_code, @project
= render 'projects/repositories/download_archive', btn_class: 'btn-block btn-group-justified', split_button: true
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do = link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do
Compare code Compare code
......
...@@ -4,3 +4,7 @@ ...@@ -4,3 +4,7 @@
%button{class: "btn #{ 'active' if default_clone_protocol == 'ssh' }", :"data-clone" => project.ssh_url_to_repo} SSH %button{class: "btn #{ 'active' if default_clone_protocol == 'ssh' }", :"data-clone" => project.ssh_url_to_repo} SSH
%button{class: "btn #{ 'active' if default_clone_protocol == 'http' }", :"data-clone" => project.http_url_to_repo}= gitlab_config.protocol.upcase %button{class: "btn #{ 'active' if default_clone_protocol == 'http' }", :"data-clone" => project.http_url_to_repo}= gitlab_config.protocol.upcase
= text_field_tag :project_clone, default_url_to_repo(project), class: "one_click_select form-control", readonly: true = text_field_tag :project_clone, default_url_to_repo(project), class: "one_click_select form-control", readonly: true
.input-group-addon
.visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(project.visibility_level)} project" }
= visibility_level_icon(project.visibility_level)
= visibility_level_label(project.visibility_level).downcase
...@@ -35,13 +35,13 @@ class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps ...@@ -35,13 +35,13 @@ class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps
end end
step 'I should see project "Community" home page' do step 'I should see project "Community" home page' do
within '.project-home-title' do within '.navbar-gitlab .title' do
page.should have_content 'Community' page.should have_content 'Community'
end end
end end
step 'I should see project "Internal" home page' do step 'I should see project "Internal" home page' do
within '.project-home-title' do within '.navbar-gitlab .title' do
page.should have_content 'Internal' page.should have_content 'Internal'
end end
end end
......
...@@ -7,7 +7,7 @@ class ProjectActiveTab < Spinach::FeatureSteps ...@@ -7,7 +7,7 @@ class ProjectActiveTab < Spinach::FeatureSteps
# Main Tabs # Main Tabs
Then 'the active main tab should be Home' do Then 'the active main tab should be Home' do
ensure_active_main_tab('Activity') ensure_active_main_tab('Project')
end end
Then 'the active main tab should be Settings' do Then 'the active main tab should be Settings' do
......
...@@ -18,7 +18,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps ...@@ -18,7 +18,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should see project "Community" home page' do step 'I should see project "Community" home page' do
Gitlab.config.gitlab.stub(:host).and_return("www.example.com") Gitlab.config.gitlab.stub(:host).and_return("www.example.com")
within '.project-home-title' do within '.navbar-gitlab .title' do
page.should have_content 'Community' page.should have_content 'Community'
end end
end end
...@@ -34,9 +34,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps ...@@ -34,9 +34,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
end end
step 'I click on "Sign In"' do step 'I click on "Sign In"' do
within '.pull-right' do first(:link, "Sign in").click
click_link "Sign in"
end
end end
step 'Authenticate' do step 'Authenticate' do
......
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