edit static pages in backend

This commit is contained in:
Arno Kaimbacher 2018-09-06 17:58:54 +02:00
parent e771c4921f
commit 783ac823ba
59 changed files with 1644 additions and 761 deletions

View file

@ -3,9 +3,24 @@
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
Vue.prototype.$http = axios;
// window.axios = require('axios');
// window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
// let token = document.head.querySelector('meta[name="csrf-token"]');
// if (token) {
// window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
// }
// else {
// console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
// }
// window.Vue = require('vue');
// Vue.prototype.$http = axios;
// Vue.component('example', require('./components/Example.vue'));
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
@ -32,6 +47,7 @@ const app = new Vue({
type: '',
state: '',
rights: 0,
project_id: '',
creating_corporation: "GBA",
embargo_date: '',
@ -97,7 +113,7 @@ const app = new Vue({
formData.append('files[' + i + '][file]', file.file);
formData.append('files[' + i + '][label]', file.label);
formData.append('files[' + i + '][sorting]', i + 1);
// formData.append('files[' + i + ']', JSON.stringify(file));
}
/*
@ -107,12 +123,13 @@ const app = new Vue({
formData.append('server_state', this.dataset.state);
formData.append('rights', this.dataset.rights);
formData.append('creating_corporation', this.dataset.creating_corporation);
formData.append('project_id', this.dataset.project_id);
formData.append('embargo_date', this.dataset.embargo_date);
formData.append('belongs_to_bibliography', this.dataset.belongs_to_bibliography);
formData.append('main_title[value]', this.dataset.title_main.value);
formData.append('main_title[language]', this.dataset.title_main.language);
formData.append('abstract_main[value]', this.dataset.title_main.value);
formData.append('abstract_main[language]', this.dataset.title_main.language);
formData.append('title_main[value]', this.dataset.title_main.value);
formData.append('title_main[language]', this.dataset.title_main.language);
formData.append('abstract_main[value]', this.dataset.abstract_main.value);
formData.append('abstract_main[language]', this.dataset.abstract_main.language);
for (var i = 0; i < this.dataset.checkedLicenses.length; i++) {
formData.append('licenses[' + i + ']', this.dataset.checkedLicenses[i]);
@ -135,16 +152,26 @@ const app = new Vue({
// this.items = response.data;
//Vue.set(app.skills, 1, "test55");
this.currentStatus = STATUS_SUCCESS;
if (response.data.redirect) {
window.location = response.data.redirect;
}
})
.catch((error) => {
// this.loading = false;
console.log("test");
// console.log("test");
let errorObject = JSON.parse(JSON.stringify(error));
console.log(errorObject);
var errorsArray = errorObject.response.data.errors;
for (var index in errorsArray) {
console.log(errorsArray[index]);
this.errors.push(errorsArray[index]);
// console.log(errorObject);
if (errorObject.response.data.errors) {
var errorsArray = errorObject.response.data.errors;
for (var index in errorsArray) {
console.log(errorsArray[index]);
this.errors.push(errorsArray[index]);
}
}
if (errorObject.response.data.error) {
var error = errorObject.response.data.error;
this.errors.push(error.message);
}
this.currentStatus = STATUS_FAILED;
});
@ -205,14 +232,3 @@ const app = new Vue({
}
}
});
// const app = new Vue({
// el: '#app',
// data: {
// loading: false,
// downloading: false,
// items: [],
// message: "Just a test",
// }
// });