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
Léo-Paul Géneau
gitlab-ce
Commits
e5ae43e2
Commit
e5ae43e2
authored
Apr 25, 2018
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start changing group label page
parent
a72fc8e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
38 deletions
+67
-38
app/controllers/groups/labels_controller.rb
app/controllers/groups/labels_controller.rb
+17
-13
app/views/groups/labels/index.html.haml
app/views/groups/labels/index.html.haml
+41
-17
app/views/shared/_label.html.haml
app/views/shared/_label.html.haml
+9
-8
No files found.
app/controllers/groups/labels_controller.rb
View file @
e5ae43e2
...
@@ -2,27 +2,20 @@ class Groups::LabelsController < Groups::ApplicationController
...
@@ -2,27 +2,20 @@ class Groups::LabelsController < Groups::ApplicationController
include
ToggleSubscriptionAction
include
ToggleSubscriptionAction
before_action
:label
,
only:
[
:edit
,
:update
,
:destroy
]
before_action
:label
,
only:
[
:edit
,
:update
,
:destroy
]
before_action
:find_labels
,
only:
[
:index
]
before_action
:authorize_admin_labels!
,
only:
[
:new
,
:create
,
:edit
,
:update
,
:destroy
]
before_action
:authorize_admin_labels!
,
only:
[
:new
,
:create
,
:edit
,
:update
,
:destroy
]
before_action
:save_previous_label_path
,
only:
[
:edit
]
before_action
:save_previous_label_path
,
only:
[
:edit
]
respond_to
:html
respond_to
:html
def
index
def
index
respond_to
do
|
format
|
@prioritized_labels
=
@available_labels
.
prioritized
(
@group
)
format
.
html
do
@labels
=
@available_labels
.
unprioritized
(
@group
).
page
(
params
[
:page
])
@labels
=
@group
.
labels
.
page
(
params
[
:page
])
end
respond_to
do
|
format
|
format
.
html
format
.
json
do
format
.
json
do
available_labels
=
LabelsFinder
.
new
(
render
json:
LabelSerializer
.
new
.
represent_appearance
(
@available_labels
)
current_user
,
group_id:
@group
.
id
,
only_group_labels:
params
[
:only_group_labels
],
include_ancestor_groups:
params
[
:include_ancestor_groups
],
include_descendant_groups:
params
[
:include_descendant_groups
]
).
execute
render
json:
LabelSerializer
.
new
.
represent_appearance
(
available_labels
)
end
end
end
end
end
end
...
@@ -113,4 +106,15 @@ class Groups::LabelsController < Groups::ApplicationController
...
@@ -113,4 +106,15 @@ class Groups::LabelsController < Groups::ApplicationController
def
save_previous_label_path
def
save_previous_label_path
session
[
:previous_labels_path
]
=
URI
(
request
.
referer
||
''
).
path
session
[
:previous_labels_path
]
=
URI
(
request
.
referer
||
''
).
path
end
end
def
find_labels
@available_labels
||=
LabelsFinder
.
new
(
current_user
,
group_id:
@group
.
id
,
only_group_labels:
params
[
:only_group_labels
],
include_ancestor_groups:
params
[
:include_ancestor_groups
],
include_descendant_groups:
params
[
:include_descendant_groups
]
).
execute
end
end
end
app/views/groups/labels/index.html.haml
View file @
e5ae43e2
-
page_title
'Labels'
-
@no_container
=
true
-
page_title
"Labels"
-
can_admin_label
=
can?
(
current_user
,
:admin_label
,
@group
)
-
hide_class
=
''
-
issuables
=
[
'issues'
,
'merge requests'
]
-
if
can_admin_label
-
content_for
(
:header_content
)
do
.nav-controls
=
link_to
new_group_label_path
(
@group
),
class:
"btn btn-new"
do
New label
.top-area.adjust
-
if
@labels
.
exists?
||
@prioritized_labels
.
exists?
.nav-text
#promote-label-modal
=
_
(
"Labels can be applied to %{features}. Group labels are available for any project within the group."
)
%
{
features:
issuables
.
to_sentence
}
%div
{
class:
container_class
}
.top-area.adjust
.nav-text
Labels can be applied to issues, merge requests and epics. Group labels are available for any project within the group.
-
if
can_admin_label
Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging.
.nav-controls
.labels-container.prepend-top-5
-
if
can?
(
current_user
,
:admin_label
,
@group
)
-
if
can_admin_label
=
link_to
"New label"
,
new_group_label_path
(
@group
),
class:
"btn btn-new"
-# Only show it in the first page
-
hide
=
@available_labels
.
empty?
||
(
params
[
:page
].
present?
&&
params
[
:page
]
!=
'1'
)
.prioritized-labels
{
class:
(
'hide'
if
hide
)
}
%h5
.prepend-top-0
Prioritized Labels
%ul
.content-list.manage-labels-list.js-prioritized-labels
#js-priority-labels-empty-state
{
class:
"#{'hidden' unless @prioritized_labels.empty?}"
}
=
render
'shared/empty_states/priority_labels'
-
if
@prioritized_labels
.
present?
=
render
partial:
'shared/label'
,
subject:
@group
,
collection:
@prioritized_labels
,
as: :label
.labels
-
if
@labels
.
present?
.other-labels
.other-labels
-
if
@labels
.
present?
-
if
can_admin_label
%ul
.content-list.manage-labels-list.js-other-labels
%h5
{
class:
(
'hide'
if
hide
)
}
Other Labels
=
render
partial:
'shared/label'
,
subject:
@group
,
collection:
@labels
,
as: :label
%ul
.content-list.manage-labels-list.js-other-labels
=
paginate
@labels
,
theme:
'gitlab'
=
render
partial:
'shared/label'
,
subject:
@group
,
collection:
@labels
,
as: :label
-
else
=
paginate
@labels
,
theme:
'gitlab'
.nothing-here-block
-
else
=
_
(
"No labels created yet."
)
=
render
'shared/empty_states/labels'
%template
#js-badge-item-template
%li
.label-link-item.js-priority-badge.inline.prepend-left-10
.label-badge.label-badge-blue
Prioritized label
app/views/shared/_label.html.haml
View file @
e5ae43e2
...
@@ -6,17 +6,18 @@
...
@@ -6,17 +6,18 @@
-
show_label_issues_link
=
show_label_issuables_link?
(
label
,
:issues
,
project:
@project
)
-
show_label_issues_link
=
show_label_issuables_link?
(
label
,
:issues
,
project:
@project
)
%li
.label-list-item
{
id:
label_css_id
,
data:
{
id:
label
.
id
}
}
%li
.label-list-item
{
id:
label_css_id
,
data:
{
id:
label
.
id
}
}
=
render
"shared/label_row"
,
label:
label
=
render
"shared/label_row"
,
label:
label
,
subject:
subject
%ul
.label-actions-list
%ul
.label-actions-list
%li
.inline
%li
.inline
.label-badge.label-badge-gray
=
label
.
model_name
.
human
.
capitalize
.label-badge.label-badge-gray
=
label
.
model_name
.
human
.
capitalize
-
if
can?
(
current_user
,
:admin_label
,
@project
)
-
if
can?
(
current_user
,
:admin_label
,
label
)
%li
.inline.js-toggle-priority
{
data:
{
url:
remove_priority_project_label_path
(
@project
,
label
),
-
if
subject
.
is_a?
(
Project
)
dom_id:
dom_id
(
label
),
type:
label
.
type
}
}
%li
.inline.js-toggle-priority
{
data:
{
url:
remove_priority_project_label_path
(
@project
,
label
),
%button
.label-action.add-priority.btn.btn-transparent.has-tooltip
{
title:
'Prioritize'
,
type:
'button'
,
:'data-placement'
=>
'top'
}
dom_id:
dom_id
(
label
),
type:
label
.
type
}
}
=
icon
(
'star-o'
)
%button
.label-action.add-priority.btn.btn-transparent.has-tooltip
{
title:
'Prioritize'
,
type:
'button'
,
:'data-placement'
=>
'top'
}
%button
.label-action.remove-priority.btn.btn-transparent.has-tooltip
{
title:
'Remove priority'
,
type:
'button'
,
:'data-placement'
=>
'top'
}
=
icon
(
'star-o'
)
=
icon
(
'star'
)
%button
.label-action.remove-priority.btn.btn-transparent.has-tooltip
{
title:
'Remove priority'
,
type:
'button'
,
:'data-placement'
=>
'top'
}
=
icon
(
'star'
)
%li
.inline
%li
.inline
=
link_to
edit_label_path
(
label
),
class:
'btn btn-transparent label-action'
do
=
link_to
edit_label_path
(
label
),
class:
'btn btn-transparent label-action'
do
=
icon
(
'pencil'
)
=
icon
(
'pencil'
)
...
...
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