Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: add fullscreen mode switch #65

Merged
merged 3 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions shopfloor_mobile/static/wms/src/components/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,48 @@ Vue.component("screen-loading", {
</v-overlay>
`,
});

Vue.component("btn-fullscreen", {
data: function() {
return {
fullscreen_on: document.fullscreenElement ? true : false,
};
},
computed: {
btn_label: function() {
const transition = this.fullscreen_on ? "exit" : "enter";
return this.$t("screen.settings.fullscreen." + transition);
},
},
methods: {
go_fullscreen: function() {
const elem = document.documentElement;
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
/* Firefox */
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
/* Chrome, Safari & Opera */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
/* IE/Edge */
elem.msRequestFullscreen();
}
this.fullscreen_on = true;
},
leave_fullscreen: function() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
this.fullscreen_on = false;
},
},
template: `<btn-action @click="fullscreen_on ? leave_fullscreen() : go_fullscreen()">{{ btn_label }}</btn-action>`,
});
12 changes: 12 additions & 0 deletions shopfloor_mobile/static/wms/src/i18n.translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export const messages = {
name: "Profile",
title: "Select profile",
},
fullscreen: {
enter: "Go fullscreen",
exit: "Exit fullscreen",
},
},
},
language: {
Expand Down Expand Up @@ -73,6 +77,10 @@ export const messages = {
name: "Profil",
title: "Choisissez un profil",
},
fullscreen: {
enter: "Go fullscreen",
exit: "Exit fullscreen",
},
},
},
language: {
Expand Down Expand Up @@ -116,6 +124,10 @@ export const messages = {
name: "Profil",
title: "Wähle Profil",
},
fullscreen: {
enter: "Go fullscreen",
exit: "Exit fullscreen",
},
},
},
language: {
Expand Down
15 changes: 14 additions & 1 deletion shopfloor_mobile/static/wms/src/loginpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,24 @@ export var LoginPage = Vue.component("login-page", {
label="API Key"
placeholder="YOUR_API_KEY_HERE"
autofocus></v-text-field>
<v-btn color="success" type="submit">Submit</v-btn>
<div class="button-list button-vertical-list full">
<v-row align="center">
<v-col class="text-center" cols="12">
<v-btn color="success" type="submit">Login</v-btn>
</v-col>
</v-row>
</div>
</v-form>
</div>
</v-col>
</v-row>
<div class="button-list button-vertical-list full">
<v-row align="center">
<v-col class="text-center" cols="12">
<btn-fullscreen />
</v-col>
</v-row>
</div>
</v-container>
</Screen>
`,
Expand Down
5 changes: 5 additions & 0 deletions shopfloor_mobile/static/wms/src/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export var SettingsControlPanel = Vue.component("settings-control-panel", {
</v-btn>
</v-col>
</v-row>
<v-row align="center">
<v-col class="text-center" cols="12">
<btn-fullscreen />
</v-col>
</v-row>
<v-row align="center">
<v-col class="text-center" cols="12">
<btn-back/>
Expand Down