-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16429 from opf/implementation/56922-trigger-a-log…
…in-dialog-when-the-user-has-no-oauth-access-grant Implementation/56922 trigger a login dialog when the user has no oauth access grant
- Loading branch information
Showing
27 changed files
with
929 additions
and
429 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
frontend/src/stimulus/controllers/dynamic/auto-show-dialog.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* -- copyright | ||
* OpenProject is an open source project management software. | ||
* Copyright (C) the OpenProject GmbH | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License version 3. | ||
* | ||
* OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
* Copyright (C) 2006-2013 Jean-Philippe Lang | ||
* Copyright (C) 2010-2013 the ChiliProject Team | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* See COPYRIGHT and LICENSE files for more details. | ||
* ++ | ||
*/ | ||
|
||
import { Controller } from '@hotwired/stimulus'; | ||
|
||
export default class AutoShowDialogController extends Controller<HTMLDialogElement> { | ||
connect() { | ||
this.element.showModal(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
..._project/storages/admin/oauth_access_grant_nudge_modal_component_preview/default.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<p> | ||
<strong>Default</strong><br/> | ||
<%= render(Storages::Admin::OAuthAccessGrantNudgeModalComponent.new(project_storage:, authorized:, confirm_button_url:)) %> | ||
<%= render(Storages::Admin::Storages::OAuthAccessGrantNudgeModalComponent.new(storage:, confirm_button_url:)) %> | ||
</p> |
92 changes: 0 additions & 92 deletions
92
.../storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.html.erb
This file was deleted.
Oops, something went wrong.
102 changes: 0 additions & 102 deletions
102
modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb
This file was deleted.
Oops, something went wrong.
99 changes: 99 additions & 0 deletions
99
.../app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<%= | ||
component_wrapper do | ||
render( | ||
Primer::Alpha::Dialog.new( | ||
id: dialog_id, | ||
title: heading_text, | ||
data: { | ||
'application-target': 'dynamic', | ||
controller: 'storages--oauth-access-grant-nudge-modal', | ||
'storages--oauth-access-grant-nudge-modal-close-button-label-value': I18n.t('button_close'), | ||
'storages--oauth-access-grant-nudge-modal-loading-screen-reader-message-value': waiting_title, | ||
}, | ||
test_selector: 'oauth-access-grant-nudge-modal', | ||
size: :large | ||
) | ||
) do |dialog| | ||
dialog.with_header( | ||
show_divider: false, | ||
role: :alert, | ||
aria: { live: :assertive }, | ||
data: { | ||
'storages--oauth-access-grant-nudge-modal-target': 'header' | ||
}, | ||
visually_hide_title: true | ||
) | ||
|
||
dialog.with_body( | ||
id: dialog_body_id, | ||
test_selector: 'oauth-access-grant-nudge-modal-body' | ||
) do | ||
concat( | ||
render( | ||
Primer::Beta::Text.new( | ||
display: :none, | ||
data: { | ||
'storages--oauth-access-grant-nudge-modal-target': 'loadingIndicator' | ||
} | ||
) | ||
) { render(Storages::OpenProjectStorageModalComponent::Body.new(:waiting, waiting_title:)) } | ||
) | ||
concat( | ||
render(Primer::Beta::Blankslate.new( | ||
border: false, | ||
data: { "storages--oauth-access-grant-nudge-modal-target": "requestAccessBody" } | ||
)) do |component| | ||
component.with_visual_icon(icon: :"sign-in", size: :medium) | ||
|
||
component.with_heading(tag: :h2, aria: { hidden: true }) | ||
.with_content(heading_text) | ||
|
||
component.with_description(color: :subtle) { body_text } | ||
end | ||
) | ||
end | ||
|
||
dialog.with_footer(show_divider: false) do | ||
concat( | ||
render( | ||
Primer::Beta::Button.new( | ||
scheme: :default, | ||
size: :medium, | ||
data: { | ||
'close-dialog-id': dialog_id, | ||
'storages--oauth-access-grant-nudge-modal-target': 'closeButton' | ||
} | ||
) | ||
) { cancel_button_text } | ||
) | ||
|
||
concat( | ||
primer_form_with( | ||
model:, | ||
url: confirm_button_url, | ||
method: :get, | ||
data: { | ||
'storages--oauth-access-grant-nudge-modal-target': 'requestAccessForm' | ||
} | ||
) do |_form| | ||
render( | ||
Primer::Beta::Button.new( | ||
scheme: :primary, | ||
size: :medium, | ||
type: :submit, | ||
aria: { label: login_button_aria_label }, | ||
data: { | ||
'storages--oauth-access-grant-nudge-modal-target': 'requestAccessButton', | ||
action: 'storages--oauth-access-grant-nudge-modal#requestAccess' | ||
} | ||
) | ||
) do |button| | ||
button.with_trailing_action_icon(icon: :"link-external") | ||
login_button_label | ||
end | ||
end | ||
) | ||
end | ||
end | ||
end | ||
%> |
Oops, something went wrong.