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
Kazuhiko Shiozaki
gitlab-ce
Commits
31682eb9
Commit
31682eb9
authored
Feb 19, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'visibletrap/gitlab-ce-label'
parents
0c5abb1e
cec57275
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
70 additions
and
19 deletions
+70
-19
CHANGELOG
CHANGELOG
+2
-0
app/assets/stylesheets/pages/labels.scss
app/assets/stylesheets/pages/labels.scss
+1
-1
app/controllers/admin/labels_controller.rb
app/controllers/admin/labels_controller.rb
+1
-1
app/controllers/concerns/issues_action.rb
app/controllers/concerns/issues_action.rb
+2
-0
app/controllers/concerns/merge_requests_action.rb
app/controllers/concerns/merge_requests_action.rb
+2
-0
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-0
app/controllers/projects/labels_controller.rb
app/controllers/projects/labels_controller.rb
+1
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-0
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+18
-2
app/models/label.rb
app/models/label.rb
+8
-7
app/views/admin/labels/_form.html.haml
app/views/admin/labels/_form.html.haml
+4
-0
app/views/admin/labels/_label.html.haml
app/views/admin/labels/_label.html.haml
+6
-4
app/views/projects/labels/_form.html.haml
app/views/projects/labels/_form.html.haml
+4
-0
app/views/projects/labels/_label.html.haml
app/views/projects/labels/_label.html.haml
+2
-1
app/views/shared/_label_row.html.haml
app/views/shared/_label_row.html.haml
+4
-0
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+4
-0
db/migrate/20160217100506_add_description_to_label.rb
db/migrate/20160217100506_add_description_to_label.rb
+5
-0
db/schema.rb
db/schema.rb
+3
-2
No files found.
CHANGELOG
View file @
31682eb9
...
...
@@ -73,6 +73,8 @@ v 8.5.0 (unreleased)
- Make it possible to erase a build (trace, artifacts) using UI and API
- Ability to revert changes from a Merge Request or Commit
- Emoji comment on diffs are not award emoji
- Add label description (Nuttanart Pornprasitsakul)
- Show label row when filtering issues or merge requests by label (Nuttanart Pornprasitsakul)
v 8.4.4
- Update omniauth-saml gem to 1.4.2
...
...
app/assets/stylesheets/pages/labels.scss
View file @
31682eb9
...
...
@@ -9,7 +9,7 @@
}
}
.
manage-labels-list
{
.
label-row
{
.label
{
padding
:
9px
;
font-size
:
14px
;
...
...
app/controllers/admin/labels_controller.rb
View file @
31682eb9
...
...
@@ -53,6 +53,6 @@ class Admin::LabelsController < Admin::ApplicationController
end
def
label_params
params
[
:label
].
permit
(
:title
,
:color
)
params
[
:label
].
permit
(
:title
,
:
description
,
:
color
)
end
end
app/controllers/concerns/issues_action.rb
View file @
31682eb9
...
...
@@ -6,6 +6,8 @@ module IssuesAction
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
@issues
=
@issues
.
preload
(
:author
,
:project
)
@label
=
@issuable_finder
.
labels
.
first
respond_to
do
|
format
|
format
.
html
format
.
atom
{
render
layout:
false
}
...
...
app/controllers/concerns/merge_requests_action.rb
View file @
31682eb9
...
...
@@ -5,5 +5,7 @@ module MergeRequestsAction
@merge_requests
=
get_merge_requests_collection
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
@merge_requests
=
@merge_requests
.
preload
(
:author
,
:target_project
)
@label
=
@issuable_finder
.
labels
.
first
end
end
app/controllers/projects/issues_controller.rb
View file @
31682eb9
...
...
@@ -32,6 +32,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
@label
=
@project
.
labels
.
find_by
(
title:
params
[
:label_name
])
respond_to
do
|
format
|
format
.
html
...
...
app/controllers/projects/labels_controller.rb
View file @
31682eb9
...
...
@@ -69,7 +69,7 @@ class Projects::LabelsController < Projects::ApplicationController
end
def
label_params
params
.
require
(
:label
).
permit
(
:title
,
:color
)
params
.
require
(
:label
).
permit
(
:title
,
:
description
,
:
color
)
end
def
label
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
31682eb9
...
...
@@ -34,6 +34,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
@merge_requests
=
@merge_requests
.
preload
(
:target_project
)
@label
=
@project
.
labels
.
find_by
(
title:
params
[
:label_name
])
respond_to
do
|
format
|
format
.
html
format
.
json
do
...
...
app/finders/issuable_finder.rb
View file @
31682eb9
...
...
@@ -119,6 +119,20 @@ class IssuableFinder
labels?
&&
params
[
:label_name
]
==
Label
::
None
.
title
end
def
labels
return
@labels
if
defined?
(
@labels
)
if
labels?
&&
!
filter_by_no_label?
@labels
=
Label
.
where
(
title:
label_names
)
if
projects
@labels
=
@labels
.
where
(
project:
projects
)
end
else
@labels
=
Label
.
none
end
end
def
assignee?
params
[
:assignee_id
].
present?
end
...
...
@@ -253,8 +267,6 @@ class IssuableFinder
joins
(
"LEFT OUTER JOIN label_links ON label_links.target_type = '
#{
klass
.
name
}
' AND label_links.target_id =
#{
klass
.
table_name
}
.id"
).
where
(
label_links:
{
id:
nil
})
else
label_names
=
params
[
:label_name
].
split
(
","
)
items
=
items
.
joins
(
:labels
).
where
(
labels:
{
title:
label_names
})
if
projects
...
...
@@ -266,6 +278,10 @@ class IssuableFinder
items
end
def
label_names
params
[
:label_name
].
split
(
','
)
end
def
current_user_related?
params
[
:scope
]
==
'created-by-me'
||
params
[
:scope
]
==
'authored'
||
params
[
:scope
]
==
'assigned-to-me'
end
...
...
app/models/label.rb
View file @
31682eb9
...
...
@@ -9,6 +9,7 @@
# created_at :datetime
# updated_at :datetime
# template :boolean default(FALSE)
# description :string(255)
#
class
Label
<
ActiveRecord
::
Base
...
...
app/views/admin/labels/_form.html.haml
View file @
31682eb9
...
...
@@ -11,6 +11,10 @@
=
f
.
label
:title
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:title
,
class:
"form-control"
,
required:
true
.form-group
=
f
.
label
:description
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:description
,
class:
"form-control js-quick-submit"
.form-group
=
f
.
label
:color
,
"Background color"
,
class:
'control-label'
.col-sm-10
...
...
app/views/admin/labels/_label.html.haml
View file @
31682eb9
%li
{
id:
dom_id
(
label
)}
.label-row
=
render_colored_label
(
label
)
=
markdown
(
label
.
description
,
pipeline: :single_line
)
.pull-right
=
link_to
'Edit'
,
edit_admin_label_path
(
label
),
class:
'btn btn-sm'
=
link_to
'Delete'
,
admin_label_path
(
label
),
class:
'btn btn-sm btn-remove remove-row'
,
method: :delete
,
remote:
true
,
data:
{
confirm:
"Delete this label? Are you sure?"
}
app/views/projects/labels/_form.html.haml
View file @
31682eb9
...
...
@@ -11,6 +11,10 @@
=
f
.
label
:title
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:title
,
class:
"form-control js-quick-submit"
,
required:
true
,
autofocus:
true
.form-group
=
f
.
label
:description
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:description
,
class:
"form-control js-quick-submit"
.form-group
=
f
.
label
:color
,
"Background color"
,
class:
'control-label'
.col-sm-10
...
...
app/views/projects/labels/_label.html.haml
View file @
31682eb9
%li
{
id:
dom_id
(
label
)}
=
link_to_label
(
label
)
=
render
"shared/label_row"
,
label:
label
.pull-right
%strong
.append-right-20
=
link_to_label
(
label
)
do
...
...
app/views/shared/_label_row.html.haml
0 → 100644
View file @
31682eb9
%span
.label-row
=
link_to_label
(
label
)
%span
.prepend-left-10
=
markdown
(
label
.
description
,
pipeline: :single_line
)
app/views/shared/issuable/_filter.html.haml
View file @
31682eb9
...
...
@@ -41,6 +41,10 @@
.filter-item.inline
=
button_tag
"Update issues"
,
class:
"btn update_selected_issues btn-save"
-
if
@label
.gray-content-block.second-block
=
render
"shared/label_row"
,
label:
@label
:javascript
new
UsersSelect
();
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
...
...
db/migrate/20160217100506_add_description_to_label.rb
0 → 100644
View file @
31682eb9
class
AddDescriptionToLabel
<
ActiveRecord
::
Migration
def
change
add_column
:labels
,
:description
,
:string
end
end
db/schema.rb
View file @
31682eb9
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201602
09130428
)
do
ActiveRecord
::
Schema
.
define
(
version:
201602
17100506
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -446,6 +446,7 @@ ActiveRecord::Schema.define(version: 20160209130428) do
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
boolean
"template"
,
default:
false
t
.
string
"description"
end
add_index
"labels"
,
[
"project_id"
],
name:
"index_labels_on_project_id"
,
using: :btree
...
...
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