Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
d65647e9
Commit
d65647e9
authored
Dec 02, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add visibility description tooltip to snippet and project visibility labels
parent
085e45a8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
47 deletions
+27
-47
app/helpers/icons_helper.rb
app/helpers/icons_helper.rb
+13
-9
app/helpers/visibility_level_helper.rb
app/helpers/visibility_level_helper.rb
+10
-34
app/views/projects/_home_panel.html.haml
app/views/projects/_home_panel.html.haml
+2
-2
app/views/shared/snippets/_header.html.haml
app/views/shared/snippets/_header.html.haml
+2
-2
No files found.
app/helpers/icons_helper.rb
View file @
d65647e9
...
@@ -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
)
...
...
app/helpers/visibility_level_helper.rb
View file @
d65647e9
...
@@ -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
...
...
app/views/projects/_home_panel.html.haml
View file @
d65647e9
...
@@ -12,9 +12,9 @@
...
@@ -12,9 +12,9 @@
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
)
.visibility-level-label
=
visibility_level_icon
(
@project
.
visibility_level
)
.cover-controls.left
.cover-controls.left
.visibility-level-label.has_tooltip
{
title:
project_visibility_level_description
(
@project
.
visibility_level
),
data:
{
container:
'body'
}
}
=
visibility_level_icon
(
@project
.
visibility_level
,
fw:
false
)
=
visibility_level_label
(
@project
.
visibility_level
)
=
visibility_level_label
(
@project
.
visibility_level
)
.cover-controls
.cover-controls
...
...
app/views/shared/snippets/_header.html.haml
View file @
d65647e9
.snippet-details
.snippet-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
)
%span
.snippet-id
Snippet ##{@snippet.id}
%span
.snippet-id
Snippet ##{@snippet.id}
%span
.creator
%span
.creator
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment