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
9f65c274
Commit
9f65c274
authored
Nov 20, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ci service creation logic
parent
406a0c80
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
app/controllers/services_controller.rb
app/controllers/services_controller.rb
+1
-1
app/models/gitlab_ci_service.rb
app/models/gitlab_ci_service.rb
+7
-3
app/views/services/_gitlab_ci.html.haml
app/views/services/_gitlab_ci.html.haml
+3
-2
No files found.
app/controllers/services_controller.rb
View file @
9f65c274
...
@@ -19,7 +19,7 @@ class ServicesController < ProjectResourceController
...
@@ -19,7 +19,7 @@ class ServicesController < ProjectResourceController
@service
=
@project
.
gitlab_ci_service
@service
=
@project
.
gitlab_ci_service
if
@service
.
update_attributes
(
params
[
:service
])
if
@service
.
update_attributes
(
params
[
:service
])
redirect_to
:back
redirect_to
edit_project_service_path
(
@project
,
:gitlab_ci
)
else
else
render
'edit'
render
'edit'
end
end
...
...
app/models/gitlab_ci_service.rb
View file @
9f65c274
...
@@ -14,12 +14,16 @@
...
@@ -14,12 +14,16 @@
class
GitlabCiService
<
Service
class
GitlabCiService
<
Service
attr_accessible
:project_url
attr_accessible
:project_url
validates
:project_url
,
presence:
true
validates
:project_url
,
presence:
true
,
if: :activated?
validates
:token
,
presence:
true
validates
:token
,
presence:
true
,
if: :activated?
delegate
:execute
,
to: :service_hook
,
prefix:
nil
delegate
:execute
,
to: :service_hook
,
prefix:
nil
after_save
:compose_service_hook
after_save
:compose_service_hook
,
if: :activated?
def
activated?
active
end
def
compose_service_hook
def
compose_service_hook
hook
=
service_hook
||
build_service_hook
hook
=
service_hook
||
build_service_hook
...
...
app/views/services/_gitlab_ci.html.haml
View file @
9f65c274
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
%hr
%hr
=
form_for
(
@service
,
:as
=>
:service
,
:url
=>
project_service_path
(
@project
,
@service
),
:method
=>
:put
)
do
|
f
|
=
form_for
(
@service
,
:as
=>
:service
,
:url
=>
project_service_path
(
@project
,
:gitlab_ci
),
:method
=>
:put
)
do
|
f
|
-
if
@service
.
errors
.
any?
-
if
@service
.
errors
.
any?
.alert-message.block-message.error
.alert-message.block-message.error
%ul
%ul
...
@@ -39,4 +39,5 @@
...
@@ -39,4 +39,5 @@
.form-actions
.form-actions
=
f
.
submit
'Save'
,
class:
'btn save-btn'
=
f
.
submit
'Save'
,
class:
'btn save-btn'
=
link_to
'Test settings'
,
test_project_service_path
(
@project
),
class:
'btn btn-small'
-
if
@service
.
valid?
&&
@service
.
active
=
link_to
'Test settings'
,
test_project_service_path
(
@project
),
class:
'btn btn-small'
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