Commit f957f842 authored by Justin Ho's avatar Justin Ho

Add button with link back to Jira app

- Use `return_to` param sent in the URL to store the
return URL of the Jira app.
- Refine UI and implement more cleanups.
parent 5d7da3c1
...@@ -18,6 +18,13 @@ function onLoaded() { ...@@ -18,6 +18,13 @@ function onLoaded() {
alert(res.responseJSON.error); alert(res.responseJSON.error);
}; };
AP.getLocation(function(location) {
$('.js-jira-connect-sign-in').each(function() {
var updatedLink = `${$(this).attr('href')}?return_to=${location}`;
$(this).attr('href', updatedLink);
});
});
$('#add-subscription-form').on('submit', function(e) { $('#add-subscription-form').on('submit', function(e) {
var actionUrl = $(this).attr('action'); var actionUrl = $(this).attr('action');
e.preventDefault(); e.preventDefault();
......
...@@ -13,6 +13,7 @@ $atlaskit-border-color: #dfe1e6; ...@@ -13,6 +13,7 @@ $atlaskit-border-color: #dfe1e6;
padding-top: $gl-padding-4; padding-top: $gl-padding-4;
.ak-button { .ak-button {
align-items: center;
height: auto; height: auto;
margin-left: $btn-margin-5; margin-left: $btn-margin-5;
} }
...@@ -65,11 +66,15 @@ $header-height: 40px; ...@@ -65,11 +66,15 @@ $header-height: 40px;
svg { svg {
fill: currentColor; fill: currentColor;
}
.s16 { &.s16 {
height: 16px; height: 16px;
width: 16px; width: 16px;
}
}
.ak-field-group label {
text-align: left;
} }
.ak-button__appearance-primary { .ak-button__appearance-primary {
...@@ -95,3 +100,11 @@ svg { ...@@ -95,3 +100,11 @@ svg {
} }
} }
} }
.empty-subscriptions {
color: $gray-900;
}
.browser-limitations-notice {
margin-top: 32px;
}
...@@ -6,5 +6,6 @@ class JiraConnect::UsersController < ApplicationController ...@@ -6,5 +6,6 @@ class JiraConnect::UsersController < ApplicationController
layout 'devise_experimental_onboarding_issues' layout 'devise_experimental_onboarding_issues'
def show def show
@jira_app_link = params.delete(:return_to)
end end
end end
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- user_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: user_path(current_user) } - user_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: user_path(current_user) }
= _('Signed in to GitLab as %{user_link_start}%{username}%{user_link_end}').html_safe % { user_link_start: user_link_start, username: current_user.to_reference, user_link_end: '</a>'.html_safe } = _('Signed in to GitLab as %{user_link_start}%{username}%{user_link_end}').html_safe % { user_link_start: user_link_start, username: current_user.to_reference, user_link_end: '</a>'.html_safe }
- elsif @subscriptions.present? - elsif @subscriptions.present?
= link_to _('Sign in to GitLab'), jira_connect_users_path, target: '_blank', rel: 'noopener noreferrer' = link_to _('Sign in to GitLab'), jira_connect_users_path, target: '_blank', rel: 'noopener noreferrer', class: 'js-jira-connect-sign-in'
.jira-connect-app .jira-connect-app
%h1 %h1
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
%h2.heading-with-border Sign in to GitLab.com to get started. %h2.heading-with-border Sign in to GitLab.com to get started.
.gl-mt-5 .gl-mt-5
= external_link _('Sign in to GitLab'), jira_connect_users_path, class: 'ak-button ak-button__appearance-primary' = external_link _('Sign in to GitLab'), jira_connect_users_path, class: 'ak-button ak-button__appearance-primary js-jira-connect-sign-in'
.gl-mt-5 .gl-mt-5
%p Note: this integration only works with accounts on GitLab.com (SaaS). %p Note: this integration only works with accounts on GitLab.com (SaaS).
...@@ -24,13 +24,14 @@ ...@@ -24,13 +24,14 @@
%form#add-subscription-form.subscription-form{ action: jira_connect_subscriptions_path } %form#add-subscription-form.subscription-form{ action: jira_connect_subscriptions_path }
.ak-field-group .ak-field-group
%label %label
Namespace GitLab namespace
.ak-field-group.field-group-input .ak-field-group.field-group-input
%input#namespace-input.ak-field-text{ type: 'text', required: true } %input#namespace-input.ak-field-text{ type: 'text', required: true, placeholder: 'e.g. "MyCompany" or "MyCompany/GroupName"' }
%button.ak-button.ak-button__appearance-primary{ type: 'submit' } %button.ak-button.ak-button__appearance-primary{ type: 'submit' }
Link namespace to Jira Link namespace to Jira
- if @subscriptions.present?
%table.subscriptions %table.subscriptions
%thead %thead
%tr %tr
...@@ -43,8 +44,11 @@ ...@@ -43,8 +44,11 @@
%td= subscription.namespace.full_path %td= subscription.namespace.full_path
%td= subscription.created_at %td= subscription.created_at
%td= link_to 'Remove', jira_connect_subscription_path(subscription), class: 'remove-subscription' %td= link_to 'Remove', jira_connect_subscription_path(subscription), class: 'remove-subscription'
- else
%h4.empty-subscriptions
No linked namespaces
%p %p.browser-limitations-notice
%strong Browser limitations: %strong Browser limitations:
Adding a namespace currently works only in browsers that allow cross site cookies. Please make sure to use Adding a namespace currently works only in browsers that allow cross site cookies. Please make sure to use
%a{ href: 'https://www.mozilla.org/en-US/firefox/', target: '_blank', rel: 'noopener noreferrer' } Firefox %a{ href: 'https://www.mozilla.org/en-US/firefox/', target: '_blank', rel: 'noopener noreferrer' } Firefox
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
%p= s_('Integrations|You can now close this window and return to the GitLab for Jira application.') %p= s_('Integrations|You can now close this window and return to the GitLab for Jira application.')
- if @jira_app_link
%p= external_link s_('Integrations|Return to GitLab for Jira'), @jira_app_link, class: 'btn btn-success'
%p= link_to _('Sign out'), destroy_user_session_path, method: :post %p= link_to _('Sign out'), destroy_user_session_path, method: :post
- add_page_specific_style 'page_bundles/jira_connect_users' - add_page_specific_style 'page_bundles/jira_connect_users'
...@@ -14072,6 +14072,9 @@ msgstr "" ...@@ -14072,6 +14072,9 @@ msgstr ""
msgid "Integrations|Projects using custom settings will not be impacted unless the project owner chooses to use instance-level defaults." msgid "Integrations|Projects using custom settings will not be impacted unless the project owner chooses to use instance-level defaults."
msgstr "" msgstr ""
msgid "Integrations|Return to GitLab for Jira"
msgstr ""
msgid "Integrations|Save settings?" msgid "Integrations|Save settings?"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment