mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
added enter/leave protected session into the mobile frontend
This commit is contained in:
parent
8052574950
commit
fe27c80078
@ -1,4 +1,5 @@
|
||||
import BasicWidget from "../basic_widget.js";
|
||||
import protectedSessionHolder from "../../services/protected_session_holder.js";
|
||||
|
||||
const WIDGET_TPL = `
|
||||
<div id="global-buttons">
|
||||
@ -39,6 +40,8 @@ const WIDGET_TPL = `
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" data-trigger-command="switchToDesktopVersion"><span class="bx bx-laptop"></span> Switch to desktop version</a>
|
||||
<a class="dropdown-item" data-trigger-command="enterProtectedSession"><span class="bx bx-shield-quarter"></span> Enter protected session</a>
|
||||
<a class="dropdown-item" data-trigger-command="leaveProtectedSession"><span class="bx bx-check-shield"></span> Leave protected session</a>
|
||||
<a class="dropdown-item" data-trigger-command="logout"><span class="bx bx-log-out"></span> Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -48,6 +51,18 @@ const WIDGET_TPL = `
|
||||
class MobileGlobalButtonsWidget extends BasicWidget {
|
||||
doRender() {
|
||||
this.$widget = $(WIDGET_TPL);
|
||||
this.updateSettings();
|
||||
}
|
||||
|
||||
protectedSessionStartedEvent() {
|
||||
this.updateSettings();
|
||||
}
|
||||
|
||||
updateSettings() {
|
||||
const protectedSession = protectedSessionHolder.isProtectedSessionAvailable();
|
||||
|
||||
this.$widget.find('[data-trigger-command="enterProtectedSession"]').toggle(!protectedSession);
|
||||
this.$widget.find('[data-trigger-command="leaveProtectedSession"]').toggle(protectedSession);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,7 @@
|
||||
<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div>
|
||||
|
||||
<%- include('dialogs/confirm.ejs') %>
|
||||
<%- include('dialogs/protected_session_password.ejs') %>
|
||||
|
||||
<script type="text/javascript">
|
||||
global = globalThis; /* fixes https://github.com/webpack/webpack/issues/10035 */
|
||||
@ -116,7 +117,8 @@
|
||||
instanceName: '<%= instanceName %>',
|
||||
csrfToken: '<%= csrfToken %>',
|
||||
isDev: <%= isDev %>,
|
||||
appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>
|
||||
appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>,
|
||||
isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user