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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
8f0bf297
Commit
8f0bf297
authored
Jun 02, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unprioritized scope
parent
bf0c4426
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
app/controllers/projects/labels_controller.rb
app/controllers/projects/labels_controller.rb
+2
-2
app/models/label.rb
app/models/label.rb
+5
-3
app/views/projects/labels/index.html.haml
app/views/projects/labels/index.html.haml
+2
-2
No files found.
app/controllers/projects/labels_controller.rb
View file @
8f0bf297
...
@@ -11,8 +11,8 @@ class Projects::LabelsController < Projects::ApplicationController
...
@@ -11,8 +11,8 @@ class Projects::LabelsController < Projects::ApplicationController
respond_to
:js
,
:html
respond_to
:js
,
:html
def
index
def
index
@labels
=
@project
.
labels
.
prioritized
(
false
)
.
page
(
params
[
:page
])
@labels
=
@project
.
labels
.
unprioritized
.
page
(
params
[
:page
])
@prioritized
=
@project
.
labels
.
prioritized
@prioritized
_labels
=
@project
.
labels
.
prioritized
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
...
...
app/models/label.rb
View file @
8f0bf297
...
@@ -32,10 +32,12 @@ class Label < ActiveRecord::Base
...
@@ -32,10 +32,12 @@ class Label < ActiveRecord::Base
scope
:templates
,
->
{
where
(
template:
true
)
}
scope
:templates
,
->
{
where
(
template:
true
)
}
def
self
.
prioritized
(
bool
=
true
)
def
self
.
prioritized
query
=
bool
?
where
.
not
(
priority:
nil
)
:
where
(
priority:
nil
)
where
.
not
(
priority:
nil
).
reorder
(
Gitlab
::
Database
.
nulls_last_order
(
:priority
),
:title
)
end
query
.
reorder
(
Gitlab
::
Database
.
nulls_last_order
(
:priority
),
:title
)
def
self
.
unprioritized
where
(
priority:
nil
).
reorder
(
Gitlab
::
Database
.
nulls_last_order
(
:priority
),
:title
)
end
end
alias_attribute
:name
,
:title
alias_attribute
:name
,
:title
...
...
app/views/projects/labels/index.html.haml
View file @
8f0bf297
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
.prioritized-labels
{
class:
hide_class
}
.prioritized-labels
{
class:
hide_class
}
%h5
Prioritized Label
%h5
Prioritized Label
%ul
.content-list.manage-labels-list.js-prioritized-labels
{
"data-url"
=>
set_sorting_namespace_project_labels_path
(
@project
.
namespace
,
@project
)
}
%ul
.content-list.manage-labels-list.js-prioritized-labels
{
"data-url"
=>
set_sorting_namespace_project_labels_path
(
@project
.
namespace
,
@project
)
}
-
if
@prioritized
.
present?
-
if
@prioritized
_labels
.
present?
=
render
@prioritized
=
render
@prioritized
_labels
-
else
-
else
%p
.empty-message
No prioritized labels yet
%p
.empty-message
No prioritized labels yet
.other-labels
.other-labels
...
...
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