Commit 405f91d2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor star/fork buttons

parent 6b9f1e1a
...@@ -48,24 +48,21 @@ ...@@ -48,24 +48,21 @@
.project-home-row { .project-home-row {
@extend .clearfix; @extend .clearfix;
margin-bottom: 15px; margin-bottom: 15px;
&.project-home-row-top { &.project-home-row-top {
margin-bottom: 11px; margin-bottom: 15px;
} }
.project-home-desc { .project-home-desc {
font-size: 16px; font-size: 16px;
line-height: 1.3; line-height: 1.3;
margin-right: 215px;
} }
.project-home-desc { .project-home-desc {
float: left; float: left;
color: #666; color: #666;
} }
.btn-action-count {
margin-left: 5px;
}
} }
.visibility-level-label { .visibility-level-label {
...@@ -75,9 +72,26 @@ ...@@ -75,9 +72,26 @@
color: inherit; color: inherit;
} }
} }
.project-repo-buttons { .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;
}
}
} }
} }
......
...@@ -118,11 +118,15 @@ module ProjectsHelper ...@@ -118,11 +118,15 @@ module ProjectsHelper
end end
def link_to_toggle_fork def link_to_toggle_fork
out = icon('code-fork') html = content_tag('span') do
out << ' Fork' icon('code-fork') + ' Fork'
out << content_tag(:span, class: 'count btn-action-count') do end
count_html = content_tag(:span, class: 'count') do
@project.forks_count.to_s @project.forks_count.to_s
end end
html + count_html
end end
private private
......
...@@ -14,20 +14,20 @@ ...@@ -14,20 +14,20 @@
&ndash; &ndash;
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do
= readme.name = 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? - 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 - 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 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 = link_to_toggle_fork
- else - else
= link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do
= link_to_toggle_fork = 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 .project-home-row.hidden-xs
- if current_user && !empty_repo - if current_user && !empty_repo
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
- split_button = split_button || false - split_button = split_button || false
- if split_button == true - if split_button == true
%span.btn-group{class: btn_class} %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 %i.fa.fa-download
%span Download zip %span Download zip
%a.btn.dropdown-toggle{ 'data-toggle' => 'dropdown' } %a.btn-sm.btn.dropdown-toggle{ 'data-toggle' => 'dropdown' }
%span.caret %span.caret
%span.sr-only %span.sr-only
Select Archive Format Select Archive Format
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
= link_to license_url(@project), class: 'btn btn-block' do = link_to license_url(@project), class: 'btn btn-block' do
View license View license
.prepend-top-10 .prepend-top-10.append-bottom-10
%p %p
%span.light Created on %span.light Created on
#{@project.created_at.stamp('Aug 22, 2013')} #{@project.created_at.stamp('Aug 22, 2013')}
...@@ -79,17 +79,22 @@ ...@@ -79,17 +79,22 @@
- else - else
#{link_to @project.owner_name, @project.owner} #{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| - @project.ci_services.each do |ci_service|
- if ci_service.active? && ci_service.respond_to?(:builds_path) - if ci_service.active? && ci_service.respond_to?(:builds_path)
%hr
- if ci_service.respond_to?(:status_img_path) - if ci_service.respond_to?(:status_img_path)
= link_to ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' do = link_to ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' do
= image_tag ci_service.status_img_path, alt: "build status" = image_tag ci_service.status_img_path, alt: "build status"
- else - else
%span.light CI provided by %span.light CI provided by
= link_to ci_service.title, ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' = 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 - if readme
.tab-pane#tab-readme .tab-pane#tab-readme
......
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