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
6bd3d72b
Commit
6bd3d72b
authored
Sep 03, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added spinach for glabal labels
parent
f5ffeac0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
200 additions
and
121 deletions
+200
-121
app/controllers/admin/labels_controller.rb
app/controllers/admin/labels_controller.rb
+0
-1
db/schema.rb
db/schema.rb
+37
-120
features/admin/labels.feature
features/admin/labels.feature
+38
-0
features/steps/admin/labels.rb
features/steps/admin/labels.rb
+117
-0
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+8
-0
No files found.
app/controllers/admin/labels_controller.rb
View file @
6bd3d72b
class
Admin::LabelsController
<
Admin
::
ApplicationController
before_action
:set_label
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
...
...
db/schema.rb
View file @
6bd3d72b
...
...
@@ -24,17 +24,6 @@ ActiveRecord::Schema.define(version: 20150902001023) do
t
.
datetime
"updated_at"
end
create_table
"appearances"
,
force:
true
do
|
t
|
t
.
string
"title"
t
.
text
"description"
t
.
string
"logo"
t
.
integer
"updated_by"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"dark_logo"
t
.
string
"light_logo"
end
create_table
"application_settings"
,
force:
true
do
|
t
|
t
.
integer
"default_projects_limit"
t
.
boolean
"signup_enabled"
...
...
@@ -47,36 +36,17 @@ ActiveRecord::Schema.define(version: 20150902001023) do
t
.
integer
"default_branch_protection"
,
default:
2
t
.
boolean
"twitter_sharing_enabled"
,
default:
true
t
.
text
"restricted_visibility_levels"
t
.
boolean
"version_check_enabled"
,
default:
true
t
.
integer
"max_attachment_size"
,
default:
10
,
null:
false
t
.
integer
"default_project_visibility"
t
.
integer
"default_snippet_visibility"
t
.
text
"restricted_signup_domains"
t
.
boolean
"version_check_enabled"
,
default:
true
t
.
boolean
"user_oauth_applications"
,
default:
true
t
.
string
"after_sign_out_path"
t
.
integer
"session_expire_delay"
,
default:
10080
,
null:
false
t
.
text
"help_text"
t
.
text
"import_sources"
end
create_table
"approvals"
,
force:
true
do
|
t
|
t
.
integer
"merge_request_id"
,
null:
false
t
.
integer
"user_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
create_table
"approvers"
,
force:
true
do
|
t
|
t
.
integer
"target_id"
,
null:
false
t
.
string
"target_type"
t
.
integer
"user_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
add_index
"approvers"
,
[
"target_id"
,
"target_type"
],
name:
"index_approvers_on_target_id_and_target_type"
,
using: :btree
add_index
"approvers"
,
[
"user_id"
],
name:
"index_approvers_on_user_id"
,
using: :btree
create_table
"audit_events"
,
force:
true
do
|
t
|
t
.
integer
"author_id"
,
null:
false
t
.
string
"type"
,
null:
false
...
...
@@ -149,28 +119,6 @@ ActiveRecord::Schema.define(version: 20150902001023) do
add_index
"forked_project_links"
,
[
"forked_to_project_id"
],
name:
"index_forked_project_links_on_forked_to_project_id"
,
unique:
true
,
using: :btree
create_table
"git_hooks"
,
force:
true
do
|
t
|
t
.
string
"force_push_regex"
t
.
string
"delete_branch_regex"
t
.
string
"commit_message_regex"
t
.
boolean
"deny_delete_tag"
t
.
integer
"project_id"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"author_email_regex"
t
.
boolean
"member_check"
,
default:
false
,
null:
false
t
.
string
"file_name_regex"
t
.
boolean
"is_sample"
,
default:
false
t
.
integer
"max_file_size"
,
default:
0
end
create_table
"historical_data"
,
force:
true
do
|
t
|
t
.
date
"date"
,
null:
false
t
.
integer
"active_user_count"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
create_table
"identities"
,
force:
true
do
|
t
|
t
.
string
"extern_uid"
t
.
string
"provider"
...
...
@@ -243,21 +191,6 @@ ActiveRecord::Schema.define(version: 20150902001023) do
add_index
"labels"
,
[
"project_id"
],
name:
"index_labels_on_project_id"
,
using: :btree
create_table
"ldap_group_links"
,
force:
true
do
|
t
|
t
.
string
"cn"
,
null:
false
t
.
integer
"group_access"
,
null:
false
t
.
integer
"group_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"provider"
end
create_table
"licenses"
,
force:
true
do
|
t
|
t
.
text
"data"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
create_table
"members"
,
force:
true
do
|
t
|
t
.
integer
"access_level"
,
null:
false
t
.
integer
"source_id"
,
null:
false
...
...
@@ -339,15 +272,14 @@ ActiveRecord::Schema.define(version: 20150902001023) do
add_index
"milestones"
,
[
"project_id"
],
name:
"index_milestones_on_project_id"
,
using: :btree
create_table
"namespaces"
,
force:
true
do
|
t
|
t
.
string
"name"
,
null:
false
t
.
string
"path"
,
null:
false
t
.
string
"name"
,
null:
false
t
.
string
"path"
,
null:
false
t
.
integer
"owner_id"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"type"
t
.
string
"description"
,
default:
""
,
null:
false
t
.
string
"description"
,
default:
""
,
null:
false
t
.
string
"avatar"
t
.
boolean
"membership_lock"
,
default:
false
end
add_index
"namespaces"
,
[
"created_at"
,
"id"
],
name:
"index_namespaces_on_created_at_and_id"
,
using: :btree
...
...
@@ -425,14 +357,6 @@ ActiveRecord::Schema.define(version: 20150902001023) do
add_index
"oauth_applications"
,
[
"owner_id"
,
"owner_type"
],
name:
"index_oauth_applications_on_owner_id_and_owner_type"
,
using: :btree
add_index
"oauth_applications"
,
[
"uid"
],
name:
"index_oauth_applications_on_uid"
,
unique:
true
,
using: :btree
create_table
"project_group_links"
,
force:
true
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"group_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"group_access"
,
default:
30
,
null:
false
end
create_table
"project_import_data"
,
force:
true
do
|
t
|
t
.
integer
"project_id"
t
.
text
"data"
...
...
@@ -445,30 +369,25 @@ ActiveRecord::Schema.define(version: 20150902001023) do
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"creator_id"
t
.
boolean
"issues_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wall_enabled"
,
default:
true
,
null:
false
t
.
boolean
"merge_requests_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wiki_enabled"
,
default:
true
,
null:
false
t
.
boolean
"issues_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wall_enabled"
,
default:
true
,
null:
false
t
.
boolean
"merge_requests_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wiki_enabled"
,
default:
true
,
null:
false
t
.
integer
"namespace_id"
t
.
string
"issues_tracker"
,
default:
"gitlab"
,
null:
false
t
.
string
"issues_tracker"
,
default:
"gitlab"
,
null:
false
t
.
string
"issues_tracker_id"
t
.
boolean
"snippets_enabled"
,
default:
true
,
null:
false
t
.
boolean
"snippets_enabled"
,
default:
true
,
null:
false
t
.
datetime
"last_activity_at"
t
.
string
"import_url"
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
string
"avatar"
t
.
string
"import_status"
t
.
float
"repository_size"
,
default:
0.0
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
float
"repository_size"
,
default:
0.0
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
string
"import_type"
t
.
string
"import_source"
t
.
text
"merge_requests_template"
t
.
boolean
"merge_requests_rebase_enabled"
,
default:
false
t
.
boolean
"merge_requests_rebase_default"
,
default:
true
t
.
integer
"approvals_before_merge"
,
default:
0
,
null:
false
t
.
boolean
"reset_approvals_on_push"
,
default:
true
t
.
integer
"commit_count"
,
default:
0
t
.
integer
"commit_count"
,
default:
0
end
add_index
"projects"
,
[
"created_at"
,
"id"
],
name:
"index_projects_on_created_at_and_id"
,
using: :btree
...
...
@@ -569,12 +488,12 @@ ActiveRecord::Schema.define(version: 20150902001023) do
add_index
"tags"
,
[
"name"
],
name:
"index_tags_on_name"
,
unique:
true
,
using: :btree
create_table
"users"
,
force:
true
do
|
t
|
t
.
string
"email"
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
default:
""
,
null:
false
t
.
string
"email"
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
default:
""
,
null:
false
t
.
string
"reset_password_token"
t
.
datetime
"reset_password_sent_at"
t
.
datetime
"remember_created_at"
t
.
integer
"sign_in_count"
,
default:
0
t
.
integer
"sign_in_count"
,
default:
0
t
.
datetime
"current_sign_in_at"
t
.
datetime
"last_sign_in_at"
t
.
string
"current_sign_in_ip"
...
...
@@ -582,22 +501,22 @@ ActiveRecord::Schema.define(version: 20150902001023) do
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"name"
t
.
boolean
"admin"
,
default:
false
,
null:
false
t
.
integer
"projects_limit"
,
default:
10
t
.
string
"skype"
,
default:
""
,
null:
false
t
.
string
"linkedin"
,
default:
""
,
null:
false
t
.
string
"twitter"
,
default:
""
,
null:
false
t
.
boolean
"admin"
,
default:
false
,
null:
false
t
.
integer
"projects_limit"
,
default:
10
t
.
string
"skype"
,
default:
""
,
null:
false
t
.
string
"linkedin"
,
default:
""
,
null:
false
t
.
string
"twitter"
,
default:
""
,
null:
false
t
.
string
"authentication_token"
t
.
integer
"theme_id"
,
default:
1
,
null:
false
t
.
integer
"theme_id"
,
default:
1
,
null:
false
t
.
string
"bio"
t
.
integer
"failed_attempts"
,
default:
0
t
.
integer
"failed_attempts"
,
default:
0
t
.
datetime
"locked_at"
t
.
string
"username"
t
.
boolean
"can_create_group"
,
default:
true
,
null:
false
t
.
boolean
"can_create_team"
,
default:
true
,
null:
false
t
.
boolean
"can_create_group"
,
default:
true
,
null:
false
t
.
boolean
"can_create_team"
,
default:
true
,
null:
false
t
.
string
"state"
t
.
integer
"color_scheme_id"
,
default:
1
,
null:
false
t
.
integer
"notification_level"
,
default:
1
,
null:
false
t
.
integer
"color_scheme_id"
,
default:
1
,
null:
false
t
.
integer
"notification_level"
,
default:
1
,
null:
false
t
.
datetime
"password_expires_at"
t
.
integer
"created_by_id"
t
.
datetime
"last_credential_check_at"
...
...
@@ -606,21 +525,20 @@ ActiveRecord::Schema.define(version: 20150902001023) do
t
.
datetime
"confirmed_at"
t
.
datetime
"confirmation_sent_at"
t
.
string
"unconfirmed_email"
t
.
boolean
"hide_no_ssh_key"
,
default:
false
t
.
string
"website_url"
,
default:
""
,
null:
false
t
.
boolean
"hide_no_ssh_key"
,
default:
false
t
.
string
"website_url"
,
default:
""
,
null:
false
t
.
string
"notification_email"
t
.
boolean
"hide_no_password"
,
default:
false
t
.
boolean
"password_automatically_set"
,
default:
false
t
.
boolean
"hide_no_password"
,
default:
false
t
.
boolean
"password_automatically_set"
,
default:
false
t
.
string
"location"
t
.
string
"public_email"
,
default:
""
,
null:
false
t
.
string
"encrypted_otp_secret"
t
.
string
"encrypted_otp_secret_iv"
t
.
string
"encrypted_otp_secret_salt"
t
.
boolean
"otp_required_for_login"
,
default:
false
,
null:
false
t
.
boolean
"otp_required_for_login"
,
default:
false
,
null:
false
t
.
text
"otp_backup_codes"
t
.
integer
"dashboard"
,
default:
0
t
.
datetime
"admin_email_unsubscribed_at"
t
.
integer
"project_view"
,
default:
0
t
.
string
"public_email"
,
default:
""
,
null:
false
t
.
integer
"dashboard"
,
default:
0
t
.
integer
"project_view"
,
default:
0
end
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
...
...
@@ -656,7 +574,6 @@ ActiveRecord::Schema.define(version: 20150902001023) do
t
.
boolean
"merge_requests_events"
,
default:
false
,
null:
false
t
.
boolean
"tag_push_events"
,
default:
false
t
.
boolean
"note_events"
,
default:
false
,
null:
false
t
.
integer
"group_id"
t
.
boolean
"enable_ssl_verification"
,
default:
false
end
...
...
features/admin/labels.feature
0 → 100644
View file @
6bd3d72b
Feature
:
Admin Issues Labels
Background
:
Given
I sign in as an admin
And I have labels
:
"bug",
"feature",
"enhancement"
Given
I visit admin labels page
Scenario
:
I
should see labels list
Then
I should see label 'bug'
And
I should see label 'feature'
Scenario
:
I
create new label
Given
I submit new label 'support'
Then
I should see label 'support'
Scenario
:
I
edit label
Given
I visit 'bug' label edit page
When
I change label 'bug' to 'fix'
Then
I should not see label 'bug'
Then
I should see label 'fix'
Scenario
:
I
remove label
When
I remove label 'bug'
Then
I should not see label 'bug'
@javascript
Scenario
:
I
delete all labels
When
I delete all labels
Then
I should see labels help message
Scenario
:
I
create a label with invalid color
Given
I visit admin new label page
When
I submit new label with invalid color
Then
I should see label color error message
Scenario
:
I
create a label that already exists
Given
I visit admin new label page
When
I submit new label 'bug'
Then
I should see label exist error message
features/steps/admin/labels.rb
0 → 100644
View file @
6bd3d72b
class
Spinach::Features::AdminIssuesLabels
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
step
'I visit \'bug\' label edit page'
do
visit
edit_admin_label_path
(
bug_label
)
end
step
'I visit admin new label page'
do
visit
new_admin_label_path
end
step
'I visit admin labels page'
do
visit
admin_labels_path
end
step
'I remove label \'bug\''
do
page
.
within
"#label_
#{
bug_label
.
id
}
"
do
click_link
'Remove'
end
end
step
'I have labels: "bug", "feature", "enhancement"'
do
[
"bug"
,
"feature"
,
"enhancement"
].
each
do
|
title
|
Label
.
create
(
title:
title
,
template:
true
)
end
end
step
'I delete all labels'
do
page
.
within
'.labels'
do
page
.
all
(
'.btn-remove'
).
each
do
|
remove
|
remove
.
click
sleep
0.05
end
end
end
step
'I should see labels help message'
do
page
.
within
'.labels'
do
expect
(
page
).
to
have_content
'There are no any labels yet'
end
end
step
'I submit new label \'support\''
do
visit
new_admin_label_path
fill_in
'Title'
,
with:
'support'
fill_in
'Background Color'
,
with:
'#F95610'
click_button
'Save'
end
step
'I submit new label \'bug\''
do
visit
new_admin_label_path
fill_in
'Title'
,
with:
'bug'
fill_in
'Background Color'
,
with:
'#F95610'
click_button
'Save'
end
step
'I submit new label with invalid color'
do
visit
new_admin_label_path
fill_in
'Title'
,
with:
'support'
fill_in
'Background Color'
,
with:
'#12'
click_button
'Save'
end
step
'I should see label exist error message'
do
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
'Title has already been taken'
end
end
step
'I should see label color error message'
do
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
'Color is invalid'
end
end
step
'I should see label \'feature\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'feature'
end
end
step
'I should see label \'bug\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'bug'
end
end
step
'I should not see label \'bug\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
not_to
have_content
'bug'
end
end
step
'I should see label \'support\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'support'
end
end
step
'I change label \'bug\' to \'fix\''
do
fill_in
'Title'
,
with:
'fix'
fill_in
'Background Color'
,
with:
'#F15610'
click_button
'Save'
end
step
'I should see label \'fix\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'fix'
end
end
def
bug_label
Label
.
templates
.
find_or_create_by
(
title:
'bug'
)
end
end
spec/services/projects/create_service_spec.rb
View file @
6bd3d72b
...
...
@@ -17,6 +17,14 @@ describe Projects::CreateService do
expect
(
project
.
services
).
not_to
be_empty
end
it
'creates labels on Project creation if there are templates'
do
Label
.
create
(
title:
"bug"
,
template:
true
)
project
=
create_project
(
@user
,
@opts
)
project
.
reload
expect
(
project
.
labels
).
not_to
be_empty
end
context
'user namespace'
do
before
do
@project
=
create_project
(
@user
,
@opts
)
...
...
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