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() {
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) {
var actionUrl = $(this).attr('action');
e.preventDefault();
......
......@@ -13,6 +13,7 @@ $atlaskit-border-color: #dfe1e6;
padding-top: $gl-padding-4;
.ak-button {
align-items: center;
height: auto;
margin-left: $btn-margin-5;
}
......@@ -65,11 +66,15 @@ $header-height: 40px;
svg {
fill: currentColor;
&.s16 {
height: 16px;
width: 16px;
}
}
.s16 {
height: 16px;
width: 16px;
.ak-field-group label {
text-align: left;
}
.ak-button__appearance-primary {
......@@ -95,3 +100,11 @@ svg {
}
}
}
.empty-subscriptions {
color: $gray-900;
}
.browser-limitations-notice {
margin-top: 32px;
}
......@@ -6,5 +6,6 @@ class JiraConnect::UsersController < ApplicationController
layout 'devise_experimental_onboarding_issues'
def show
@jira_app_link = params.delete(:return_to)
end
end
......@@ -6,7 +6,7 @@
- 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 }
- 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
%h1
......@@ -16,7 +16,7 @@
%h2.heading-with-border Sign in to GitLab.com to get started.
.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
%p Note: this integration only works with accounts on GitLab.com (SaaS).
......@@ -24,27 +24,31 @@
%form#add-subscription-form.subscription-form{ action: jira_connect_subscriptions_path }
.ak-field-group
%label
Namespace
GitLab namespace
.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' }
Link namespace to Jira
%table.subscriptions
%thead
%tr
%th Namespace
%th Added
%th
%tbody
- @subscriptions.each do |subscription|
- if @subscriptions.present?
%table.subscriptions
%thead
%tr
%td= subscription.namespace.full_path
%td= subscription.created_at
%td= link_to 'Remove', jira_connect_subscription_path(subscription), class: 'remove-subscription'
%p
%th Namespace
%th Added
%th
%tbody
- @subscriptions.each do |subscription|
%tr
%td= subscription.namespace.full_path
%td= subscription.created_at
%td= link_to 'Remove', jira_connect_subscription_path(subscription), class: 'remove-subscription'
- else
%h4.empty-subscriptions
No linked namespaces
%p.browser-limitations-notice
%strong Browser limitations:
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
......
......@@ -4,6 +4,9 @@
%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
- add_page_specific_style 'page_bundles/jira_connect_users'
......@@ -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."
msgstr ""
msgid "Integrations|Return to GitLab for Jira"
msgstr ""
msgid "Integrations|Save settings?"
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