Commit 63d5d98c authored by Matthias Larisch's avatar Matthias Larisch Committed by Matthias Larisch

Load foodsaver page javascript as webpack

This commit also fixes the javascript so XHR requests contain the
correct region id that fixes the foodsaver list / removing people from a
region. Fixes #14.
parent 38f6f541
......@@ -59,6 +59,7 @@ module.exports = {
// We explicitly define each foodsharing modules here so we can convert them one-by-one
'Index',
'Dashboard',
'Foodsaver',
'WorkGroup'
),
mode: dev ? 'development' : 'production',
......
var fsapp = {
init: function () {
if ($('#fslist').length > 0) {
$('#fslist a').click(function (ev) {
ev.preventDefault();
$this = $(this);
fsida = $this.attr('href').split('#');
fsid = parseInt(fsida[(fsida.length - 1)]);
fsapp.loadFoodsaver(fsid);
});
}
},
loadFoodsaver: function (foodsaver_id) {
ajreq('loadFoodsaver', {
app: 'foodsaver',
id: foodsaver_id,
bid: $('#appdata .bid').val()
});
},
refreshfoodsaver: function () {
ajreq('foodsaverrefresh', {
app: 'foodsaver',
bid: $('#appdata .bid').val()
});
},
delfromBezirk: function (foodsaver_id) {
if (confirm('Wirklich aus Bezirk löschen?')) {
ajreq('delfrombezirk', {
app: 'foodsaver',
bid: $('#appdata .bid').val(),
id: foodsaver_id
});
}
import '@/core'
import '@/globals'
import { ajreq, GET } from '@/script'
import $ from 'jquery'
const fsapp = {
init: function () {
if ($('#fslist').length > 0) {
$('#fslist a').click(function (ev) {
ev.preventDefault()
let el = $(this)
let fsida = el.attr('href').split('#')
let fsid = parseInt(fsida[(fsida.length - 1)])
fsapp.loadFoodsaver(fsid)
})
}
};
$(function () {
fsapp.init();
})
\ No newline at end of file
},
loadFoodsaver: function (foodsaverId) {
ajreq('loadFoodsaver', {
app: 'foodsaver',
id: foodsaverId,
bid: GET('bid')
})
},
refreshfoodsaver: function () {
ajreq('foodsaverrefresh', {
app: 'foodsaver',
bid: GET('bid')
})
},
delfromBezirk: function (foodsaverId) {
if (window.confirm('Wirklich aus Bezirk löschen?')) {
ajreq('delfrombezirk', {
app: 'foodsaver',
bid: GET('bid'),
id: foodsaverId
})
}
}
}
fsapp.init()
window.fsapp = fsapp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment