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
3196c529
Commit
3196c529
authored
Apr 02, 2015
by
Ioannis Kappas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added fieldset support to project and admin services views.
split field logic to separate template.
parent
0e0325ee
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
74 deletions
+74
-74
app/views/admin/services/_form.html.haml
app/views/admin/services/_form.html.haml
+25
-37
app/views/projects/services/_form.html.haml
app/views/projects/services/_form.html.haml
+25
-37
app/views/shared/_field.html.haml
app/views/shared/_field.html.haml
+24
-0
No files found.
app/views/admin/services/_form.html.haml
View file @
3196c529
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
%p
#{
@service
.
description
}
template
%p
#{
@service
.
description
}
template
=
form_for
:service
,
url:
admin_application_settings_service_path
,
method: :put
,
html:
{
class:
'form-horizontal fieldset-form'
}
do
|
f
|
=
form_for
:service
,
url:
admin_application_settings_service_path
,
method: :put
,
html:
{
class:
'form-horizontal fieldset-form'
}
do
|
f
orm
|
-
if
@service
.
errors
.
any?
-
if
@service
.
errors
.
any?
#error_explanation
#error_explanation
.alert.alert-danger
.alert.alert-danger
...
@@ -15,80 +15,68 @@
...
@@ -15,80 +15,68 @@
=
markdown
@service
.
help
=
markdown
@service
.
help
.form-group
.form-group
=
f
.
label
:active
,
"Active"
,
class:
"control-label"
=
f
orm
.
label
:active
,
"Active"
,
class:
"control-label"
.col-sm-10
.col-sm-10
=
f
.
check_box
:active
=
f
orm
.
check_box
:active
-
if
@service
.
supported_events
.
length
>
1
-
if
@service
.
supported_events
.
length
>
1
.form-group
.form-group
=
f
.
label
:url
,
"Trigger"
,
class:
'control-label'
=
f
orm
.
label
:url
,
"Trigger"
,
class:
'control-label'
.col-sm-10
.col-sm-10
-
if
@service
.
supported_events
.
include?
(
"push"
)
-
if
@service
.
supported_events
.
include?
(
"push"
)
%div
%div
=
f
.
check_box
:push_events
,
class:
'pull-left'
=
f
orm
.
check_box
:push_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:push_events
,
class:
'list-label'
do
=
f
orm
.
label
:push_events
,
class:
'list-label'
do
%strong
Push events
%strong
Push events
%p
.light
%p
.light
This url will be triggered by a push to the repository
This url will be triggered by a push to the repository
-
if
@service
.
supported_events
.
include?
(
"tag_push"
)
-
if
@service
.
supported_events
.
include?
(
"tag_push"
)
%div
%div
=
f
.
check_box
:tag_push_events
,
class:
'pull-left'
=
f
orm
.
check_box
:tag_push_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:tag_push_events
,
class:
'list-label'
do
=
f
orm
.
label
:tag_push_events
,
class:
'list-label'
do
%strong
Tag push events
%strong
Tag push events
%p
.light
%p
.light
This url will be triggered when a new tag is pushed to the repository
This url will be triggered when a new tag is pushed to the repository
-
if
@service
.
supported_events
.
include?
(
"note"
)
-
if
@service
.
supported_events
.
include?
(
"note"
)
%div
%div
=
f
.
check_box
:note_events
,
class:
'pull-left'
=
f
orm
.
check_box
:note_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:note_events
,
class:
'list-label'
do
=
f
orm
.
label
:note_events
,
class:
'list-label'
do
%strong
Comments
%strong
Comments
%p
.light
%p
.light
This url will be triggered when someone adds a comment
This url will be triggered when someone adds a comment
-
if
@service
.
supported_events
.
include?
(
"issue"
)
-
if
@service
.
supported_events
.
include?
(
"issue"
)
%div
%div
=
f
.
check_box
:issues_events
,
class:
'pull-left'
=
f
orm
.
check_box
:issues_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:issues_events
,
class:
'list-label'
do
=
f
orm
.
label
:issues_events
,
class:
'list-label'
do
%strong
Issues events
%strong
Issues events
%p
.light
%p
.light
This url will be triggered when an issue is created
This url will be triggered when an issue is created
-
if
@service
.
supported_events
.
include?
(
"merge_request"
)
-
if
@service
.
supported_events
.
include?
(
"merge_request"
)
%div
%div
=
f
.
check_box
:merge_requests_events
,
class:
'pull-left'
=
f
orm
.
check_box
:merge_requests_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:merge_requests_events
,
class:
'list-label'
do
=
f
orm
.
label
:merge_requests_events
,
class:
'list-label'
do
%strong
Merge Request events
%strong
Merge Request events
%p
.light
%p
.light
This url will be triggered when a merge request is created
This url will be triggered when a merge request is created
-
@service
.
fields
.
each
do
|
field
|
-
@service
.
fields
.
each
do
|
field
|
-
name
=
field
[
:name
]
-
title
=
field
[
:title
]
||
name
.
humanize
-
value
=
@service
.
send
(
name
)
unless
field
[
:type
]
==
'password'
-
type
=
field
[
:type
]
-
type
=
field
[
:type
]
-
placeholder
=
field
[
:placeholder
]
-
choices
=
field
[
:choices
]
-
default_choice
=
field
[
:default_choice
]
-
help
=
field
[
:help
]
.form-group
-
if
type
==
'fieldset'
=
f
.
label
name
,
title
,
class:
"control-label"
-
fields
=
field
[
:fields
]
.col-sm-10
-
legend
=
field
[
:legend
]
-
if
type
==
'text'
=
f
.
text_field
name
,
class:
"form-control"
,
placeholder:
placeholder
%fieldset
-
elsif
type
==
'textarea'
%legend
=
legend
=
f
.
text_area
name
,
rows:
5
,
class:
"form-control"
,
placeholder:
placeholder
-
fields
.
each
do
|
subfield
|
-
elsif
type
==
'checkbox'
=
render
'shared/field'
,
form:
form
,
field:
subfield
=
f
.
check_box
name
-
else
-
elsif
type
==
'select'
=
render
'shared/field'
,
form:
form
,
field:
field
=
f
.
select
name
,
options_for_select
(
choices
,
value
?
value
:
default_choice
),
{},
{
class:
"form-control"
}
-
elsif
type
==
'password'
=
f
.
password_field
name
,
class:
'form-control'
-
if
help
%span
.help-block
=
help
.form-actions
.form-actions
=
f
.
submit
'Save'
,
class:
'btn btn-save'
=
f
orm
.
submit
'Save'
,
class:
'btn btn-save'
app/views/projects/services/_form.html.haml
View file @
3196c529
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
%hr
%hr
=
form_for
(
@service
,
as: :service
,
url:
namespace_project_service_path
(
@project
.
namespace
,
@project
,
@service
.
to_param
),
method: :put
,
html:
{
class:
'form-horizontal'
})
do
|
f
|
=
form_for
(
@service
,
as: :service
,
url:
namespace_project_service_path
(
@project
.
namespace
,
@project
,
@service
.
to_param
),
method: :put
,
html:
{
class:
'form-horizontal'
})
do
|
f
orm
|
-
if
@service
.
errors
.
any?
-
if
@service
.
errors
.
any?
.alert.alert-danger
.alert.alert-danger
%ul
%ul
...
@@ -23,83 +23,71 @@
...
@@ -23,83 +23,71 @@
=
markdown
@service
.
help
=
markdown
@service
.
help
.form-group
.form-group
=
f
.
label
:active
,
"Active"
,
class:
"control-label"
=
f
orm
.
label
:active
,
"Active"
,
class:
"control-label"
.col-sm-10
.col-sm-10
=
f
.
check_box
:active
=
f
orm
.
check_box
:active
-
if
@service
.
supported_events
.
length
>
1
-
if
@service
.
supported_events
.
length
>
1
.form-group
.form-group
=
f
.
label
:url
,
"Trigger"
,
class:
'control-label'
=
f
orm
.
label
:url
,
"Trigger"
,
class:
'control-label'
.col-sm-10
.col-sm-10
-
if
@service
.
supported_events
.
include?
(
"push"
)
-
if
@service
.
supported_events
.
include?
(
"push"
)
%div
%div
=
f
.
check_box
:push_events
,
class:
'pull-left'
=
f
orm
.
check_box
:push_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:push_events
,
class:
'list-label'
do
=
f
orm
.
label
:push_events
,
class:
'list-label'
do
%strong
Push events
%strong
Push events
%p
.light
%p
.light
This url will be triggered by a push to the repository
This url will be triggered by a push to the repository
-
if
@service
.
supported_events
.
include?
(
"tag_push"
)
-
if
@service
.
supported_events
.
include?
(
"tag_push"
)
%div
%div
=
f
.
check_box
:tag_push_events
,
class:
'pull-left'
=
f
orm
.
check_box
:tag_push_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:tag_push_events
,
class:
'list-label'
do
=
f
orm
.
label
:tag_push_events
,
class:
'list-label'
do
%strong
Tag push events
%strong
Tag push events
%p
.light
%p
.light
This url will be triggered when a new tag is pushed to the repository
This url will be triggered when a new tag is pushed to the repository
-
if
@service
.
supported_events
.
include?
(
"note"
)
-
if
@service
.
supported_events
.
include?
(
"note"
)
%div
%div
=
f
.
check_box
:note_events
,
class:
'pull-left'
=
f
orm
.
check_box
:note_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:note_events
,
class:
'list-label'
do
=
f
orm
.
label
:note_events
,
class:
'list-label'
do
%strong
Comments
%strong
Comments
%p
.light
%p
.light
This url will be triggered when someone adds a comment
This url will be triggered when someone adds a comment
-
if
@service
.
supported_events
.
include?
(
"issue"
)
-
if
@service
.
supported_events
.
include?
(
"issue"
)
%div
%div
=
f
.
check_box
:issues_events
,
class:
'pull-left'
=
f
orm
.
check_box
:issues_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:issues_events
,
class:
'list-label'
do
=
f
orm
.
label
:issues_events
,
class:
'list-label'
do
%strong
Issues events
%strong
Issues events
%p
.light
%p
.light
This url will be triggered when an issue is created
This url will be triggered when an issue is created
-
if
@service
.
supported_events
.
include?
(
"merge_request"
)
-
if
@service
.
supported_events
.
include?
(
"merge_request"
)
%div
%div
=
f
.
check_box
:merge_requests_events
,
class:
'pull-left'
=
f
orm
.
check_box
:merge_requests_events
,
class:
'pull-left'
.prepend-left-20
.prepend-left-20
=
f
.
label
:merge_requests_events
,
class:
'list-label'
do
=
f
orm
.
label
:merge_requests_events
,
class:
'list-label'
do
%strong
Merge Request events
%strong
Merge Request events
%p
.light
%p
.light
This url will be triggered when a merge request is created
This url will be triggered when a merge request is created
-
@service
.
fields
.
each
do
|
field
|
-
@service
.
fields
.
each
do
|
field
|
-
name
=
field
[
:name
]
-
title
=
field
[
:title
]
||
name
.
humanize
-
value
=
service_field_value
(
field
[
:type
],
@service
.
send
(
name
))
-
type
=
field
[
:type
]
-
type
=
field
[
:type
]
-
placeholder
=
field
[
:placeholder
]
-
choices
=
field
[
:choices
]
-
default_choice
=
field
[
:default_choice
]
-
help
=
field
[
:help
]
.form-group
-
if
type
==
'fieldset'
=
f
.
label
name
,
title
,
class:
"control-label"
-
fields
=
field
[
:fields
]
.col-sm-10
-
legend
=
field
[
:legend
]
-
if
type
==
'text'
=
f
.
text_field
name
,
class:
"form-control"
,
placeholder:
placeholder
%fieldset
-
elsif
type
==
'textarea'
%legend
=
legend
=
f
.
text_area
name
,
rows:
5
,
class:
"form-control"
,
placeholder:
placeholder
-
fields
.
each
do
|
subfield
|
-
elsif
type
==
'checkbox'
=
render
'shared/field'
,
form:
form
,
field:
subfield
=
f
.
check_box
name
-
else
-
elsif
type
==
'select'
=
render
'shared/field'
,
form:
form
,
field:
field
=
f
.
select
name
,
options_for_select
(
choices
,
value
?
value
:
default_choice
),
{},
{
class:
"form-control"
}
-
elsif
type
==
'password'
=
f
.
password_field
name
,
placeholder:
value
,
class:
'form-control'
-
if
help
%span
.help-block
=
help
.form-actions
.form-actions
=
f
.
submit
'Save'
,
class:
'btn btn-save'
=
f
orm
.
submit
'Save'
,
class:
'btn btn-save'
-
if
@service
.
valid?
&&
@service
.
activated?
-
if
@service
.
valid?
&&
@service
.
activated?
-
disabled
=
@service
.
can_test?
?
''
:
'disabled'
-
disabled
=
@service
.
can_test?
?
''
:
'disabled'
...
...
app/views/shared/_field.html.haml
0 → 100644
View file @
3196c529
-
name
=
field
[
:name
]
-
title
=
field
[
:title
]
||
name
.
humanize
-
value
=
service_field_value
(
field
[
:type
],
@service
.
send
(
name
))
-
type
=
field
[
:type
]
-
placeholder
=
field
[
:placeholder
]
-
choices
=
field
[
:choices
]
-
default_choice
=
field
[
:default_choice
]
-
help
=
field
[
:help
]
.form-group
=
form
.
label
name
,
title
,
class:
"control-label"
.col-sm-10
-
if
type
==
'text'
=
form
.
text_field
name
,
class:
"form-control"
,
placeholder:
placeholder
-
elsif
type
==
'textarea'
=
form
.
text_area
name
,
rows:
5
,
class:
"form-control"
,
placeholder:
placeholder
-
elsif
type
==
'checkbox'
=
form
.
check_box
name
-
elsif
type
==
'select'
=
form
.
select
name
,
options_for_select
(
choices
,
value
?
value
:
default_choice
),
{},
{
class:
"form-control"
}
-
elsif
type
==
'password'
=
form
.
password_field
name
,
placeholder:
value
,
class:
'form-control'
-
if
help
%span
.help-block
=
help
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