diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee index f7c64b4b816928f128d615f5884d1da043aecce7..d81cc087df9b7b91c3f138ddf02bc1fcabb63b7b 100644 --- a/app/assets/javascripts/project.js.coffee +++ b/app/assets/javascripts/project.js.coffee @@ -47,7 +47,7 @@ $ -> $(@).parents('.no-ssh-key-message').hide() 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) .on 'ajax:error', (e, xhr, status, error) -> new Flash('Star toggle failed. Try again later.', 'alert') diff --git a/app/assets/stylesheets/sections/nav.scss b/app/assets/stylesheets/sections/nav.scss index f5d09c2df10f0d3acb5c86d2f980fc611560f6b1..778953984d6b4aa844797ece74d379fdcf80fede 100644 --- a/app/assets/stylesheets/sections/nav.scss +++ b/app/assets/stylesheets/sections/nav.scss @@ -35,39 +35,31 @@ width: 1%; &.active { a { - color: #333; + color: $link_color; font-weight: bold; &:after { content: ''; display: block; position: relative; - bottom: 8px; - left: 50%; - width: 0; - height: 0; - border-color: transparent transparent #333 transparent; + bottom: -1px; + border-color: $link_color; border-style: solid; - border-width: 6px; - margin-left: -6px; + border-width: 2px; } } } &:hover { a { - color: $link_color; + color: $link_hover_color; &:after { content: ''; display: block; position: relative; - bottom: 8px; - left: 50%; - width: 0; - height: 0; - border-color: transparent transparent $link_color transparent; + bottom: -1px; + border-color: $link_hover_color; border-style: solid; - border-width: 6px; - margin-left: -6px; + border-width: 2px; } } } @@ -90,7 +82,6 @@ line-height: 34px; color: #777; text-shadow: 0 1px 1px white; - padding: 0 10px; text-decoration: none; padding-top: 2px; } diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss index 6e34f736ac9e7d2a9759020bd511b2ec6bec3b4d..514c8737234a231ee5596f817ee1ea0eee9e7054 100644 --- a/app/assets/stylesheets/sections/projects.scss +++ b/app/assets/stylesheets/sections/projects.scss @@ -15,62 +15,64 @@ } .project-home-panel { - border-bottom: 1px solid #DDD; - padding-bottom: 15px; - margin-bottom: 30px; + margin-bottom: 15px; &.empty-project { - border-bottom: 0px; - padding-bottom: 15px; - margin-bottom: 0px; + border-bottom: 0px; + padding-bottom: 15px; + margin-bottom: 0px; } - .project-home-title { - font-size: 18px; - color: #444; - margin: 0; - line-height: 32px; - } .project-home-dropdown { margin-left: 10px; float: right; } - .project-home-extra { - margin-top: 15px; + + .project-home-row { + @extend .clearfix; + margin-bottom: 15px; .project-home-desc { float: left; - color: #777; - margin-bottom: 10px; + color: #666; + font-size: 16px; } - .project-home-links { + .star-fork-buttons { float: right; - a { - margin-left: 10px; - font-weight: 500; + width: 200px; + font-size: 14px; + font-weight: bold; + + .star-buttons, .fork-buttons { + float: right; + margin-left: 20px; + + .count { + margin-left: 5px; + } } } } .visibility-level-label { - font-size: 17px; - background: #f1f1f1; - border-radius: 4px; - color: #444; - position: absolute; - margin-left: -55px; - text-shadow: 0 1px 1px #FFF; - width: 40px; - text-align: center; - padding: 6px; - + color: #555; + font-weight: bold; i { color: inherit; } } } +.project-home-links { + padding: 10px 0px; + float: right; + a { + margin-left: 10px; + font-weight: 500; + } +} + .git-clone-holder { .project-home-dropdown + & { margin-right: 45px; diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 8350f5dc072b15d02c4b92bd0345115ac988926d..866d3c6ab8374b4dc7957f905829d81defb83907 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -123,7 +123,7 @@ module ProjectsHelper end def link_to_toggle_star(title, starred, signed_in) - cls = 'btn btn-block' + cls = 'star-btn' cls += ' disabled' unless signed_in toggle_html = content_tag('span', class: 'toggle') do @@ -151,7 +151,7 @@ module ProjectsHelper content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do link_to toggle_star_project_path(@project), link_opts do - toggle_html + count_html + toggle_html + ' ' + count_html end end end diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 69491c2529ecd04750fff16346a355962a7f78bb..92ef7923714f50d010efcaa777dca60b04b38629 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -1,7 +1,7 @@ %ul = nav_link(path: 'projects#show', html_options: {class: "home"}) do = link_to project_path(@project), title: "Project" do - Activity + Project - if project_nav_tab? :files = nav_link(controller: %w(tree blob blame edit_tree new_tree)) do diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 62348f26f0a5805bd4f15178a63be4f7776e8caf..9eeaa9d0968023da6cf8003bed2f5fe280751cbe 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -1,36 +1,48 @@ - empty_repo = @project.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" } - = visibility_level_icon(@project.visibility_level) - .row - .col-sm-6 - %h4.project-home-title - = @project.name_with_namespace + .project-home-row + .project-home-desc + - if @project.description.present? + = auto_link ERB::Util.html_escape(@project.description), link: :urls + - if can?(current_user, :admin_project, @project) + – + = link_to 'Edit', edit_project_path + - elsif !@project.empty_repo? && @repository.readme + - readme = @repository.readme + – + = link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)) do + = 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-sm-6 - - if current_user && !empty_repo - .project-home-dropdown - = render "dropdown" - = render "shared/clone_panel" + .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) - .project-home-extra.row - .col-md-7 - .project-home-desc - - if @project.description.present? - = auto_link ERB::Util.html_escape(@project.description), link: :urls - - if can?(current_user, :admin_project, @project) - – - %strong= link_to 'Edit', edit_project_path - - elsif !@project.empty_repo? && @repository.readme - - readme = @repository.readme - – - = link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)) do - = readme.name - - .col-md-5 - .project-home-links - - unless 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 + .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" diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 0fd290b539857f96c751078745458e28e8033879..7902f51f72fab1df4fb2b27fc6b384c68b6e9af2 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -1,5 +1,16 @@ = 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 %section.col-md-9 = render "events/event_last_push", event: @last_push @@ -22,33 +33,7 @@ %br = 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? - .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 Compare code diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml index 8cd426c71e693a3d782b78eb8697422b83469d54..606e9572874c2871b0d8bd05cd198e02e3023a1c 100644 --- a/app/views/shared/_clone_panel.html.haml +++ b/app/views/shared/_clone_panel.html.haml @@ -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 == '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 + .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