test summernote editor

This commit is contained in:
Arno Kaimbacher 2018-09-11 16:36:19 +02:00
parent a49ddeac9e
commit d777eeeea1
7 changed files with 122 additions and 26 deletions

View File

@ -1 +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=53)}({53:function(t,e,a){t.exports=a(54)},54: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()}}})}});
!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=55)}({55:function(t,e,a){t.exports=a(56)},56: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()}}})}});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
<template>
<div class="custom-actions">
<button class="view" @click="itemAction('view-item', rowData, rowIndex)">
</button>
<a class="edit" @click="itemAction('edit-item', rowData, rowIndex)">
</a>
<a class="delete" @click="itemAction('delete-item', rowData, rowIndex)">
</a>
</div>
</template>
<script>
export default {
props: {
rowData: {
type: Object,
required: true
},
rowIndex: {
type: Number
}
},
methods: {
itemAction(action, data, index) {
console.log("custom-actions: " + action, data.full_name, index);
}
}
};
</script>
<style>
.custom-actions button.ui.button {
padding: 8px 8px;
}
.custom-actions button.ui.button > i.icon {
margin: auto !important;
}
</style>

View File

@ -5,15 +5,23 @@
<vuetable ref="vuetable"
api-url="/api/persons"
v-bind:fields="fields" pagination-path=""
v-bind:css="css.table"
></vuetable>
</template>
<script>
import Vuetable from "vuetable-2/src/components/Vuetable";
import VuetablePagination from 'vuetable-2/src/components/VuetablePagination'
import VuetablePaginationInfo from 'vuetable-2/src/components/VuetablePaginationInfo'
import CustomActions from './CustomActions'
Vue.component('custom-actions', CustomActions)
export default {
components: {
Vuetable
Vuetable,
VuetablePagination,
VuetablePaginationInfo,
},
data() {
return {
@ -36,29 +44,16 @@ export default {
{
name: "__component:custom-actions",
title: "Actions",
titleClass: "text-center",
dataClass: "text-center"
// titleClass: "text-center",
// dataClass: "text-center"
}
],
css: {
table: {
tableClass: "table table-bordered table-striped table-hover",
tableClass: "table pure-table pure-table-horizontal",
ascendingIcon: "glyphicon glyphicon-chevron-up",
descendingIcon: "glyphicon glyphicon-chevron-down"
},
pagination: {
wrapperClass: "pagination",
activeClass: "active",
disabledClass: "disabled",
pageClass: "page",
linkClass: "link",
icons: {
first: "",
prev: "",
next: "",
last: ""
}
},
icons: {
first: "glyphicon glyphicon-step-backward",
prev: "glyphicon glyphicon-chevron-left",
@ -69,6 +64,44 @@ export default {
sortOrder: [{ field: "email", sortField: "email", direction: "asc" }],
moreParams: {}
};
}
}//data end
};
</script>
<style>
.pagination {
margin: 0;
float: right;
}
.pagination a.page {
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 10px;
margin-right: 2px;
}
.pagination a.page.active {
color: white;
background-color: #337ab7;
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 10px;
margin-right: 2px;
}
.pagination a.btn-nav {
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 7px;
margin-right: 2px;
}
.pagination a.btn-nav.disabled {
color: lightgray;
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 7px;
margin-right: 2px;
cursor: not-allowed;
}
.pagination-info {
float: left;
}
</style>

View File

@ -25,3 +25,16 @@
</div>
@stop
@section("after-scripts")
<script type="text/javascript">
// Backend.Pages.init();
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.js"></script>
<script>
$(document).ready(function() {
$('#desc_markup').summernote();
});
</script>
@endsection

View File

@ -95,4 +95,11 @@
<script type="text/javascript">
// Backend.Pages.init();
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.js"></script>
<script>
$(document).ready(function() {
$('#description').summernote();
});
</script>
@endsection

View File

@ -11,10 +11,15 @@
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<link rel='stylesheet' href="{{ asset('css/pure-min.css') }}" />
<link rel='stylesheet' href="{{ asset('css/grids-responsive-min.css') }}" />
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link rel='stylesheet' href="{{ asset('css/font-awesome.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ asset('/backend/style.css') }}">
<link rel="stylesheet" type="text/css" href="{{ asset('/backend/pagination.css') }}">
</head>
<body>
<div id="app">