Commit 68e27b55 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ui/project-home-panel' into 'master'

UI: Project home panel tweaks

Depends on !1953

See the commits for more details, the messages mostly speak for themselves.

Before:

![Screen_Shot_2015-12-02_at_17.46.01](/uploads/f07a4f2370c6863a68df46f655b513c4/Screen_Shot_2015-12-02_at_17.46.01.png)

After:

![Screen_Shot_2015-12-02_at_17.45.40](/uploads/da9b19d3bd89b9421457e0df550efd6e/Screen_Shot_2015-12-02_at_17.45.40.png)


See merge request !1965
parents 76b2250c e84edc20
...@@ -116,6 +116,11 @@ ...@@ -116,6 +116,11 @@
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 10px; right: 10px;
&.left {
left: 10px;
right: auto;
}
} }
} }
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
@extend .btn-gray; @extend .btn-gray;
color: $gray; color: $gray;
cursor: auto; cursor: default;
i { i {
color: inherit; color: inherit;
......
...@@ -27,16 +27,20 @@ module IconsHelper ...@@ -27,16 +27,20 @@ module IconsHelper
end end
end end
def public_icon def visibility_level_icon(level, fw: true)
icon('globe fw') name =
case level
when Gitlab::VisibilityLevel::PRIVATE
'lock'
when Gitlab::VisibilityLevel::INTERNAL
'shield'
else # Gitlab::VisibilityLevel::PUBLIC
'globe'
end end
def internal_icon name << " fw" if fw
icon('shield fw')
end
def private_icon icon(name)
icon('lock fw')
end end
def file_type_icon_class(type, mode, name) def file_type_icon_class(type, mode, name)
......
...@@ -25,48 +25,24 @@ module VisibilityLevelHelper ...@@ -25,48 +25,24 @@ module VisibilityLevelHelper
end end
def project_visibility_level_description(level) def project_visibility_level_description(level)
capture_haml do
haml_tag :span do
case level case level
when Gitlab::VisibilityLevel::PRIVATE when Gitlab::VisibilityLevel::PRIVATE
haml_concat "Project access must be granted explicitly for each user." "Project access must be granted explicitly for each user."
when Gitlab::VisibilityLevel::INTERNAL when Gitlab::VisibilityLevel::INTERNAL
haml_concat "The project can be cloned by" "The project can be cloned by any logged in user."
haml_concat "any logged in user."
when Gitlab::VisibilityLevel::PUBLIC when Gitlab::VisibilityLevel::PUBLIC
haml_concat "The project can be cloned" "The project can be cloned without any authentication."
haml_concat "without any"
haml_concat "authentication."
end
end
end end
end end
def snippet_visibility_level_description(level) def snippet_visibility_level_description(level)
capture_haml do
haml_tag :span do
case level
when Gitlab::VisibilityLevel::PRIVATE
haml_concat "The snippet is visible only for me."
when Gitlab::VisibilityLevel::INTERNAL
haml_concat "The snippet is visible for any logged in user."
when Gitlab::VisibilityLevel::PUBLIC
haml_concat "The snippet can be accessed"
haml_concat "without any"
haml_concat "authentication."
end
end
end
end
def visibility_level_icon(level)
case level case level
when Gitlab::VisibilityLevel::PRIVATE when Gitlab::VisibilityLevel::PRIVATE
private_icon "The snippet is visible only for me."
when Gitlab::VisibilityLevel::INTERNAL when Gitlab::VisibilityLevel::INTERNAL
internal_icon "The snippet is visible for any logged in user."
when Gitlab::VisibilityLevel::PUBLIC when Gitlab::VisibilityLevel::PUBLIC
public_icon "The snippet can be accessed without any authentication."
end end
end end
......
...@@ -12,11 +12,20 @@ ...@@ -12,11 +12,20 @@
Forked from Forked from
= link_to project_path(forked_from_project) do = link_to project_path(forked_from_project) do
= forked_from_project.namespace.try(:name) = forked_from_project.namespace.try(:name)
.cover-controls .cover-controls.left
.visibility-level-label .visibility-level-label.has_tooltip{title: project_visibility_level_description(@project.visibility_level), data: { container: 'body' } }
= visibility_level_icon(@project.visibility_level) = visibility_level_icon(@project.visibility_level, fw: false)
= visibility_level_label(@project.visibility_level) = visibility_level_label(@project.visibility_level)
.cover-controls
- if can?(current_user, :admin_project, @project)
= link_to edit_project_path(@project), class: 'btn btn-gray' do
= icon('pencil')
- if current_user
&nbsp;
= link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), class: 'btn btn-gray' do
= icon('rss')
.project-repo-buttons .project-repo-buttons
.split-one .split-one
= render 'projects/buttons/star' = render 'projects/buttons/star'
......
.issuable-details .issuable-details
.page-title .page-title
.snippet-box{class: visibility_level_color(@snippet.visibility_level)} .snippet-box.has_tooltip{class: visibility_level_color(@snippet.visibility_level), title: snippet_visibility_level_description(@snippet.visibility_level), data: { container: 'body' }}
= visibility_level_icon(@snippet.visibility_level) = visibility_level_icon(@snippet.visibility_level, fw: false)
= visibility_level_label(@snippet.visibility_level) = visibility_level_label(@snippet.visibility_level)
Snippet ##{@snippet.id} Snippet ##{@snippet.id}
%span.creator %span.creator
......
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