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
3f60a276
Commit
3f60a276
authored
Dec 13, 2016
by
Luke "Jared" Bennett
Committed by
Kamil Trzcinski
Dec 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added slack slash commands frontend help well
Added tests
parent
0f277628
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
0 deletions
+145
-0
app/assets/stylesheets/framework/forms.scss
app/assets/stylesheets/framework/forms.scss
+4
-0
app/views/projects/services/slack_slash_commands/_help.html.haml
...ws/projects/services/slack_slash_commands/_help.html.haml
+93
-0
spec/features/projects/services/slack_slash_command_spec.rb
spec/features/projects/services/slack_slash_command_spec.rb
+48
-0
No files found.
app/assets/stylesheets/framework/forms.scss
View file @
3f60a276
...
@@ -96,6 +96,10 @@ label {
...
@@ -96,6 +96,10 @@ label {
code
{
code
{
line-height
:
1
.8
;
line-height
:
1
.8
;
}
}
img
{
margin-right
:
$gl-padding
;
}
}
}
@media
(
max-width
:
$screen-xs-max
)
{
@media
(
max-width
:
$screen-xs-max
)
{
...
...
app/views/projects/services/slack_slash_commands/_help.html.haml
0 → 100644
View file @
3f60a276
-
run_actions_text
=
"Perform common operations on this project:
#{
@project
.
name_with_namespace
}
"
.well
This service allows GitLab users to perform common operations on this
project by entering slash commands in Slack.
%br
See list of available commands in Slack after setting up this service,
by entering
%code
/
<
command
>
help
%br
%br
To setup this service:
%ul
.list-unstyled
%li
1.
=
link_to
'Add a slash command'
,
'https://my.slack.com/services/new/slash-commands'
in your Slack team with these options:
%hr
.help-form
.form-group
=
label_tag
nil
,
'Command'
,
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
:url
,
'URL'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:url
,
service_trigger_url
(
subject
),
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#url'
)
.form-group
=
label_tag
nil
,
'Method'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.text-block
POST
.form-group
=
label_tag
:customize_name
,
'Customize name'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:customize_name
,
'GitLab'
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#customize_name'
)
.form-group
=
label_tag
nil
,
'Customize icon'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.text-block
=
image_tag
(
asset_url
(
'gitlab_logo.png'
),
width:
36
,
height:
36
)
=
link_to
(
'Download image'
,
asset_url
(
'gitlab_logo.png'
),
class:
'btn btn-sm'
,
target:
'_blank'
)
.form-group
=
label_tag
nil
,
'Autocomplete'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.text-block
Show this command in the autocomplete list
.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'
)
.form-group
=
label_tag
:autocomplete_usage_hint
,
'Autocomplete usage hint'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:autocomplete_usage_hint
,
'[help]'
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#autocomplete_usage_hint'
)
.form-group
=
label_tag
:descriptive_label
,
'Descriptive label'
,
class:
'col-sm-2 col-xs-12 control-label'
.col-sm-10.col-xs-12.input-group
=
text_field_tag
:descriptive_label
,
'Perform common operations on GitLab project'
,
class:
'form-control input-sm'
,
readonly:
'readonly'
.input-group-btn
=
clipboard_button
(
clipboard_target:
'#descriptive_label'
)
%hr
%ul
.list-unstyled
%li
2. Paste the
%strong
Token
into the field below
%li
3. Select the
%strong
Active
checkbox, press
%strong
Save changes
and start using GitLab inside Slack!
spec/features/projects/services/slack_slash_command_spec.rb
0 → 100644
View file @
3f60a276
require
'spec_helper'
feature
'Setup Slack slash commands'
,
feature:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:service
)
{
project
.
create_slack_slash_commands_service
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
describe
'user visits the slack slash command config page'
,
js:
true
do
it
'shows a help message'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
wait_for_ajax
expect
(
page
).
to
have_content
(
'This service allows GitLab users to perform common'
)
end
end
describe
'saving a token'
do
let
(
:token
)
{
(
'a'
..
'z'
).
to_a
.
join
}
it
'shows the token after saving'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
fill_in
'service_token'
,
with:
token
click_on
'Save'
value
=
find_field
(
'service_token'
).
value
expect
(
value
).
to
eq
(
token
)
end
end
describe
'the trigger url'
do
it
'shows the correct url'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
value
=
find_field
(
'url'
).
value
expect
(
value
).
to
match
(
"api/v3/projects/
#{
project
.
id
}
/services/slack_slash_commands/trigger"
)
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