edit static pages in backend
This commit is contained in:
parent
e771c4921f
commit
783ac823ba
59 changed files with 1644 additions and 761 deletions
1
public/backend/publish/datasetPublish.js
Normal file
1
public/backend/publish/datasetPublish.js
Normal file
|
@ -0,0 +1 @@
|
|||
!function(t){var e={};function a(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=t,a.c=e,a.d=function(t,e,s){a.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/",a(a.s=0)}([function(t,e,a){t.exports=a(1)},function(t,e){new Vue({el:"#app",data:function(){return{rows:[],errors:[],uploadedFiles:[],uploadError:null,currentStatus:null,uploadFieldName:"photos",fileCount:0,step:1,dataset:{type:"",state:"",rights:0,project_id:"",creating_corporation:"GBA",embargo_date:"",belongs_to_bibliography:0,title_main:{value:"",language:""},abstract_main:{value:"",language:""},checkedPersons:[],checkedLicenses:[],files:[]}}},mounted:function(){this.step=1,this.reset()},computed:{isInitial:function(){return 0===this.currentStatus},isSaving:function(){return 1===this.currentStatus},isSuccess:function(){return 2===this.currentStatus},isFailed:function(){return 3===this.currentStatus}},methods:{reset:function(){this.currentStatus=0,this.uploadedFiles=[],this.uploadError=null},resetDropbox:function(){this.currentStatus=0,this.dataset.files=[]},save:function(){var t=this;this.errors=[];for(var e=new FormData,a=0;a<this.dataset.files.length;a++){var s=this.dataset.files[a];e.append("files["+a+"][file]",s.file),e.append("files["+a+"][label]",s.label),e.append("files["+a+"][sorting]",a+1)}e.append("type",this.dataset.type),e.append("server_state",this.dataset.state),e.append("rights",this.dataset.rights),e.append("creating_corporation",this.dataset.creating_corporation),e.append("project_id",this.dataset.project_id),e.append("embargo_date",this.dataset.embargo_date),e.append("belongs_to_bibliography",this.dataset.belongs_to_bibliography),e.append("title_main[value]",this.dataset.title_main.value),e.append("title_main[language]",this.dataset.title_main.language),e.append("abstract_main[value]",this.dataset.abstract_main.value),e.append("abstract_main[language]",this.dataset.abstract_main.language);for(a=0;a<this.dataset.checkedLicenses.length;a++)e.append("licenses["+a+"]",this.dataset.checkedLicenses[a]);axios.post("/publish/dataset/store",e,{headers:{"Content-Type":"multipart/form-data"}}).then(function(e){console.log(e.data),t.currentStatus=2,e.data.redirect&&(window.location=e.data.redirect)}).catch(function(e){var a=JSON.parse(JSON.stringify(e));if(a.response.data.errors){var s=a.response.data.errors;for(var r in s)console.log(s[r]),t.errors.push(s[r])}if(a.response.data.error){e=a.response.data.error;t.errors.push(e.message)}t.currentStatus=3})},filesChange:function(t,e){for(var a=e,s=0;s<a.length;s++){var r=a[s].name.replace(/\.[^/.]+$/,""),n={file:a[s],label:r,sorting:0};this.dataset.files.push(n)}},removeFile:function(t){this.dataset.files.splice(t,1)},prev:function(){this.step--},next:function(){this.step++},submit:function(){this.save()}}})}]);
|
|
@ -449,6 +449,8 @@ Hides the menu at `48em`, but modify this based on your app's needs.
|
|||
left: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* _______________________________my edits ------------------------------------- */
|
||||
.box-l {
|
||||
padding-right: 1em;
|
221
public/js/app.js
221
public/js/app.js
|
@ -1,221 +0,0 @@
|
|||
/**
|
||||
* First we will load all of this project's JavaScript dependencies which
|
||||
* 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;
|
||||
|
||||
// Vue.component('example', require('./components/Example.vue'));
|
||||
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
|
||||
|
||||
const app = new Vue({
|
||||
el: '#app',
|
||||
|
||||
data() {
|
||||
return {
|
||||
rows: [
|
||||
//initial data
|
||||
// { qty: 5, value: "Something", language: 10, type: "additional", sort_order: 0 },
|
||||
// { qty: 2, value: "Something else", language: 20, type: "additional", sort_order: 0 },
|
||||
],
|
||||
errors: [],
|
||||
uploadedFiles: [],
|
||||
uploadError: null,
|
||||
currentStatus: null,
|
||||
uploadFieldName: 'photos',
|
||||
fileCount: 0,
|
||||
|
||||
step: 1,
|
||||
dataset: {
|
||||
type: '',
|
||||
state: '',
|
||||
rights: 0,
|
||||
project_id: '',
|
||||
|
||||
creating_corporation: "GBA",
|
||||
embargo_date: '',
|
||||
belongs_to_bibliography: 0,
|
||||
|
||||
title_main: {
|
||||
value: '',
|
||||
language: ''
|
||||
},
|
||||
abstract_main: {
|
||||
value: '',
|
||||
language: ''
|
||||
},
|
||||
checkedPersons: [],
|
||||
checkedLicenses: [],
|
||||
files: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.step = 1;
|
||||
this.reset();
|
||||
},
|
||||
computed: {
|
||||
isInitial() {
|
||||
return this.currentStatus === STATUS_INITIAL;
|
||||
},
|
||||
isSaving() {
|
||||
return this.currentStatus === STATUS_SAVING;
|
||||
},
|
||||
isSuccess() {
|
||||
return this.currentStatus === STATUS_SUCCESS;
|
||||
},
|
||||
isFailed() {
|
||||
return this.currentStatus === STATUS_FAILED;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
// reset form to initial state
|
||||
this.currentStatus = STATUS_INITIAL;
|
||||
this.uploadedFiles = [];
|
||||
this.uploadError = null;
|
||||
},
|
||||
resetDropbox() {
|
||||
// reset form to initial state
|
||||
this.currentStatus = STATUS_INITIAL;
|
||||
this.dataset.files = [];
|
||||
},
|
||||
save() {
|
||||
this.errors = [];
|
||||
/*
|
||||
Initialize the form data
|
||||
*/
|
||||
let formData = new FormData();
|
||||
/*
|
||||
Iteate over any file sent over appending the files
|
||||
to the form data.
|
||||
*/
|
||||
// formData.append('files', []);
|
||||
for (var i = 0; i < this.dataset.files.length; i++) {
|
||||
let file = this.dataset.files[i];
|
||||
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));
|
||||
}
|
||||
/*
|
||||
Additional POST Data
|
||||
*/
|
||||
formData.append('type', this.dataset.type);
|
||||
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('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]);
|
||||
}
|
||||
|
||||
/*
|
||||
Make the request to the POST /multiple-files URL
|
||||
*/
|
||||
axios.post('/publish/dataset/store',
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then((response) => {
|
||||
// success callback
|
||||
console.log(response.data);
|
||||
// this.loading = false;
|
||||
// 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");
|
||||
let errorObject = JSON.parse(JSON.stringify(error));
|
||||
// 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;
|
||||
});
|
||||
},
|
||||
// filesChange(fieldName, fileList) {
|
||||
// // handle file changes
|
||||
// // const formData = new FormData();
|
||||
// if (!fileList.length) return;
|
||||
// // append the files to FormData
|
||||
// Array
|
||||
// .from(Array(fileList.length).keys())
|
||||
// .map(x => {
|
||||
// dataset.files.append(fieldName, fileList[x], fileList[x].name);
|
||||
// });
|
||||
// // save it
|
||||
// // this.save(formData);
|
||||
|
||||
// },
|
||||
/*
|
||||
Handles a change on the file upload
|
||||
*/
|
||||
filesChange(fieldName, fileList) {
|
||||
// this.dataset.files = this.$refs.files.files;
|
||||
let uploadedFiles = fileList;
|
||||
|
||||
/*
|
||||
Adds the uploaded file to the files array
|
||||
*/
|
||||
for (var i = 0; i < uploadedFiles.length; i++) {
|
||||
let fileName = uploadedFiles[i].name.replace(/\.[^/.]+$/, '');
|
||||
let uploadeFile = { file: uploadedFiles[i], label: fileName, sorting: 0 };
|
||||
//this.dataset.files.push(uploadedFiles[i]);
|
||||
this.dataset.files.push(uploadeFile);
|
||||
}
|
||||
// if (this.dataset.files.length > 0)
|
||||
// {
|
||||
// this.currentStatus = STATUS_SAVING;
|
||||
// }
|
||||
|
||||
},
|
||||
/*
|
||||
Removes a select file the user has uploaded
|
||||
*/
|
||||
removeFile(key) {
|
||||
this.dataset.files.splice(key, 1);
|
||||
},
|
||||
|
||||
prev() {
|
||||
this.step--;
|
||||
},
|
||||
next() {
|
||||
this.step++;
|
||||
},
|
||||
submit() {
|
||||
// alert('Submit to blah and show blah and etc.');
|
||||
// save it
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
});
|
7
public/js/bootstrap.min.js
vendored
7
public/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
5
public/js/dataTable.js
Normal file
5
public/js/dataTable.js
Normal file
File diff suppressed because one or more lines are too long
4
public/js/jquery-2.1.1.min.js
vendored
4
public/js/jquery-2.1.1.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
|||
{
|
||||
"/js/app.js": "/js/app.js"
|
||||
"/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js",
|
||||
"/js/dataTable.js": "/js/dataTable.js"
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue