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
Tatuya Kamada
gitlab-ce
Commits
71647fd5
Commit
71647fd5
authored
May 07, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/labels_set' of /home/git/repositories/gitlab/gitlabhq
parents
af5d0e9e
04da04ff
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
94 additions
and
30 deletions
+94
-30
app/controllers/labels_controller.rb
app/controllers/labels_controller.rb
+7
-1
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+0
-10
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+28
-0
app/models/project.rb
app/models/project.rb
+2
-2
app/views/issues/_issue.html.haml
app/views/issues/_issue.html.haml
+1
-1
app/views/issues/show.html.haml
app/views/issues/show.html.haml
+1
-1
app/views/labels/_label.html.haml
app/views/labels/_label.html.haml
+12
-6
app/views/labels/index.html.haml
app/views/labels/index.html.haml
+6
-6
config/routes.rb
config/routes.rb
+7
-1
lib/gitlab/issues_labels.rb
lib/gitlab/issues_labels.rb
+28
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+2
-2
No files found.
app/controllers/labels_controller.rb
View file @
71647fd5
...
@@ -7,7 +7,13 @@ class LabelsController < ProjectResourceController
...
@@ -7,7 +7,13 @@ class LabelsController < ProjectResourceController
respond_to
:js
,
:html
respond_to
:js
,
:html
def
index
def
index
@labels
=
@project
.
issues_labels
.
order
(
'count DESC'
)
@labels
=
@project
.
issues_labels
end
def
generate
Gitlab
::
IssuesLabels
.
generate
(
@project
)
redirect_to
project_labels_path
(
@project
)
end
end
protected
protected
...
...
app/helpers/issues_helper.rb
View file @
71647fd5
...
@@ -11,10 +11,6 @@ module IssuesHelper
...
@@ -11,10 +11,6 @@ module IssuesHelper
classes
classes
end
end
def
issue_tags
@project
.
issues
.
tag_counts_on
(
:labels
).
map
(
&
:name
)
end
# Returns an OpenStruct object suitable for use by <tt>options_from_collection_for_select</tt>
# Returns an OpenStruct object suitable for use by <tt>options_from_collection_for_select</tt>
# to allow filtering issues by an unassigned User or Milestone
# to allow filtering issues by an unassigned User or Milestone
def
unassigned_filter
def
unassigned_filter
...
@@ -32,12 +28,6 @@ module IssuesHelper
...
@@ -32,12 +28,6 @@ module IssuesHelper
}
}
end
end
def
labels_autocomplete_source
labels
=
@project
.
issues_labels
.
order
(
'count DESC'
)
labels
=
labels
.
map
{
|
l
|
{
label:
l
.
name
,
value:
l
.
name
}
}
labels
.
to_json
end
def
issues_active_milestones
def
issues_active_milestones
@project
.
milestones
.
active
.
order
(
"id desc"
).
all
@project
.
milestones
.
active
.
order
(
"id desc"
).
all
end
end
...
...
app/helpers/labels_helper.rb
0 → 100644
View file @
71647fd5
module
LabelsHelper
def
issue_tags
@project
.
issues
.
tag_counts_on
(
:labels
).
map
(
&
:name
)
end
def
labels_autocomplete_source
labels
=
@project
.
issues_labels
labels
=
labels
.
map
{
|
l
|
{
label:
l
.
name
,
value:
l
.
name
}
}
labels
.
to_json
end
def
label_css_class
(
name
)
klass
=
Gitlab
::
IssuesLabels
case
name
when
*
klass
.
warning_labels
'label-warning'
when
*
klass
.
neutral_labels
'label-inverse'
when
*
klass
.
positive_labels
'label-success'
when
*
klass
.
important_labels
'label-important'
else
'label-info'
end
end
end
app/models/project.rb
View file @
71647fd5
...
@@ -34,7 +34,7 @@ class Project < ActiveRecord::Base
...
@@ -34,7 +34,7 @@ class Project < ActiveRecord::Base
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
acts_as_taggable_on
:labels
acts_as_taggable_on
:labels
,
:issues_default_labels
attr_accessor
:import_url
attr_accessor
:import_url
...
@@ -204,7 +204,7 @@ class Project < ActiveRecord::Base
...
@@ -204,7 +204,7 @@ class Project < ActiveRecord::Base
end
end
def
issues_labels
def
issues_labels
issues
.
tag_counts_on
(
:labels
)
@issues_labels
||=
(
issues_default_labels
+
issues
.
tags_on
(
:labels
)).
uniq
.
sort_by
(
&
:name
)
end
end
def
issue_exists?
(
issue_id
)
def
issue_exists?
(
issue_id
)
...
...
app/views/issues/_issue.html.haml
View file @
71647fd5
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
.issue-labels
.issue-labels
-
issue
.
labels
.
each
do
|
label
|
-
issue
.
labels
.
each
do
|
label
|
%span
.label.label-info
%span
{
class:
"label #{label_css_class(label.name)}"
}
%i
.icon-tag
%i
.icon-tag
=
label
.
name
=
label
.
name
...
...
app/views/issues/show.html.haml
View file @
71647fd5
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
.pull-right
.pull-right
-
@issue
.
labels
.
each
do
|
label
|
-
@issue
.
labels
.
each
do
|
label
|
%span
.label
%span
{
class:
"label #{label_css_class(label.name)}"
}
%i
.icon-tag
%i
.icon-tag
=
label
.
name
=
label
.
name
...
...
app/views/labels/_label.html.haml
View file @
71647fd5
-
frequency
=
@project
.
issues
.
tagged_with
(
label
.
name
).
count
%li
%li
%strong
%strong
%i
.icon-tag
%span
{
class:
"label #{label_css_class(label.name)}"
}
=
label
.
name
%i
.icon-tag
-
if
frequency
.
zero?
%span
.light
=
label
.
name
-
else
=
label
.
name
.pull-right
.pull-right
=
link_to
project_issues_path
(
label_name:
label
.
name
)
do
-
unless
frequency
.
zero?
%strong
=
link_to
project_issues_path
(
label_name:
label
.
name
)
do
=
pluralize
(
label
.
count
,
'issue'
)
%strong
=
"»"
=
pluralize
(
frequency
,
'issue'
)
=
"»"
app/views/labels/index.html.haml
View file @
71647fd5
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
%h3
.page_title
%h3
.page_title
Labels
Labels
%br
%br
%div
.ui-box
%ul
.well-list.labels-table
-
if
@labels
.
present?
%ul
.bordered-list.labels-table
-
@labels
.
each
do
|
label
|
-
@labels
.
each
do
|
label
|
=
render
'label'
,
label:
label
=
render
'label'
,
label:
label
-
unless
@labels
.
present?
-
else
%li
.light-well
%h3
.nothing_here_message
Nothing to show here
%h3
.nothing_here_message
Add first label to your issues or
#{
link_to
'generate'
,
generate_project_labels_path
(
@project
),
method: :post
}
default set of labels
config/routes.rb
View file @
71647fd5
...
@@ -269,7 +269,13 @@ Gitlab::Application.routes.draw do
...
@@ -269,7 +269,13 @@ Gitlab::Application.routes.draw do
resources
:team
,
controller:
'team_members'
,
only:
[
:index
]
resources
:team
,
controller:
'team_members'
,
only:
[
:index
]
resources
:milestones
,
except:
[
:destroy
]
resources
:milestones
,
except:
[
:destroy
]
resources
:labels
,
only:
[
:index
]
resources
:labels
,
only:
[
:index
]
do
collection
do
post
:generate
end
end
resources
:issues
,
except:
[
:destroy
]
do
resources
:issues
,
except:
[
:destroy
]
do
collection
do
collection
do
post
:bulk_update
post
:bulk_update
...
...
lib/gitlab/issues_labels.rb
0 → 100644
View file @
71647fd5
module
Gitlab
class
IssuesLabels
class
<<
self
def
important_labels
%w(bug critical confirmed)
end
def
warning_labels
%w(documentation support)
end
def
neutral_labels
%w(discussion suggestion)
end
def
positive_labels
%w(feature enhancement)
end
def
generate
(
project
)
labels
=
important_labels
+
warning_labels
+
neutral_labels
+
positive_labels
project
.
issues_default_label_list
=
labels
project
.
save
end
end
end
end
spec/requests/api/projects_spec.rb
View file @
71647fd5
...
@@ -485,9 +485,9 @@ describe Gitlab::API do
...
@@ -485,9 +485,9 @@ describe Gitlab::API do
response
.
status
.
should
==
200
response
.
status
.
should
==
200
end
end
it
"should return a 40
0
error if hook id not given"
do
it
"should return a 40
5
error if hook id not given"
do
delete
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
)
response
.
status
.
should
==
40
0
response
.
status
.
should
==
40
5
end
end
end
end
...
...
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