Skip to content

Firefly III: a personal finances manager

Fix #12967

James Colef1c9efb5a883
diff --git a/resources/assets/v3/js/pages/profile/oauth.js b/resources/assets/v3/js/pages/profile/oauth.js
index 384ed05e94..a52840d24b 100644
--- a/resources/assets/v3/js/pages/profile/oauth.js
+++ b/resources/assets/v3/js/pages/profile/oauth.js
@@ -22,8 +22,8 @@ import "../../boot/bootstrap.js";
import sidebar from "../../pages/shared/sidebar.js";
import dates from "../shared/dates.js";
import i18next from "i18next";
-import { api } from "../../boot/axios";
-import * as bootstrap from 'bootstrap';
+import {api} from "../../boot/axios";
+import {Modal} from 'bootstrap';
import Alpine from "@alpinejs/csp";
import formatDate from "../../util/format-date.js";
@@ -110,15 +110,14 @@ let index = function () {
// console.log("getTokens()");
api.get("./oauth/personal-access-tokens").then((response) => {
// console.log(response.data);
- for(let i=0;i<response.data.length; i++) {
- if(Object.hasOwn(response.data, i)) {
+ for (let i = 0; i < response.data.length; i++) {
+ if (Object.hasOwn(response.data, i)) {
let token = response.data[i];
- console.log(i18next.t("config.date_time_fns", { lng: locale }));
- token.expires_at = formatDate(new Date(token.expires_at), i18next.t("config.date_time_fns", { lng: locale }), locale);
+ console.log(i18next.t("config.date_time_fns", {lng: locale}));
+ token.expires_at = formatDate(new Date(token.expires_at), i18next.t("config.date_time_fns", {lng: locale}), locale);
this.tokens.push(token);
}
}
- // this.tokens = response.data;
});
},
@@ -126,26 +125,25 @@ let index = function () {
* Show the form for creating new tokens.
*/
showCreateTokenForm() {
- // console.log("showCreateTokenForm()");
- new bootstrap.Modal(document.getElementById("modal-create-token"), {}).show();
+ new Modal(document.getElementById("modal-create-token"), {}).show();
},
/**
* Create a new personal access token.
*/
storePat() {
- // console.log("storePat()");
this.accessToken = null;
-
this.form.errors = [];
api.post("./oauth/personal-access-tokens", this.form)
.then((response) => {
- console.log("Successful POST new token, reset form content.",);
+ //console.log("Successful POST new token, reset form content.",);
this.form.name = "";
this.form.scopes = [];
this.form.errors = [];
+ Modal.getInstance(document.getElementById('modal-create-token')).hide();
+
this.getTokens();
this.showAccessToken(response.data.accessToken);
})
@@ -168,20 +166,8 @@ let index = function () {
* Show the given access token to the user.
*/
showAccessToken(accessToken) {
- // console.log("showAccessToken");
- let modal = new bootstrap.Modal(document.getElementById("modal-create-token"), {});
this.accessToken = accessToken;
- console.log('here we are', modal);
- // modal.toggle();
- // modal.toggle();
-
- modal.addEventListener('hidden.bs.modal', function () {
- new Modal(document.getElementById("modal-access-token"), {}).show();
- });
-
-
-
-
+ new Modal(document.getElementById("modal-access-token"), {}).show();
},
getClients() {
api.get("./oauth/clients").then((response) => {
@@ -189,9 +175,7 @@ let index = function () {
this.clients = response.data;
});
},
- showCreateClientForm() {
- new bootstrap.Modal(document.getElementById("modal-create-client"), {}).show();
- },
+
/**
* Persist the client to storage using the given form.
*/
@@ -205,16 +189,10 @@ let index = function () {
form.name = "";
form.redirect_uris = "";
form.errors = [];
-
- document.addEventListener("hidden.bs.modal", function () {
- console.log('Closed??');
- });
-
- new bootstrap.Modal('#' + modal, {}).hide();
-
+ Modal.getInstance(document.getElementById(modal)).hide();
if (response.data.plainSecret) {
- // this.showClientSecret(response.data.plainSecret);
+ this.showClientSecret(response.data.plainSecret);
}
})
.catch((error) => {
@@ -226,7 +204,6 @@ let index = function () {
} else {
form.errors = ["Something went wrong. Please try again."];
}
- //console.log(form.errors);
});
},
/**
@@ -248,7 +225,7 @@ let index = function () {
regenerateSecret(client) {
api.post("./oauth/clients/regenerate/" + client.id).then((response) => {
this.clientSecret = response.data.plainSecret;
- new Modal(document.getElementById("modal-client-secret"), {}).show();
+ Modal.getInstance(document.getElementById("modal-client-secret"), {}).show();
});
},
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 8f8197d3be..a008f18fdd 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -2771,7 +2771,7 @@ return [
'(partially) reimburses' => '(partially) reimburses',
'explain_related' => 'You can link transactions. The link doesn\'t do anything YET, but this is on my list.',
'no_relations_yet' => 'This transaction has no relations to other transactions (yet).',
- 'auto_save_active' => 'Changes are saved automatically.',
+ 'auto_save_active' => 'Changes are saved automatically in the background.',
// split a transaction:
'splits' => 'Splits',
diff --git a/resources/views/components/transaction/split.blade.php b/resources/views/components/transaction/split.blade.php
index e7c5da225c..6bcbd93cfe 100644
--- a/resources/views/components/transaction/split.blade.php
+++ b/resources/views/components/transaction/split.blade.php
@@ -272,9 +272,11 @@
<div class="modal-footer">
<div class="row inline" style="width:100%;">
<div class="col align-middle d-flex align-items-center">
+ <template x-if="'edit' === formBehaviour.formType">
<em><small>
{{ __('firefly.auto_save_active') }}
</small></em>
+ </template>
</div>
<div class="col text-end">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button>
diff --git a/resources/views/profile/oauth/index.blade.php b/resources/views/profile/oauth/index.blade.php
index 50106d6a32..a18d483d33 100644
--- a/resources/views/profile/oauth/index.blade.php
+++ b/resources/views/profile/oauth/index.blade.php
@@ -110,16 +110,13 @@
</div>
<!-- Create Client Modal -->
- <div id="modal-create-client" class="modal fade" role="dialog" tabindex="-1">
+ <div class="modal fade" tabindex="-1" id="modal-create-client">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
- <h5 class="modal-title">
- {{ __('firefly.profile_oauth_create_client') }}
- </h5>
+ <h5 class="modal-title">{{ __('firefly.profile_oauth_create_client') }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ __('firefly.close') }}"></button>
</div>
-
<div class="modal-body">
<!-- Form Errors -->
<template x-if="createForm.errors.length > 0">
@@ -137,8 +134,6 @@
</ul>
</div>
</template>
-
- <!-- Create Client Form -->
<form role="form" aria-label="form">
<!-- Name -->
<div class="form-group row">
@@ -158,9 +153,7 @@
<!-- Redirect URIs -->
<div class="form-group row">
- <label class="col-md-3 col-form-label">{{
- __('firefly.profile_oauth_redirect_url')
- }}</label>
+ <label class="col-md-3 col-form-label">{{__('firefly.profile_oauth_redirect_url')}}</label>
<div class="col-md-9">
<input x-model="createForm.redirect_uris" class="form-control"
@@ -175,36 +168,24 @@
<!-- Confidential -->
<div class="form-group row">
- <label class="col-md-3 col-form-label">{{
- __('firefly.profile_oauth_confidential')
- }}</label>
-
+ <label class="col-md-3 col-form-label">{{ __('firefly.profile_oauth_confidential') }}</label>
<div class="col-md-9">
<div class="checkbox">
<label>
- <input x-model="createForm.confidential"
- type="checkbox">
+ <input x-model="createForm.confidential" type="checkbox">
</label>
</div>
- <span class="form-text text-muted">
- {{ __('firefly.profile_oauth_confidential_help') }}
- </span>
+ <span class="form-text text-muted">{{ __('firefly.profile_oauth_confidential_help') }}</span>
</div>
</div>
</form>
- </div>
- <!-- Modal Actions -->
- <div class="modal-footer">
- <button class="btn btn-secondary" data-bs-dismiss="modal" type="button">{{
- __('firefly.close')
- }}
- </button>
- <button class="btn btn-primary" type="button" @click="store">
- {{ __('firefly.profile_create') }}
- </button>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button>
+ <button type="button" class="btn btn-primary" @click="store">{{ __('firefly.profile_create') }}</button>
</div>
</div>
</div>