summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkushalpandya <kushal@gitlab.com>2017-10-09 17:47:37 +0530
committerkushalpandya <kushal@gitlab.com>2017-10-09 17:47:37 +0530
commit68bf2c92289489c6f1e37e4890769b65c536d638 (patch)
treeca948c601d2757afc65b4989b402ff815a0a7d3a
parenta8f9dde94eeb2ac5484d7b2cb82972653eb46300 (diff)
downloadgitlab-ce-34059-integration-settings-page.tar.gz
Update Edit Webhook form layout34059-integration-settings-page
-rw-r--r--app/assets/stylesheets/pages/integrations.scss2
-rw-r--r--app/views/projects/hooks/_hook_form.html.haml10
-rw-r--r--app/views/shared/web_hooks/_form.html.haml5
-rw-r--r--app/views/shared/web_hooks/_test_button.html.haml3
4 files changed, 12 insertions, 8 deletions
diff --git a/app/assets/stylesheets/pages/integrations.scss b/app/assets/stylesheets/pages/integrations.scss
index 05bc2c6c9de..b91af0ab550 100644
--- a/app/assets/stylesheets/pages/integrations.scss
+++ b/app/assets/stylesheets/pages/integrations.scss
@@ -137,7 +137,7 @@
.panel-footer {
.hook-test-button,
.btn-remove {
- margin-left: 10px;
+ margin-right: 10px;
}
}
}
diff --git a/app/views/projects/hooks/_hook_form.html.haml b/app/views/projects/hooks/_hook_form.html.haml
index 7f39989ddea..fb9d31ac75b 100644
--- a/app/views/projects/hooks/_hook_form.html.haml
+++ b/app/views/projects/hooks/_hook_form.html.haml
@@ -1,5 +1,6 @@
- form_hook_ref = create_hook ? @hook : [@project.namespace.becomes(Namespace), @project, @hook]
- form_parent_class = create_hook ? "create-webhook-form" : "edit-webhook-form"
+- submit_btn_label = create_hook ? 'Add webhook' : 'Save changes'
- cancel_url = !@hooks.nil? && @hooks.any?? project_settings_webhooks_path(@project) : project_settings_integrations_path(@project)
.container-fluid
@@ -12,10 +13,9 @@
%div{ class: form_parent_class }
= form_for @hook, as: :hook, url: polymorphic_path([@project.namespace.becomes(Namespace), @project, :hooks]) do |f|
- = render partial: 'shared/web_hooks/form', locals: { form: f, hook: @hook }
- .panel-footer.container-flex-center
- = f.submit 'Add webhook', class: 'btn btn-create'
+ = render partial: 'shared/web_hooks/form', locals: { form: f, hook: @hook, create_hook: create_hook }
+ .panel-footer{ class: ('container-flex-center' if create_hook) }
+ = f.submit submit_btn_label, class: 'btn btn-create'
+ %a.btn.btn-default.btn-cancel{ href: create_hook ? cancel_url : project_settings_webhooks_path(@project) } Cancel
- unless create_hook
- = render 'shared/web_hooks/test_button', triggers: ProjectHook::TRIGGERS, hook: @hook
= link_to 'Remove', project_hook_path(@project, @hook), method: :delete, class: 'btn btn-remove pull-right', data: { confirm: 'Are you sure?' }
- %a.btn.btn-default.btn-cancel{ href: create_hook ? cancel_url : project_settings_webhooks_path(@project) } Cancel
diff --git a/app/views/shared/web_hooks/_form.html.haml b/app/views/shared/web_hooks/_form.html.haml
index f6d50711ad1..60a3f15f614 100644
--- a/app/views/shared/web_hooks/_form.html.haml
+++ b/app/views/shared/web_hooks/_form.html.haml
@@ -2,7 +2,10 @@
.form-group
= form.label :url, 'URL', class: 'label-light'
- = form.text_field :url, class: 'form-control', placeholder: 'http://example.com/trigger-ci.json'
+ %div{ class: ('input-group' unless create_hook) }
+ = form.text_field :url, class: 'form-control', placeholder: 'http://example.com/trigger-ci.json'
+ - unless create_hook
+ = render 'shared/web_hooks/test_button', triggers: ProjectHook::TRIGGERS, hook: hook, edit_hook_form: true
.form-group
= form.label :token, 'Secret Token', class: 'label-light'
= form.text_field :token, class: 'form-control', placeholder: ''
diff --git a/app/views/shared/web_hooks/_test_button.html.haml b/app/views/shared/web_hooks/_test_button.html.haml
index bfdee2549c1..07c3d254e06 100644
--- a/app/views/shared/web_hooks/_test_button.html.haml
+++ b/app/views/shared/web_hooks/_test_button.html.haml
@@ -1,8 +1,9 @@
- triggers = local_assigns.fetch(:triggers)
- button_class = local_assigns.fetch(:button_class, '')
- hook = local_assigns.fetch(:hook)
+- edit_hook_form = local_assigns.fetch(:edit_hook_form, false)
-.hook-test-button.dropdown.inline
+.hook-test-button.dropdown{ class: (edit_hook_form ? 'input-group-btn' : 'inline') }
%button.btn{ 'data-toggle' => 'dropdown', class: button_class }
Test
= icon('chevron-down')