From 34d1d1676d9771fc03524a75b7bd027f56962f1f Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" <git@zjvandeweg.nl> Date: Fri, 18 Nov 2016 11:58:29 +0100 Subject: [PATCH 1/5] Add framework for rendering partials [ci skip] --- .../projects/services/_mattermost_command_service.html.haml | 1 + app/views/shared/_service_settings.html.haml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 app/views/projects/services/_mattermost_command_service.html.haml diff --git a/app/views/projects/services/_mattermost_command_service.html.haml b/app/views/projects/services/_mattermost_command_service.html.haml new file mode 100644 index 00000000000..1ed62fbfa5b --- /dev/null +++ b/app/views/projects/services/_mattermost_command_service.html.haml @@ -0,0 +1 @@ +Hello Jared! diff --git a/app/views/shared/_service_settings.html.haml b/app/views/shared/_service_settings.html.haml index 601ef51737a..d2576bafe8a 100644 --- a/app/views/shared/_service_settings.html.haml +++ b/app/views/shared/_service_settings.html.haml @@ -1,6 +1,10 @@ = form_errors(@service) -- if @service.help.present? +- byebug + +- if lookup_context.template_exists?(@service.type.underscore, "projects/services", true) + = render 'projects/services/mattermost_command_service' +- elsif @service.help.present? .well = preserve do = markdown @service.help -- GitLab From 8e5ad7c01a3617f57d4750d0be8d8d7405e70137 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" <lbennett@gitlab.com> Date: Fri, 18 Nov 2016 22:46:57 +0000 Subject: [PATCH 2/5] Added new .help-form styling and implemented with mattermost command service help well --- app/assets/stylesheets/framework/common.scss | 4 + app/assets/stylesheets/framework/forms.scss | 40 ++++++- app/views/admin/services/_form.html.haml | 5 +- app/views/projects/services/_form.html.haml | 17 +-- .../_mattermost_command_service.html.haml | 1 - .../mattermost_command/_help.html.haml | 100 ++++++++++++++++++ app/views/shared/_service_settings.html.haml | 6 +- 7 files changed, 157 insertions(+), 16 deletions(-) delete mode 100644 app/views/projects/services/_mattermost_command_service.html.haml create mode 100644 app/views/projects/services/mattermost_command/_help.html.haml diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss index 7f5583c917a..b24fce6f0c2 100644 --- a/app/assets/stylesheets/framework/common.scss +++ b/app/assets/stylesheets/framework/common.scss @@ -299,6 +299,10 @@ table { .well { margin-bottom: $gl-padding; + + hr { + border-color: $gray-darker; + } } .search_box { diff --git a/app/assets/stylesheets/framework/forms.scss b/app/assets/stylesheets/framework/forms.scss index f0727e9688a..be2d87197bf 100644 --- a/app/assets/stylesheets/framework/forms.scss +++ b/app/assets/stylesheets/framework/forms.scss @@ -68,6 +68,45 @@ label { } } +.help-form { + .form-group { + .control-label { + font-weight: bold; + padding-top: 4px; + } + + .form-control { + height: 29px; + background: $white-light; + font-family: $monospace_font; + } + + .input-group-btn .btn { + padding: 3px $gl-btn-padding; + background-color: $gray-light; + border: 1px solid $border-color; + } + + .text-block { + line-height: 0.8; + padding-top: 9px; + + code { + line-height: 1.8; + } + } + + @media(max-width: $screen-sm-min) { + padding: 0 $gl-padding; + + .control-label, + .text-block { + padding-left: 0; + } + } + } +} + .fieldset-form fieldset { margin-bottom: 20px; } @@ -167,4 +206,3 @@ label { color: $gl-text-color; } } - diff --git a/app/views/admin/services/_form.html.haml b/app/views/admin/services/_form.html.haml index cdbfc60f9a4..f313c2d9032 100644 --- a/app/views/admin/services/_form.html.haml +++ b/app/views/admin/services/_form.html.haml @@ -6,5 +6,6 @@ = form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'form-horizontal fieldset-form' } do |form| = render 'shared/service_settings', form: form - .form-actions - = form.submit 'Save', class: 'btn btn-save' + .footer-block.row-content-block + .form-actions + = form.submit 'Save', class: 'btn btn-save' diff --git a/app/views/projects/services/_form.html.haml b/app/views/projects/services/_form.html.haml index b41edeb2c7e..8ada4c4b962 100644 --- a/app/views/projects/services/_form.html.haml +++ b/app/views/projects/services/_form.html.haml @@ -9,12 +9,13 @@ = 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 - = form.submit 'Save changes', class: 'btn btn-save' - - - if @service.valid? && @service.activated? - - unless @service.can_test? - - disabled_class = 'disabled' - - disabled_title = @service.disabled_title + .footer-block.row-content-block + = form.submit 'Save changes', class: 'btn btn-save' + + - if @service.valid? && @service.activated? + - unless @service.can_test? + - disabled_class = 'disabled' + - 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 "Cancel", namespace_project_services_path(@project.namespace, @project), class: "btn btn-cancel" + = 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" diff --git a/app/views/projects/services/_mattermost_command_service.html.haml b/app/views/projects/services/_mattermost_command_service.html.haml deleted file mode 100644 index 1ed62fbfa5b..00000000000 --- a/app/views/projects/services/_mattermost_command_service.html.haml +++ /dev/null @@ -1 +0,0 @@ -Hello Jared! diff --git a/app/views/projects/services/mattermost_command/_help.html.haml b/app/views/projects/services/mattermost_command/_help.html.haml new file mode 100644 index 00000000000..b3386103e7c --- /dev/null +++ b/app/views/projects/services/mattermost_command/_help.html.haml @@ -0,0 +1,100 @@ +- pretty_path_with_namespace = "#{@project ? @project.namespace.name : 'namespace'} / #{@project ? @project.name : 'name'}" +- run_actions_text = "Run action on the GitLab project: #{pretty_path_with_namespace}" + +.well + %p + This service allows GitLab users to perform common operations on this + project by entering slash commands in Mattermost. + %p + See list of available commands in Mattermost after setting up this service, + by entering + %code /<command_trigger_word> help + %p + 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 / #{pretty_path_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= @project ? @project.name : 'project_name' + %code= @project ? @project.namespace.name : 'namespace_name' + %code= @project ? @project.name_with_namespace : 'namespace_name/project_name' + + .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(@service), 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_path('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 diff --git a/app/views/shared/_service_settings.html.haml b/app/views/shared/_service_settings.html.haml index d2576bafe8a..85c54a0fcd4 100644 --- a/app/views/shared/_service_settings.html.haml +++ b/app/views/shared/_service_settings.html.haml @@ -1,9 +1,7 @@ = form_errors(@service) -- byebug - -- if lookup_context.template_exists?(@service.type.underscore, "projects/services", true) - = render 'projects/services/mattermost_command_service' +- if lookup_context.template_exists?('help', "projects/services/#{@service.to_param}", true) + = render "projects/services/#{@service.to_param}/help", subject: @service - elsif @service.help.present? .well = preserve do -- GitLab From e74e53ae98bd7656eb84e907e25f2ad0b70afde9 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" <lbennett@gitlab.com> Date: Sat, 19 Nov 2016 20:56:25 +0000 Subject: [PATCH 3/5] Pass @service using subject --- app/views/admin/services/_form.html.haml | 2 +- app/views/projects/services/_form.html.haml | 2 +- app/views/projects/services/mattermost_command/_help.html.haml | 2 +- app/views/shared/_service_settings.html.haml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/services/_form.html.haml b/app/views/admin/services/_form.html.haml index f313c2d9032..e5b8ebdf613 100644 --- a/app/views/admin/services/_form.html.haml +++ b/app/views/admin/services/_form.html.haml @@ -4,7 +4,7 @@ %p #{@service.description} template = form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'form-horizontal fieldset-form' } do |form| - = render 'shared/service_settings', form: form + = render 'shared/service_settings', form: form, subject: @service .footer-block.row-content-block .form-actions diff --git a/app/views/projects/services/_form.html.haml b/app/views/projects/services/_form.html.haml index 8ada4c4b962..db51c4f8a4e 100644 --- a/app/views/projects/services/_form.html.haml +++ b/app/views/projects/services/_form.html.haml @@ -7,7 +7,7 @@ %p= @service.description .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| - = render 'shared/service_settings', form: form + = render 'shared/service_settings', form: form, subject: @service .footer-block.row-content-block = form.submit 'Save changes', class: 'btn btn-save' diff --git a/app/views/projects/services/mattermost_command/_help.html.haml b/app/views/projects/services/mattermost_command/_help.html.haml index b3386103e7c..c6e0e883752 100644 --- a/app/views/projects/services/mattermost_command/_help.html.haml +++ b/app/views/projects/services/mattermost_command/_help.html.haml @@ -51,7 +51,7 @@ .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(@service), class: 'form-control input-sm', readonly: 'readonly' + = 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') diff --git a/app/views/shared/_service_settings.html.haml b/app/views/shared/_service_settings.html.haml index 85c54a0fcd4..755d6acc777 100644 --- a/app/views/shared/_service_settings.html.haml +++ b/app/views/shared/_service_settings.html.haml @@ -1,7 +1,7 @@ = form_errors(@service) - if lookup_context.template_exists?('help', "projects/services/#{@service.to_param}", true) - = render "projects/services/#{@service.to_param}/help", subject: @service + = render "projects/services/#{@service.to_param}/help", subject: subject - elsif @service.help.present? .well = preserve do -- GitLab From 67fde38806bd843c8008766edf49023e4c63df81 Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" <git@zjvandeweg.nl> Date: Mon, 21 Nov 2016 13:43:31 +0100 Subject: [PATCH 4/5] Improve the mattermost help box Also added tests, and moved the slack test to a better location. --- .../mattermost_slash_commands_service.rb | 7 --- .../_help.html.haml | 12 ++--- .../zj-mattermost-command-help-message.yml | 4 ++ .../services/mattermost_slash_command_spec.rb | 48 +++++++++++++++++++ .../slack_service_spec.rb | 0 5 files changed, 58 insertions(+), 13 deletions(-) rename app/views/projects/services/{mattermost_command => mattermost_slash_commands}/_help.html.haml (89%) create mode 100644 changelogs/unreleased/zj-mattermost-command-help-message.yml create mode 100644 spec/features/projects/services/mattermost_slash_command_spec.rb rename spec/features/projects/{slack_service => services}/slack_service_spec.rb (100%) diff --git a/app/models/project_services/mattermost_slash_commands_service.rb b/app/models/project_services/mattermost_slash_commands_service.rb index 67902329593..33431f41dc2 100644 --- a/app/models/project_services/mattermost_slash_commands_service.rb +++ b/app/models/project_services/mattermost_slash_commands_service.rb @@ -19,13 +19,6 @@ class MattermostSlashCommandsService < ChatService 'mattermost_slash_commands' end - def help - "This service allows you to use slash commands with your Mattermost installation.<br/> - To setup this Service you need to create a new <b>Slash commands</b> in your Mattermost integration panel.<br/> - <br/> - Create integration with URL #{service_trigger_url(self)} and enter the token below." - end - def fields [ { type: 'text', name: 'token', placeholder: '' } diff --git a/app/views/projects/services/mattermost_command/_help.html.haml b/app/views/projects/services/mattermost_slash_commands/_help.html.haml similarity index 89% rename from app/views/projects/services/mattermost_command/_help.html.haml rename to app/views/projects/services/mattermost_slash_commands/_help.html.haml index c6e0e883752..15aa2006c02 100644 --- a/app/views/projects/services/mattermost_command/_help.html.haml +++ b/app/views/projects/services/mattermost_slash_commands/_help.html.haml @@ -1,5 +1,5 @@ - pretty_path_with_namespace = "#{@project ? @project.namespace.name : 'namespace'} / #{@project ? @project.name : 'name'}" -- run_actions_text = "Run action on the GitLab project: #{pretty_path_with_namespace}" +- run_actions_text = "Perform common operations on this project: #{pretty_path_with_namespace}" .well %p @@ -15,7 +15,7 @@ %li 1. = link_to 'Enable custom slash commands', 'https://docs.mattermost.com/developer/slash-commands.html#enabling-custom-commands' - on your Mattermost installation. + 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' @@ -44,9 +44,9 @@ %p Fill in the word that works best for your team. %p Suggestions: - %code= @project ? @project.name : 'project_name' - %code= @project ? @project.namespace.name : 'namespace_name' - %code= @project ? @project.name_with_namespace : 'namespace_name/project_name' + %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' @@ -69,7 +69,7 @@ .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_path('gitlab_logo.png'), class: 'form-control input-sm', readonly: 'readonly' + = 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') diff --git a/changelogs/unreleased/zj-mattermost-command-help-message.yml b/changelogs/unreleased/zj-mattermost-command-help-message.yml new file mode 100644 index 00000000000..fab238a8d8d --- /dev/null +++ b/changelogs/unreleased/zj-mattermost-command-help-message.yml @@ -0,0 +1,4 @@ +--- +title: Add help message for configuring Mattermost slash commands +merge_request: 7558 +author: diff --git a/spec/features/projects/services/mattermost_slash_command_spec.rb b/spec/features/projects/services/mattermost_slash_command_spec.rb new file mode 100644 index 00000000000..f474e7e891b --- /dev/null +++ b/spec/features/projects/services/mattermost_slash_command_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +feature 'Setup Mattermost slash commands', feature: true do + include WaitForAjax + + let(:user) { create(:user) } + let(:project) { create(:project) } + let(:service) { project.create_mattermost_slash_commands_service } + + before do + project.team << [user, :master] + login_as(user) + end + + describe 'user visites the mattermost 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('request_url').value + expect(value).to match("api/v3/projects/#{project.id}/services/mattermost_slash_commands/trigger") + end + end +end diff --git a/spec/features/projects/slack_service/slack_service_spec.rb b/spec/features/projects/services/slack_service_spec.rb similarity index 100% rename from spec/features/projects/slack_service/slack_service_spec.rb rename to spec/features/projects/services/slack_service_spec.rb -- GitLab From 334347febc3dafdb39ef9bc6b552c6eb886bcbfc Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" <lbennett@gitlab.com> Date: Mon, 21 Nov 2016 22:11:21 +0000 Subject: [PATCH 5/5] Frontend review changes --- app/assets/stylesheets/framework/forms.scss | 57 +++++++------- app/assets/stylesheets/pages/settings.scss | 4 + .../mattermost_slash_commands/_help.html.haml | 36 ++++----- app/views/shared/_service_settings.html.haml | 77 ++++++++++--------- 4 files changed, 90 insertions(+), 84 deletions(-) diff --git a/app/assets/stylesheets/framework/forms.scss b/app/assets/stylesheets/framework/forms.scss index be2d87197bf..e83a1f7ad68 100644 --- a/app/assets/stylesheets/framework/forms.scss +++ b/app/assets/stylesheets/framework/forms.scss @@ -68,41 +68,42 @@ label { } } -.help-form { - .form-group { - .control-label { - font-weight: bold; - padding-top: 4px; - } +.help-form .form-group { + margin-left: 0; + margin-right: 0; - .form-control { - height: 29px; - background: $white-light; - font-family: $monospace_font; - } + .control-label { + font-weight: bold; + padding-top: 4px; + } - .input-group-btn .btn { - padding: 3px $gl-btn-padding; - background-color: $gray-light; - border: 1px solid $border-color; - } + .form-control { + height: 29px; + background: $white-light; + font-family: $monospace_font; + } - .text-block { - line-height: 0.8; - padding-top: 9px; + .input-group-btn .btn { + padding: 3px $gl-btn-padding; + background-color: $gray-light; + border: 1px solid $border-color; + } + + .text-block { + line-height: 0.8; + padding-top: 9px; - code { - line-height: 1.8; - } + code { + line-height: 1.8; } + } - @media(max-width: $screen-sm-min) { - padding: 0 $gl-padding; + @media(max-width: $screen-sm-min) { + padding: 0 $gl-padding; - .control-label, - .text-block { - padding-left: 0; - } + .control-label, + .text-block { + padding-left: 0; } } } diff --git a/app/assets/stylesheets/pages/settings.scss b/app/assets/stylesheets/pages/settings.scss index 2e8f356298d..51c926608f9 100644 --- a/app/assets/stylesheets/pages/settings.scss +++ b/app/assets/stylesheets/pages/settings.scss @@ -20,3 +20,7 @@ .danger-title { color: $gl-danger; } + +.service-settings .control-label { + padding-top: 0; +} diff --git a/app/views/projects/services/mattermost_slash_commands/_help.html.haml b/app/views/projects/services/mattermost_slash_commands/_help.html.haml index 15aa2006c02..a676c0290a0 100644 --- a/app/views/projects/services/mattermost_slash_commands/_help.html.haml +++ b/app/views/projects/services/mattermost_slash_commands/_help.html.haml @@ -2,24 +2,24 @@ - run_actions_text = "Perform common operations on this project: #{pretty_path_with_namespace}" .well - %p - This service allows GitLab users to perform common operations on this - project by entering slash commands in Mattermost. - %p - See list of available commands in Mattermost after setting up this service, - by entering - %code /<command_trigger_word> help - %p - 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: + This service allows GitLab users to perform common operations on this + project by entering slash commands in Mattermost. + %br + See list of available commands in Mattermost after setting up this service, + by entering + %code /<command_trigger_word> help + %br + %br + 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 diff --git a/app/views/shared/_service_settings.html.haml b/app/views/shared/_service_settings.html.haml index 755d6acc777..9c5053dace5 100644 --- a/app/views/shared/_service_settings.html.haml +++ b/app/views/shared/_service_settings.html.haml @@ -7,43 +7,44 @@ = preserve do = markdown @service.help -.form-group - = form.label :active, "Active", class: "control-label" - .col-sm-10 - = form.check_box :active - -- if @service.supported_events.present? +.service-settings .form-group - = form.label :url, "Trigger", class: 'control-label' - + = form.label :active, "Active", class: "control-label" .col-sm-10 - - @service.supported_events.each do |event| - %div - = form.check_box service_event_field_name(event), class: 'pull-left' - .prepend-left-20 - = form.label service_event_field_name(event), class: 'list-label' do - %strong - = event.humanize - - - field = @service.event_field(event) - - - if field - %p - = form.text_field field[:name], class: "form-control", placeholder: field[:placeholder] - - %p.light - = service_event_description(event) - -- @service.global_fields.each do |field| - - type = field[:type] - - - if type == 'fieldset' - - fields = field[:fields] - - legend = field[:legend] - - %fieldset - %legend= legend - - fields.each do |subfield| - = render 'shared/field', form: form, field: subfield - - else - = render 'shared/field', form: form, field: field + = form.check_box :active + + - if @service.supported_events.present? + .form-group + = form.label :url, "Trigger", class: 'control-label' + + .col-sm-10 + - @service.supported_events.each do |event| + %div + = form.check_box service_event_field_name(event), class: 'pull-left' + .prepend-left-20 + = form.label service_event_field_name(event), class: 'list-label' do + %strong + = event.humanize + + - field = @service.event_field(event) + + - if field + %p + = form.text_field field[:name], class: "form-control", placeholder: field[:placeholder] + + %p.light + = service_event_description(event) + + - @service.global_fields.each do |field| + - type = field[:type] + + - if type == 'fieldset' + - fields = field[:fields] + - legend = field[:legend] + + %fieldset + %legend= legend + - fields.each do |subfield| + = render 'shared/field', form: form, field: subfield + - else + = render 'shared/field', form: form, field: field -- GitLab