diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-29 18:15:54 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-29 18:15:54 -0700 |
commit | 405f91d2b8eb7c8276341ac44fcabc758fc89343 (patch) | |
tree | 1952c241abbaceaf903b4c9583df7047210afe7d /app | |
parent | 6b9f1e1a9ff2ea9c94bca48ea8bc68f8ddaff273 (diff) | |
download | gitlab-ce-405f91d2b8eb7c8276341ac44fcabc758fc89343.tar.gz |
Refactor star/fork buttons
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/pages/projects.scss | 30 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 10 | ||||
-rw-r--r-- | app/views/projects/_home_panel.html.haml | 14 | ||||
-rw-r--r-- | app/views/projects/repositories/_download_archive.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 13 |
5 files changed, 47 insertions, 24 deletions
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index de39fc3e9fb..5bd725d1222 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -48,24 +48,21 @@ .project-home-row { @extend .clearfix; margin-bottom: 15px; - + &.project-home-row-top { - margin-bottom: 11px; + margin-bottom: 15px; } .project-home-desc { font-size: 16px; line-height: 1.3; + margin-right: 215px; } .project-home-desc { float: left; color: #666; } - - .btn-action-count { - margin-left: 5px; - } } .visibility-level-label { @@ -75,9 +72,26 @@ color: inherit; } } - + .project-repo-buttons { - margin-top: -5px; + margin-top: -3px; + position: absolute; + right: 0; + width: 260px; + text-align: right; + + .btn { + font-weight: bold; + font-size: 14px; + line-height: 16px; + + .count { + padding-left: 10px; + border-left: 1px solid #ccc; + display: inline-block; + margin-left: 10px; + } + } } } diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5ca71b14d0c..4629de2ecad 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -118,11 +118,15 @@ module ProjectsHelper end def link_to_toggle_fork - out = icon('code-fork') - out << ' Fork' - out << content_tag(:span, class: 'count btn-action-count') do + html = content_tag('span') do + icon('code-fork') + ' Fork' + end + + count_html = content_tag(:span, class: 'count') do @project.forks_count.to_s end + + html + count_html end private diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 750d3054625..774be6cd138 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -14,20 +14,20 @@ – = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do = readme.name - .pull-right.prepend-left-10.project-repo-buttons + .project-repo-buttons + .inline.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) - unless @project.empty_repo? - .fork-buttons - - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace + - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace + .inline.fork-buttons.prepend-left-10 - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn btn-sm btn-default' do = link_to_toggle_fork - else = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do = link_to_toggle_fork - .star.pull-right.prepend-left-10.project-repo-buttons.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) .project-home-row.hidden-xs - if current_user && !empty_repo diff --git a/app/views/projects/repositories/_download_archive.html.haml b/app/views/projects/repositories/_download_archive.html.haml index 26669fb00a9..1ba7a1f2060 100644 --- a/app/views/projects/repositories/_download_archive.html.haml +++ b/app/views/projects/repositories/_download_archive.html.haml @@ -3,10 +3,10 @@ - split_button = split_button || false - if split_button == true %span.btn-group{class: btn_class} - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'zip'), class: 'btn', rel: 'nofollow' do + = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'zip'), class: 'btn btn-sm', rel: 'nofollow' do %i.fa.fa-download %span Download zip - %a.btn.dropdown-toggle{ 'data-toggle' => 'dropdown' } + %a.btn-sm.btn.dropdown-toggle{ 'data-toggle' => 'dropdown' } %span.caret %span.sr-only Select Archive Format diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 9a2ddeb5900..85113ffa7e2 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -68,7 +68,7 @@ = link_to license_url(@project), class: 'btn btn-block' do View license - .prepend-top-10 + .prepend-top-10.append-bottom-10 %p %span.light Created on #{@project.created_at.stamp('Aug 22, 2013')} @@ -79,17 +79,22 @@ - else #{link_to @project.owner_name, @project.owner} + - unless @project.empty_repo? + - if can? current_user, :download_code, @project + %hr + .prepend-top-10.append-bottom-10 + = render 'projects/repositories/download_archive', split_button: true + + .prepend-top-10 - @project.ci_services.each do |ci_service| - if ci_service.active? && ci_service.respond_to?(:builds_path) + %hr - if ci_service.respond_to?(:status_img_path) = link_to ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' do = image_tag ci_service.status_img_path, alt: "build status" - else %span.light CI provided by = link_to ci_service.title, ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' - - unless @project.empty_repo? - - if can? current_user, :download_code, @project - = render 'projects/repositories/download_archive', split_button: true - if readme .tab-pane#tab-readme |