Keybind and view fix
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
soraefir 2023-07-15 13:45:50 +02:00
parent 8a8f1f5a8a
commit 6250f17207
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
5 changed files with 49 additions and 32 deletions

View File

@ -141,16 +141,17 @@ const app = new Vue({
next_step: function(){ next_step: function(){
this.journey_step_data.day += 1; this.journey_step_data.day += 1;
let s = this.journey_step_data.section; let s = this.journey_step_data.section;
let cd = this.journey_data.main[s].dateRange? let cd = this.step_len(s);
this.step_len(s):0;
if(this.journey_step_data.day>cd){ if(this.journey_step_data.day>cd){
this.journey_step_data.section +=1; this.journey_step_data.section +=1;
if(this.journey_step_data.section>=this.journey_data.main.length){ if(this.journey_step_data.section>=this.journey_data.main.length){
this.journey_step_data.section = this.journey_data.main.length-1; this.journey_step_data.section = this.journey_data.main.length-1;
} this.journey_step_data.day = cd
}else{
this.journey_step_data.day = 1; this.journey_step_data.day = 1;
} }
}
}, },
prev_step: function(){ prev_step: function(){
@ -162,8 +163,7 @@ const app = new Vue({
}else{ }else{
let s = this.journey_step_data.section; let s = this.journey_step_data.section;
let cd = this.journey_data.main[s].dateRange? let cd = this.step_len(s);
this.step_len(s):0;
this.journey_step_data.day = cd ; this.journey_step_data.day = cd ;
} }
} }
@ -290,8 +290,10 @@ const app = new Vue({
import_data:function(){ import_data:function(){
this.journey_data = Object.assign({}, JSON.parse(toDecoded(this.impexp))); this.journey_data = Object.assign({}, JSON.parse(toDecoded(this.impexp)));
this.journey_data.main.forEach(e=>{ this.journey_data.main.forEach(e=>{
if(e.dateRange){
e.dateRange[0] = new Date(e.dateRange[0]); e.dateRange[0] = new Date(e.dateRange[0]);
e.dateRange[1] = new Date(e.dateRange[1]); e.dateRange[1] = new Date(e.dateRange[1]);
}
}) })
}, },
export_data:function(){ export_data:function(){
@ -308,18 +310,31 @@ const app = new Vue({
list.splice(idx, 1); list.splice(idx, 1);
}, },
log:function(e){console.log(e)}, log:function(e){console.log(e)},
keyboardEvent (e) {
if (e.which === 13) {
}
},
}, },
created: function () { created: function () {
window.addEventListener('keydown', (e) => {
switch(e.key){
case 'ArrowLeft': this.prev_step(); break;
case 'ArrowRight': this.next_step(); break;
default: console.log(e.key);
}
});
axios.get('/api/'+this.journey_id).then(response =>{ axios.get('/api/'+this.journey_id).then(response =>{
if(response.data=='') throw "Invalid Journey Data Received"; if(response.data=='') throw "Invalid Journey Data Received";
app.journey_data = response.data; app.journey_data = response.data;
for(let e of app.journey_data.main){ for(let e of app.journey_data.main){
if(e.dateRange && e.dateRange.length===2){ if(e.dateRange){
e.dateRange[0]= new Date(e.dateRange[0]); e.dateRange[0]= new Date(e.dateRange[0]);
e.dateRange[1]= new Date(e.dateRange[1]); e.dateRange[1]= new Date(e.dateRange[1]);
} }
e.flight = undefined;
e.step_title = e.step_title || []; e.step_title = e.step_title || [];
} }
}); });

View File

@ -16,10 +16,10 @@ mixin map(section_str)
span.row.text-small.text-white(v-else) {{ #{section_str}.hotel.notes}} span.row.text-small.text-white(v-else) {{ #{section_str}.hotel.notes}}
l-marker(v-for='place in '+section_str+'.places.activities' :lat-lng='place.latlon') l-marker(v-for='place in '+section_str+'.places.activities' :lat-lng='place.latlon')
l-icon l-icon
div(v-if='place.step==journey_step_data.day' v-html='generate_icon(place)') div(v-if='place.step==journey_step_data.day' v-html='generate_icon(place)')
div(v-else-if='place.step==-1 || place.step==undefined' v-html='generate_icon(place, "gray")') div(v-else-if='place.step==-1 || place.step==undefined' v-html='generate_icon(place, "gray")')
div(v-else-if='journey_edit' v-html='generate_icon(place, "lightgray")') div(v-else-if='journey_edit' v-html='generate_icon(place, "lightgray")')
div(v-else)
l-popup l-popup
h1.row.text-medium.text-center {{place.sname}} h1.row.text-medium.text-center {{place.sname}}
span.row.text-small.text-gray {{place.display_name}} span.row.text-small.text-gray {{place.display_name}}

View File

@ -10,7 +10,7 @@ header.header
a(:href="'/short/'+journey_id") a(:href="'/short/'+journey_id")
i.fas.fa-file-contract i.fas.fa-file-contract
.col-sm-2 .col-sm-2
a(:href="'/view/'+journey_id +'#0'") a(:href="'/view/'+journey_id")
i.fas.fa-camera i.fas.fa-camera
.col-sm-2 .col-sm-2
a(href='#main' v-on:click.prevent='first_step') a(href='#main' v-on:click.prevent='first_step')

View File

@ -10,5 +10,5 @@ header.header
a(:href="'/short/'+journey_id") a(:href="'/short/'+journey_id")
i.fas.fa-file-contract i.fas.fa-file-contract
.col-sm-3 .col-sm-3
a(:href="'/view/'+journey_id +'#0'") a(:href="'/view/'+journey_id")
i.fas.fa-camera i.fas.fa-camera

View File

@ -1,5 +1,7 @@
- var map_section = 'journey_data.main[journey_step_data.section]' - var map_section = 'journey_data.main[journey_step_data.section]'
.bg-dark.text-white
div(v-for='(e, idx) in journey_data.main' :key='idx')
.bg-dark.text-white(v-if="journey_step_data.section==idx")
.container.section .container.section
.aligner.text-center.text-white.text-huge(style='margin-bottom:5px') .aligner.text-center.text-white.text-huge(style='margin-bottom:5px')
.aligner--itemTop.fleft .aligner--itemTop.fleft