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
Jérome Perrin
gitlab-ce
Commits
53aeb33f
Commit
53aeb33f
authored
Dec 19, 2016
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct views for first iteration agreement
parent
6d14a664
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
146 additions
and
59 deletions
+146
-59
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
app/views/projects/mattermost/new.html.haml
app/views/projects/mattermost/new.html.haml
+2
-7
app/views/projects/services/_form.html.haml
app/views/projects/services/_form.html.haml
+9
-10
app/views/projects/services/mattermost_slash_commands/_detailed_help.html.haml
...rvices/mattermost_slash_commands/_detailed_help.html.haml
+91
-0
app/views/projects/services/mattermost_slash_commands/_help.html.haml
...ojects/services/mattermost_slash_commands/_help.html.haml
+4
-1
app/views/shared/_service_settings.html.haml
app/views/shared/_service_settings.html.haml
+39
-40
No files found.
app/helpers/projects_helper.rb
View file @
53aeb33f
...
@@ -153,7 +153,7 @@ module ProjectsHelper
...
@@ -153,7 +153,7 @@ module ProjectsHelper
return
nil
unless
team
[
'display_name'
]
&&
team
[
'id'
]
return
nil
unless
team
[
'display_name'
]
&&
team
[
'id'
]
[
team
[
'display_name'
],
team
[
'id'
]]
[
team
[
'display_name'
],
team
[
'id'
]]
end
.
compact
end
.
compact
teams_options
.
unshift
([
'Select a team...'
,
'0'
])
unless
teams_options
.
count
===
1
teams_options
.
unshift
([
'Select a team...'
,
'0'
])
unless
teams_options
.
one?
teams_options
teams_options
end
end
...
...
app/views/projects/mattermost/new.html.haml
View file @
53aeb33f
-
twoTeams
=
[{
"id"
=>
"w59qt5a817f69jkxdz6xe7y4ir"
,
"create_at"
=>
1481835484179
,
"update_at"
=>
1481835484179
,
"delete_at"
=>
0
,
"display_name"
=>
"new_team"
,
"name"
=>
"new-team"
,
"email"
=>
""
,
"type"
=>
"O"
,
"company_name"
=>
""
,
"allowed_domains"
=>
""
,
"invite_id"
=>
"mfgsqnmpiby18eepo6jd6pq3oh"
,
"allow_open_invite"
=>
false
},
{
"id"
=>
"my9oujxf5jy1zqdgu9rihd66do"
,
"create_at"
=>
1481826062406
,
"update_at"
=>
1481826062406
,
"delete_at"
=>
0
,
"display_name"
=>
"chatops"
,
"name"
=>
"chatops"
,
"email"
=>
""
,
"type"
=>
"O"
,
"company_name"
=>
""
,
"allowed_domains"
=>
""
,
"invite_id"
=>
"s7c1phenmi8udkybcyytc3pxuh"
,
"allow_open_invite"
=>
false
}]
-
oneTeams
=
[{
"id"
=>
"w59qt5a817f69jkxdz6xe7y4ir"
,
"create_at"
=>
1481835484179
,
"update_at"
=>
1481835484179
,
"delete_at"
=>
0
,
"display_name"
=>
"new_team"
,
"name"
=>
"new-team"
,
"email"
=>
""
,
"type"
=>
"O"
,
"company_name"
=>
""
,
"allowed_domains"
=>
""
,
"invite_id"
=>
"mfgsqnmpiby18eepo6jd6pq3oh"
,
"allow_open_invite"
=>
false
}]
-
noTeams
=
[]
-
teams
=
twoTeams
.service-installation
.service-installation
.inline.pull-right
.inline.pull-right
=
custom_icon
(
'mattermost_logo'
,
size:
48
)
=
custom_icon
(
'mattermost_logo'
,
size:
48
)
%h3
Install Mattermost Command
%h3
Install Mattermost Command
-
if
teams
.
count
===
0
-
if
@teams
.
empty?
%p
%p
To install this service, you must be administrator of a team in the Mattermost instance at
To install this service, you must be administrator of a team in the Mattermost instance at
%strong
some_path.url
%strong
some_path.url
...
@@ -23,7 +18,7 @@
...
@@ -23,7 +18,7 @@
=
form_for
(
:create
,
method: :post
,
url:
configure_namespace_project_mattermost_index_path
(
@project
.
namespace
,
@project
,
))
do
|
f
|
=
form_for
(
:create
,
method: :post
,
url:
configure_namespace_project_mattermost_index_path
(
@project
.
namespace
,
@project
,
))
do
|
f
|
%h4
Team
%h4
Team
%p
Select or create the team where the slash commands will be used in
%p
Select or create the team where the slash commands will be used in
-
options
=
mattermost_teams_options
(
teams
)
-
options
=
mattermost_teams_options
(
@
teams
)
-
isOneTeam
=
options
.
count
===
1
-
isOneTeam
=
options
.
count
===
1
=
f
.
select
(
:team_id
,
options
,
{},
{
class:
'form-control'
,
selected:
"
#{
options
.
first
[
1
]
if
isOneTeam
}
"
,
disabled:
isOneTeam
})
=
f
.
select
(
:team_id
,
options
,
{},
{
class:
'form-control'
,
selected:
"
#{
options
.
first
[
1
]
if
isOneTeam
}
"
,
disabled:
isOneTeam
})
-
if
isOneTeam
-
if
isOneTeam
...
...
app/views/projects/services/_form.html.haml
View file @
53aeb33f
...
@@ -8,14 +8,13 @@
...
@@ -8,14 +8,13 @@
.col-lg-9
.col-lg-9
=
form_for
(
@service
,
as: :service
,
url:
namespace_project_service_path
(
@project
.
namespace
,
@project
,
@service
.
to_param
),
method: :put
,
html:
{
class:
'form-horizontal'
})
do
|
form
|
=
form_for
(
@service
,
as: :service
,
url:
namespace_project_service_path
(
@project
.
namespace
,
@project
,
@service
.
to_param
),
method: :put
,
html:
{
class:
'form-horizontal'
})
do
|
form
|
=
render
'shared/service_settings'
,
form:
form
,
subject:
@service
=
render
'shared/service_settings'
,
form:
form
,
subject:
@service
-
if
@service
.
to_param
!=
'mattermost_slash_commands'
.footer-block.row-content-block
.footer-block.row-content-block
=
form
.
submit
'Save changes'
,
class:
'btn btn-save'
=
form
.
submit
'Save changes'
,
class:
'btn btn-save'
-
if
@service
.
valid?
&&
@service
.
activated?
-
if
@service
.
valid?
&&
@service
.
activated?
-
unless
@service
.
can_test?
-
unless
@service
.
can_test?
-
disabled_class
=
'disabled'
-
disabled_class
=
'disabled'
-
disabled_title
=
@service
.
disabled_title
-
disabled_title
=
@service
.
disabled_title
=
link_to
'Test settings'
,
test_namespace_project_service_path
(
@project
.
namespace
,
@project
,
@service
),
class:
"btn
#{
disabled_class
}
"
,
title:
disabled_title
=
link_to
'Test settings'
,
test_namespace_project_service_path
(
@project
.
namespace
,
@project
,
@service
),
class:
"btn
#{
disabled_class
}
"
,
title:
disabled_title
=
link_to
"Cancel"
,
namespace_project_services_path
(
@project
.
namespace
,
@project
),
class:
"btn btn-cancel"
=
link_to
"Cancel"
,
namespace_project_services_path
(
@project
.
namespace
,
@project
),
class:
"btn btn-cancel"
app/views/projects/services/mattermost_slash_commands/_detailed_help.html.haml
0 → 100644
View file @
53aeb33f
-
run_actions_text
=
"Perform common operations on this project:
#{
@project
.
name_with_namespace
}
"
To setup this service:
%ul
.list-unstyled
%li
1.
=
link_to
'Enable custom slash commands'
,
'https://docs.mattermost.com/developer/slash-commands.html#enabling-custom-commands'
on your Mattermost installation
%li
2.
=
link_to
'Add a slash command'
,
'https://docs.mattermost.com/developer/slash-commands.html#set-up-a-custom-command'
in Mattermost with these options:
%hr
.help-form
.form-group
=
label_tag
:display_name
,
'Display name'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:display_name
,
"GitLab /
#{
@project
.
name_with_namespace
}
"
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#display_name'
)
.form-group
=
label_tag
:description
,
'Description'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:description
,
run_actions_text
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#description'
)
.form-group
=
label_tag
nil
,
'Command trigger word'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.text-block
%p
Fill in the word that works best for your team.
%p
Suggestions:
%code
=
'gitlab'
%code
=
@project
.
path
# Path contains no spaces, but dashes
%code
=
@project
.
path_with_namespace
.form-group
=
label_tag
:request_url
,
'Request URL'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:request_url
,
service_trigger_url
(
subject
),
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#request_url'
)
.form-group
=
label_tag
nil
,
'Request method'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.text-block
POST
.form-group
=
label_tag
:response_username
,
'Response username'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:response_username
,
'GitLab'
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#response_username'
)
.form-group
=
label_tag
:response_icon
,
'Response icon'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:response_icon
,
asset_url
(
'gitlab_logo.png'
),
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#response_icon'
)
.form-group
=
label_tag
nil
,
'Autocomplete'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.text-block
Yes
.form-group
=
label_tag
:autocomplete_hint
,
'Autocomplete hint'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:autocomplete_hint
,
'[help]'
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#autocomplete_hint'
)
.form-group
=
label_tag
:autocomplete_description
,
'Autocomplete description'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:autocomplete_description
,
run_actions_text
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#autocomplete_description'
)
%hr
%ul
.list-unstyled
%li
3. After adding the slash command, paste the
%strong
token
into the field below
app/views/projects/services/mattermost_slash_commands/_help.html.haml
View file @
53aeb33f
-
enabled
=
Gitlab
.
config
.
mattermost
.
enabled
.well
.well
This service allows GitLab users to perform common operations on this
This service allows GitLab users to perform common operations on this
project by entering slash commands in Mattermost.
project by entering slash commands in Mattermost.
...
@@ -5,5 +7,6 @@
...
@@ -5,5 +7,6 @@
See list of available commands in Mattermost after setting up this service,
See list of available commands in Mattermost after setting up this service,
by entering
by entering
%code
/
<
command_trigger_word
>
help
%code
/
<
command_trigger_word
>
help
=
render
'projects/services/mattermost_slash_commands/detailed_help'
,
subject:
@service
unless
enabled
=
render
'projects/services/mattermost_slash_commands/installation_info'
=
render
'projects/services/mattermost_slash_commands/installation_info'
if
enabled
app/views/shared/_service_settings.html.haml
View file @
53aeb33f
...
@@ -7,45 +7,44 @@
...
@@ -7,45 +7,44 @@
=
preserve
do
=
preserve
do
=
markdown
@service
.
help
=
markdown
@service
.
help
-
if
@service
.
to_param
!=
'mattermost_slash_commands'
.service-settings
.service-settings
.form-group
=
form
.
label
:active
,
"Active"
,
class:
"control-label"
.col-sm-10
=
form
.
check_box
:active
-
if
@service
.
supported_events
.
present?
.form-group
.form-group
=
form
.
label
:active
,
"Active"
,
class:
"control-label"
=
form
.
label
:url
,
"Trigger"
,
class:
'control-label'
.col-sm-10
.col-sm-10
=
form
.
check_box
:active
-
@service
.
supported_events
.
each
do
|
event
|
%div
-
if
@service
.
supported_events
.
present?
=
form
.
check_box
service_event_field_name
(
event
),
class:
'pull-left'
.form-group
.prepend-left-20
=
form
.
label
:url
,
"Trigger"
,
class:
'control-label'
=
form
.
label
service_event_field_name
(
event
),
class:
'list-label'
do
%strong
.col-sm-10
=
event
.
humanize
-
@service
.
supported_events
.
each
do
|
event
|
%div
-
field
=
@service
.
event_field
(
event
)
=
form
.
check_box
service_event_field_name
(
event
),
class:
'pull-left'
.prepend-left-20
-
if
field
=
form
.
label
service_event_field_name
(
event
),
class:
'list-label'
do
%p
%strong
=
form
.
text_field
field
[
:name
],
class:
"form-control"
,
placeholder:
field
[
:placeholder
]
=
event
.
humanize
%p
.light
-
field
=
@service
.
event_field
(
event
)
=
service_event_description
(
event
)
-
if
field
-
@service
.
global_fields
.
each
do
|
field
|
%p
-
type
=
field
[
:type
]
=
form
.
text_field
field
[
:name
],
class:
"form-control"
,
placeholder:
field
[
:placeholder
]
-
if
type
==
'fieldset'
%p
.light
-
fields
=
field
[
:fields
]
=
service_event_description
(
event
)
-
legend
=
field
[
:legend
]
-
@service
.
global_fields
.
each
do
|
field
|
%fieldset
-
type
=
field
[
:type
]
%legend
=
legend
-
fields
.
each
do
|
subfield
|
-
if
type
==
'fieldset'
=
render
'shared/field'
,
form:
form
,
field:
subfield
-
fields
=
field
[
:fields
]
-
else
-
legend
=
field
[
:legend
]
=
render
'shared/field'
,
form:
form
,
field:
field
%fieldset
%legend
=
legend
-
fields
.
each
do
|
subfield
|
=
render
'shared/field'
,
form:
form
,
field:
subfield
-
else
=
render
'shared/field'
,
form:
form
,
field:
field
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