Skip to content

Commit

Permalink
fix link account ui (#14763)
Browse files Browse the repository at this point in the history
Signed-off-by: a1012112796 <1012112796@qq.com>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
  • Loading branch information
a1012112796 and techknowlogick authored Feb 22, 2021
1 parent a50ca28 commit 1ecdc55
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
23 changes: 11 additions & 12 deletions templates/user/auth/link_account.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
{{.i18n.Tr "auth.oauth_signin_tab"}}
</a>
</div>

<div class="ui middle very relaxed page grid">
<div class="column">
<div class="ui tab {{if not .user_exists}}active{{end}}"
data-tab="auth-link-signup-tab">
{{template "user/auth/signup_inner" .}}
</div>
<div class="ui tab {{if .user_exists}}active{{end}}"
data-tab="auth-link-signin-tab">
<div class="ui user signin container icon">
{{template "user/auth/signin_inner" .}}
</div>
</div>
<div class="ui middle very relaxed page grid">
<div class="column">
<div class="ui tab {{if not .user_exists}}active{{end}}"
data-tab="auth-link-signup-tab">
{{template "user/auth/signup_inner" .}}
</div>
<div class="ui tab {{if .user_exists}}active{{end}}"
data-tab="auth-link-signin-tab">
<div class="ui user signin container icon">
{{template "user/auth/signin_inner" .}}
</div>
</div>
</div>
Expand Down
30 changes: 30 additions & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,33 @@ function initIssueReferenceRepositorySearch() {
});
}

function initLinkAccountView() {
const $lnkUserPage = $('.page-content.user.link-account');
if ($lnkUserPage.length === 0) {
return false;
}

const $signinTab = $lnkUserPage.find('.item[data-tab="auth-link-signin-tab"]');
const $signUpTab = $lnkUserPage.find('.item[data-tab="auth-link-signup-tab"]');
const $signInView = $lnkUserPage.find('.tab[data-tab="auth-link-signin-tab"]');
const $signUpView = $lnkUserPage.find('.tab[data-tab="auth-link-signup-tab"]');

$signUpTab.on('click', () => {
$signinTab.removeClass('active');
$signInView.removeClass('active');
$signUpTab.addClass('active');
$signUpView.addClass('active');
return false;
});

$signinTab.on('click', () => {
$signUpTab.removeClass('active');
$signUpView.removeClass('active');
$signinTab.addClass('active');
$signInView.addClass('active');
});
}

$(document).ready(async () => {
// Show exact time
$('.time-since').each(function () {
Expand Down Expand Up @@ -2456,6 +2483,9 @@ $(document).ready(async () => {
window.location = $(this).data('href');
});

// link-account tab handle
initLinkAccountView();

// Dropzone
const $dropzone = $('#dropzone');
if ($dropzone.length > 0) {
Expand Down

0 comments on commit 1ecdc55

Please sign in to comment.