publish datasets with authors

This commit is contained in:
Arno Kaimbacher 2018-10-18 16:51:46 +02:00
parent ccff83fa66
commit fde8f76b7c
19 changed files with 451 additions and 324 deletions

View File

@ -26,7 +26,11 @@ class IndexController extends Controller
*/
public function index()
{
//
$builder = Dataset::query();
$datasets = $builder
->where('server_state', 'inprogress')
->get();
return view('publish.index', compact('datasets'));
}
/**
@ -43,11 +47,11 @@ class IndexController extends Controller
->pluck('part2_t', 'part2_t');
// ->toArray();
$persons = Person::where('status', 1)
->pluck('last_name', 'id');
// $persons = Person::where('status', 1)
// ->pluck('last_name', 'id');
$projects = Project::pluck('label', 'id');
return view('publish.create-step1', compact('licenses', 'languages', 'persons', 'projects'));
return view('publish.create-step1', compact('licenses', 'languages', 'projects'));
}
/**
@ -274,6 +278,15 @@ class IndexController extends Controller
$licenses = $request->input('licenses');
$dataset->licenses()->sync($licenses);
//store authors
$data_to_sync = [];
foreach ($request->get('authors') as $key => $person_id) {
$pivot_data = ['role' => 'author', 'sort_order' => $key + 1];
// if ($galery_id == $request->get('mainPicture')) $pivot_data = ['main' => 1];
$data_to_sync[$person_id] = $pivot_data;
}
$dataset->persons()->sync($data_to_sync);
//save main title:
if (isset($data['title_main'])) {
$formTitle = $request->input('title_main');

View File

@ -58,8 +58,8 @@ class RoleController extends Controller
}
return redirect()
->route('access.role.index')
->with('success', 'Role has been created successfully');
->route('access.role.index')
->with('success', 'Role has been created successfully');
}
/**

View File

@ -26,8 +26,8 @@ class UserController extends Controller
//}
$users = User::with('roles')
->orderBy('id', 'DESC')
->paginate(5);
->orderBy('id', 'DESC')
->paginate(5);
return view('settings.access.user.user', compact('users'))
->with('i', ($request->input('page', 1) - 1) * 5);
}

View File

@ -11,7 +11,6 @@ use Illuminate\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Models\File;
class DatasetController extends Controller
{

View File

@ -73,8 +73,9 @@ class Dataset extends Model
//return all persons attached to this film
public function persons()
{
return $this->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
->withPivot('role');
return $this
->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
->withPivot('role', 'sort_order', 'allow_email_contact');
}
/**

54
composer.lock generated
View File

@ -544,33 +544,34 @@
},
{
"name": "jakub-onderka/php-console-highlighter",
"version": "v0.3.2",
"version": "v0.4",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git",
"reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5"
"reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5",
"reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/9f7a229a69d52506914b4bc61bfdb199d90c5547",
"reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547",
"shasum": ""
},
"require": {
"jakub-onderka/php-console-color": "~0.1",
"php": ">=5.3.0"
"ext-tokenizer": "*",
"jakub-onderka/php-console-color": "~0.2",
"php": ">=5.4.0"
},
"require-dev": {
"jakub-onderka/php-code-style": "~1.0",
"jakub-onderka/php-parallel-lint": "~0.5",
"jakub-onderka/php-parallel-lint": "~1.0",
"jakub-onderka/php-var-dump-check": "~0.1",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~1.5"
},
"type": "library",
"autoload": {
"psr-0": {
"JakubOnderka\\PhpConsoleHighlighter": "src/"
"psr-4": {
"JakubOnderka\\PhpConsoleHighlighter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -584,7 +585,8 @@
"homepage": "http://www.acci.cz/"
}
],
"time": "2015-04-20T18:58:01+00:00"
"description": "Highlight PHP code in terminal",
"time": "2018-09-29T18:48:56+00:00"
},
{
"name": "laravel/framework",
@ -722,16 +724,16 @@
},
{
"name": "laravel/tinker",
"version": "v1.0.7",
"version": "v1.0.8",
"source": {
"type": "git",
"url": "https://github.com/laravel/tinker.git",
"reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d"
"reference": "cafbf598a90acde68985660e79b2b03c5609a405"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/e3086ee8cb1f54a39ae8dcb72d1c37d10128997d",
"reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d",
"url": "https://api.github.com/repos/laravel/tinker/zipball/cafbf598a90acde68985660e79b2b03c5609a405",
"reference": "cafbf598a90acde68985660e79b2b03c5609a405",
"shasum": ""
},
"require": {
@ -781,7 +783,7 @@
"laravel",
"psysh"
],
"time": "2018-05-17T13:42:07+00:00"
"time": "2018-10-12T19:39:35+00:00"
},
{
"name": "laravelcollective/html",
@ -853,16 +855,16 @@
},
{
"name": "league/flysystem",
"version": "1.0.47",
"version": "1.0.48",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c"
"reference": "a6ded5b2f6055e2db97b4b859fdfca2b952b78aa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a11e4a75f256bdacf99d20780ce42d3b8272975c",
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a6ded5b2f6055e2db97b4b859fdfca2b952b78aa",
"reference": "a6ded5b2f6055e2db97b4b859fdfca2b952b78aa",
"shasum": ""
},
"require": {
@ -933,7 +935,7 @@
"sftp",
"storage"
],
"time": "2018-09-14T15:30:29+00:00"
"time": "2018-10-15T13:53:10+00:00"
},
{
"name": "monolog/monolog",
@ -1354,23 +1356,23 @@
},
{
"name": "psy/psysh",
"version": "v0.9.8",
"version": "v0.9.9",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555"
"reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/ed3c32c4304e1a678a6e0f9dc11dd2d927d89555",
"reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/9aaf29575bb8293206bb0420c1e1c87ff2ffa94e",
"reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e",
"shasum": ""
},
"require": {
"dnoegel/php-xdg-base-dir": "0.1",
"ext-json": "*",
"ext-tokenizer": "*",
"jakub-onderka/php-console-highlighter": "0.3.*",
"jakub-onderka/php-console-highlighter": "0.3.*|0.4.*",
"nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"php": ">=5.4.0",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
@ -1424,7 +1426,7 @@
"interactive",
"shell"
],
"time": "2018-09-05T11:40:09+00:00"
"time": "2018-10-13T15:16:03+00:00"
},
{
"name": "ramsey/uuid",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
{
"/js/app.js": "/js/app.js",
"/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js",
"/js/lib.js": "/js/lib.js",
"/js/dataTable.js": "/js/dataTable.js"
}

View File

@ -2,17 +2,20 @@
https://alligator.io/vuejs/vue-autocomplete-component/ -->
<template>
<div style="position:relative">
<input type="search" @input="searchChanged" v-model="search" v-bind:disabled="isLoading == true" v-bind:title="title" v-bind:placeholder="title" class="pure-u-23-24">
<input type="search" @input="searchChanged" v-model="search" v-bind:disabled="isLoading == true" v-bind:title="title" v-bind:placeholder="title"
class="pure-u-23-24" v-on:keydown.down="onArrowDown" v-on:keydown.up="onArrowUp" v-on:keydown.enter="onEnter">
<!-- <ul class="autocomplete-results" v-show="results.length > 0"> -->
<ul class="autocomplete-results pure-u-23-24" v-show="isOpen">
<li class="loading" v-if="isLoading" >Loading results...</li>
<li
v-else
v-for="suggestion in results"
:key="suggestion.id"
v-for="(suggestion, i) in results"
:key="i"
@click="setResult(suggestion)"
class="autocomplete-result">
class="autocomplete-result"
:class="{ 'is-active': i === arrowCounter }"
>
<strong>{{ suggestion.full_name }}</strong>
</li>
</ul>
@ -20,6 +23,9 @@ https://alligator.io/vuejs/vue-autocomplete-component/ -->
</template>
<script>
import _ from 'lodash';
import axios from 'axios';
export default {
//data from parent component
props: {
@ -42,7 +48,8 @@ export default {
isOpen: false,
isLoading: false,
isAsync: true,
items: []
items: [],
arrowCounter: -1
};
},
@ -74,7 +81,7 @@ export default {
methods: {
setResult(person) {
// this.search = person.full_name;
this.reset();
this.reset();
this.$emit("person", person);
},
reset() {
@ -98,15 +105,14 @@ export default {
});
this.isOpen = true;
}
}
else{
} else {
this.items = [];
}
},
filterResults() {
filterResults: _.debounce(function() {
var self = this;
axios
.get("/api/persons", { params: { filter: this.search } })
.get("/api/persons", { params: { filter: this.search.toLowerCase() } })
.then(function(response) {
return (self.items = response.data.data);
})
@ -116,13 +122,32 @@ export default {
// this.results = this.items.filter(item => {
// return item.toLowerCase().indexOf(this.search.toLowerCase()) > -1;
// });
}, 300),
onArrowDown() {
if (this.arrowCounter < this.results.length - 1) {
this.arrowCounter = this.arrowCounter + 1;
}
},
onArrowUp() {
if (this.arrowCounter > 0) {
this.arrowCounter = this.arrowCounter - 1;
}
},
onEnter() {
if(Array.isArray(this.results) && this.results.length && this.arrowCounter !== -1 && this.arrowCounter < this.results.length){
//this.search = this.results[this.arrowCounter];
var person = this.results[this.arrowCounter];
this.$emit("person", person);
//this.isOpen = false;
this.reset();
this.arrowCounter = -1;
}
}
},
computed: {
// isOpen() {
// return this.results.length > 0;
// }
}
};
</script>
@ -143,6 +168,7 @@ export default {
cursor: pointer;
}
.autocomplete-result.is-active,
.autocomplete-result:hover {
background-color: #4aae9b;
color: white;

View File

@ -19,18 +19,18 @@
// else {
// console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
// }
window._ = require('lodash');
// window._ = require('lodash');
// window.Vue = require('vue');
// Vue.prototype.$http = axios;
// import Vue from 'vue';
import Vue from 'vue';
// Vue.component('example', require('./components/Example.vue'));
//Vue.component('my-autocomplete', require('./components/MyAutocomplete.vue'));
import MyAutocomplete from './components/MyAutocomplete.vue';
import VeeValidate from 'vee-validate';
// import { Validator } from 'vee-validate';
Vue.use(VeeValidate);
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
@ -55,7 +55,7 @@ const app = new Vue({
step: 1,
dataset: {
type: '',
state: '',
state: 'inprogress',
rights: null,
project_id: '',
@ -71,7 +71,7 @@ const app = new Vue({
value: '',
language: ''
},
checkedPersons: [],
checkedAuthors: [],
checkedLicenses: [],// [],
files: []
}
@ -160,6 +160,10 @@ const app = new Vue({
formData.append('licenses[' + i + ']', this.dataset.checkedLicenses[i]);
}
for (var i = 0; i < this.dataset.checkedAuthors.length; i++) {
formData.append('authors[' + i + ']', this.dataset.checkedAuthors[i]);
}
/*
Make the request to the POST /multiple-files URL
*/
@ -238,7 +242,12 @@ const app = new Vue({
},
onAddAuthor(person) {
this.persons.push(person);
//if person is not in person array
//if (this.persons.includes(person) == false) {
if (this.persons.filter(e => e.id === person.id).length == 0) {
this.persons.push(person);
this.dataset.checkedAuthors.push(person.id);
}
},
/*
Removes a select file the user has uploaded

View File

@ -3,11 +3,14 @@
* 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');
import Vue from 'vue';
// require('./bootstrap');
Vue.prototype.$http = axios;
window.$ = window.jQuery = require('jquery');
// window.Vue = require('vue');
// import Vue from 'vue';
// Vue.prototype.$http = axios;
// Vue.component('example', require('./components/Example.vue'));

View File

@ -1,6 +1,6 @@
@extends('settings.layouts.app')
@section('title', 'Publish')
@section('title', 'Publish')
@section('content')
<div class="header">
@ -10,322 +10,325 @@
</div>
<div id="app" class="box-content">
{{-- <form action={{ route( 'publish.dataset.store1') }} method="post" class="pure-form" enctype="multipart/form-data"> --}}
<main class="steps pure-form" enctype="multipart/form-data">
{{ csrf_field() }}
{{--
<form action={{ route( 'publish.dataset.store1') }} method="post" class="pure-form" enctype="multipart/form-data">
--}}
<main class="steps pure-form" enctype="multipart/form-data">
{{ csrf_field() }}
<form v-if="step === 1" data-vv-scope="step-1">
<h1>Step One</h1>
<div class="form-group">
<legend>Datensatztyp</legend>
<div class="description hint">
<p>Bitte wählen Sie einen Datensatztyp aus der Liste aus.</p>
</div>
<p></p>
<div class="form-item">
<label for="documentType">Datensatztyp<span class="required" title="Dieses Feld muss ausgefüllt werden."> *</span></label>
<div class="select" style="width:300px" title="Bitte wählen Sie einen Datensatztyp aus der Liste aus.">
{!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --',
'v-model' => 'dataset.type', "v-validate" => "'required'"]) !!}
<div v-if="step === 1" data-vv-scope="step-1">
<h1>Step One</h1>
<div class="form-group">
<legend>Datensatztyp</legend>
<div class="description hint">
<p>Bitte wählen Sie einen Datensatztyp aus der Liste aus.</p>
</div>
<p></p>
<div class="form-item">
<label for="documentType">Datensatztyp<span class="required" title="Dieses Feld muss ausgefüllt werden."> *</span></label>
<div class="select" style="width:300px" title="Bitte wählen Sie einen Datensatztyp aus der Liste aus.">
{!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'dataset.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
</div>
</div>
</div>
</div>
<div :class="{'form-group':true, 'has-error':errors.has('rights')}">
<legend>Einräumung eines einfachen Nutzungsrechts</legend>
{{-- <div class="pure-u-1 pure-u-md-1-2 pure-div"> --}}
<p>
I accept
<a target="_blank" href="{{ route("frontend.pages.show", ['page_slug'=>'terms-and-conditions']) }}">
<div :class="{'form-group':true, 'has-error':errors.has('rights')}">
<legend>Einräumung eines einfachen Nutzungsrechts</legend>
{{-- <div class="pure-u-1 pure-u-md-1-2 pure-div"> --}}
<p>
I accept
<a target="_blank" href="{{ route("frontend.pages.show", ['page_slug'=>'terms-and-conditions']) }}">
{!! trans('validation.attributes.backend.create-dataset.terms_and_conditions').'*' !!}
</a>
</p>
<small for="rights" class="pure-form-message-inline">Ich habe diese rechtlichen Hinweise gelesen und bin damit einverstanden.
</a>
</p>
<small for="rights" class="pure-form-message-inline">Ich habe diese rechtlichen Hinweise gelesen und bin damit einverstanden.
<span class="required" title="Dieses Feld muss ausgefüllt werden.">*</span>
</small> {{-- <input name="rights" value="0" type="hidden"> --}}
<label>
<input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" v-validate="'required'">
<label>
<input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" v-validate="'required'" data-vv-scope="step-1">
<br />
<i v-show="errors.has('step-1.rights')" class="fa fa-warning"></i>
<span v-show="errors.has('step-1.rights')" class="text-danger">@{{ errors.first('step-1.rights') }}</span>
</label>
<span class="help-block">You must agree to continue</span>
{{-- </div> --}}
</div>
<span class="help-block">You must agree to continue</span> {{-- </div> --}}
</div>
<br />
<div class="pure-controls">
<button @click.prevent="next('step-1')" class="pure-button button-small" :disabled="errors.any()">
<br />
<div class="pure-controls">
<button @click.prevent="next('step-1')" class="pure-button button-small" :disabled="errors.any()">
<i class="fa fa-arrow-right"></i>
<span>Continue</span>
</button>
</div>
<div v-if="errors.items.length > 0">
<b>Please correct the following error(s):</b>
<ul class="alert validation-summary-errors">
<li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li>
</ul>
</div>
</div>
<div v-if="errors.items.length > 0">
<b>Please correct the following error(s):</b>
<ul class="alert validation-summary-errors">
<li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li>
</ul>
</div>
</form>
<form v-if="step === 2" data-vv-scope="step-2">
<h1>Step Two</h1>
<fieldset id="fieldset-general">
<legend>General</legend>
<div class="pure-g">
<div v-if="step === 2" data-vv-scope="step-2">
<h1>Step Two</h1>
<fieldset id="fieldset-general">
<legend>General</legend>
<div class="pure-g">
{{--
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Person', 'Person..') !!}
<div class="select pure-u-23-24">
{!! Form::select('Person', $persons, null, ['id' => 'type', 'placeholder' => '-- select person --']) !!}
{{--
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Person', 'Person..') !!}
<div class="select pure-u-23-24">
{!! Form::select('Person', $persons, null, ['id' => 'type', 'placeholder' => '-- select person --']) !!}
</div>
</div> --}}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Type', 'Type..') !!}
<div class="select pure-u-23-24">
{!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'dataset.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</div>
</div>
</div> --}}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Type', 'Type..') !!}
<div class="select pure-u-23-24">
{!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --',
'v-model' => 'dataset.type', "v-validate" => "'required'"]) !!}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('State', 'State..') !!}
{{ Form::text('State', null, ['class' => 'pure-u-23-24', 'placeholder' => trans('validation.attributes.backend.pages.title'),
'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2', 'readonly' => 'true']) }}
{{-- <div class="select pure-u-23-24">
{!! Form::select( 'State', array_except(Config::get('enums.server_states'),['published', 'deleted', 'temporary']), '',
['placeholder' => '-- select server state --', 'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2'] ) !!}
</div> --}}
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('State', 'State..') !!}
<div class="select pure-u-23-24">
{!! Form::select( 'State', array_except(Config::get('enums.server_states'),['published', 'deleted', 'temporary']), '',
['placeholder' => '-- select server state --', 'v-model' => 'dataset.state', "v-validate" => "'required'"] ) !!}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('CreatingCorporation', 'Creating Corporation') !!}
{!! Form::text('CreatingCorporation', null, ['class' =>
'pure-u-23-24', 'v-model' => 'dataset.creating_corporation', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('CreatingCorporation', 'Creating Corporation') !!} {!! Form::text('CreatingCorporation', null, ['class' =>
'pure-u-23-24', 'v-model' => 'dataset.creating_corporation', "v-validate" => "'required'"]) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('project_id', 'Project..') !!}
<div class="select pure-u-23-24">
{!! Form::select('project_id', $projects, null, ['id' => 'project_id', 'placeholder' => '--no project--', 'v-model' => 'dataset.project_id'])
!!}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('project_id', 'Project..') !!}
<div class="select pure-u-23-24">
{!! Form::select('project_id', $projects, null, ['id' => 'project_id', 'placeholder' => '--no project--', 'v-model' => 'dataset.project_id', 'data-vv-scope' => 'step-2'])
!!}
</div>
<small id="projectHelp" class="pure-form-message-inline">project is optional</small>
</div>
<small id="projectHelp" class="pure-form-message-inline">project is optional</small>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('EmbargoDate', 'Embargo Date') !!} {!! Form::date('EmbargoDate', null, ['placeholder' => date('y-m-d'), 'class'
=> 'pure-u-23-24', 'v-model' => 'dataset.embargo_date']) !!}
<small id="projectHelp" class="pure-form-message-inline">EmbargoDate is optional</small>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('EmbargoDate', 'Embargo Date') !!}
{!! Form::date('EmbargoDate', null, ['placeholder' => date('y-m-d'), 'class'
=> 'pure-u-23-24', 'v-model' => 'dataset.embargo_date', 'data-vv-scope' => 'step-2']) !!}
<small id="projectHelp" class="pure-form-message-inline">EmbargoDate is optional</small>
</div>
<div class="pure-u-1 pure-u-md-1 checkboxlist">
<!-- checkboxes -->
<label for="BelongsToBibliography" class="pure-checkbox">
<div class="pure-u-1 pure-u-md-1 checkboxlist">
<!-- checkboxes -->
<label for="BelongsToBibliography" class="pure-checkbox">
{{-- <input type="hidden" name="BelongsToBibliography" value="0"> --}}
<input name="BelongsToBibliography" v-model="dataset.belongs_to_bibliography" true-value="1"
<input name="BelongsToBibliography" v-model="dataset.belongs_to_bibliography" data-vv-scope="step-2" true-value="1"
false-value="0" type="checkbox" class="form-check-input">
Belongs To Bibliography?
</label>
</div>
</div>
</div>
</fieldset>
<fieldset id="fieldset-titles">
<legend>Main Title & Abstract</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleMain', 'Main Title ') !!}
{!! Form::text('TitleMain[Value]', null, ['class' => 'pure-u-23-24', 'v-model'
=> 'dataset.title_main.value', "v-validate" => "'required|min:3'", "data-vv-as" => "Main Title"]) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleLanguage', 'Title Language..') !!}
<div class="select pure-u-23-24">
{!! Form::select('TitleMain[Language]', $languages, null,
['placeholder' => '--no language--', 'v-model' => 'dataset.title_main.language', "v-validate" => "'required'", "data-vv-as" => "Title Language"]) !!}
</fieldset>
<fieldset id="fieldset-titles">
<legend>Main Title & Abstract</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleMain', 'Main Title ') !!}
{!! Form::text('TitleMain[Value]', null, ['class' => 'pure-u-23-24', 'v-model'
=> 'dataset.title_main.value', "v-validate" => "'required|min:3'", "data-vv-as" => "Main Title", 'data-vv-scope' => 'step-2']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleLanguage', 'Title Language..') !!}
<div class="select pure-u-23-24">
{!! Form::select('TitleMain[Language]', $languages, null, ['placeholder' => '--no language--', 'v-model' => 'dataset.title_main.language',
"v-validate" => "'required'", "data-vv-as" => "Title Language", 'data-vv-scope' => 'step-2']) !!}
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleAbstract', 'Main Abstract ') !!}
{{ Form::textarea('TitleAbstract[Value]', null, ['class' => 'pure-u-23-24',
'size' => '70x6', 'v-model' => 'dataset.abstract_main.value', "v-validate" => "'required|min:3'",
"data-vv-as" => "Main Abstract", 'data-vv-scope' => 'step-2']) }}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('AbstractLanguage', 'Abstract Language..') !!}
<div class="select pure-u-23-24">
{!! Form::select('TitleAbstract[Language]', $languages, null, ['placeholder' => '--no language--', 'v-model' => 'dataset.abstract_main.language',
"v-validate" => "'required'", "data-vv-as" => "Abstract Language", 'data-vv-scope' => 'step-2']) !!}
</div>
</div>
</div>
</fieldset>
<fieldset id="fieldset-licenses">
<legend>Licenses</legend>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleAbstract', 'Main Abstract ') !!}
{{ Form::textarea('TitleAbstract[Value]', null, ['class' => 'pure-u-23-24',
'size' => '70x6', 'v-model' => 'dataset.abstract_main.value', "v-validate" => "'required|min:3'", "data-vv-as" => "Main Abstract"]) }}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('AbstractLanguage', 'Abstract Language..') !!}
<div class="select pure-u-23-24">
{!! Form::select('TitleAbstract[Language]', $languages, null,
['placeholder' => '--no language--', 'v-model' => 'dataset.abstract_main.language', "v-validate" => "'required'", "data-vv-as" => "Abstract Language"]) !!}
</div>
</div>
</div>
</fieldset>
<fieldset id="fieldset-licenses">
<legend>Licenses</legend>
<div class="pure-control-group checkboxlist">
@foreach ($licenses as $indexKey => $license)
<label for={{ "license". $license->id }} class="pure-checkbox">
<div class="pure-control-group checkboxlist">
@foreach ($licenses as $indexKey => $license)
<label for={{ "license". $license->id }} class="pure-checkbox">
@if ($loop->first)
<input name="licenses" value={{ $license->id }} v-model="dataset.checkedLicenses" type="radio" class="form-check-input" v-validate="'required'" data-vv-as="Licence" >
<input name="licenses" value={{ $license->id }} v-model="dataset.checkedLicenses" type="radio" class="form-check-input" v-validate="'required'"
data-vv-as="Licence" data-vv-scope="step-2">
{{ $license->name_long }}
@else
<input name="licenses" value={{ $license->id }} v-model="dataset.checkedLicenses" type="radio" class="form-check-input" >
<input name="licenses" value={{ $license->id }} v-model="dataset.checkedLicenses" type="radio" class="form-check-input" data-vv-scope="step-2">
{{ $license->name_long }}
@endif
</label>
</label>
@endforeach
<br>
<span>Checked license: @{{ dataset.checkedLicenses }}</span>
</div>
</fieldset>
<br>
<span>Checked license: @{{ dataset.checkedLicenses }}</span>
</div>
</fieldset>
<br />
<div class="pure-controls">
<button @click.prevent="prev()" class="pure-button button-small">
<br />
<div class="pure-controls">
<button @click.prevent="prev()" class="pure-button button-small">
<i class="fa fa-arrow-left"></i>
<span>Back</span>
</button>
<button @click.prevent="next('step-2')" class="pure-button button-small" v-bind:disabled="errors.any()">
<button @click.prevent="next('step-2')" class="pure-button button-small" v-bind:disabled="errors.any()">
<i class="fa fa-arrow-right"></i>
<span>Continue</span>
</button>
</div>
<div v-if="errors.items.length > 0">
<b>Please correct the following error(s):</b>
<ul class="alert validation-summary-errors">
<li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li>
</ul>
</div>
</div>
<div v-if="errors.items.length > 0">
<b>Please correct the following error(s):</b>
<ul class="alert validation-summary-errors">
<li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li>
</ul>
</div>
</form>
<form v-if="step === 3" data-vv-scope="step-3">
<h1>Select authors, contributors</h1>
<fieldset id="fieldset-general">
<legend>Authors</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<my-autocomplete title="searching active person table" @person="onAddAuthor"></my-autocomplete>
{{--
<my-autocomplete :items="[ 'Apple', 'Banana', 'Orange', 'Mango', 'Pear', 'Peach', 'Grape', 'Tangerine', 'Pineapple']"></my-autocomplete> --}}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<div v-if="step === 3" data-vv-scope="step-3">
<h1>Select authors, contributors</h1>
<fieldset id="fieldset-general">
<legend>Authors</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<my-autocomplete title="searching active person table" @person="onAddAuthor"></my-autocomplete>
{{--
<my-autocomplete :items="[ 'Apple', 'Banana', 'Orange', 'Mango', 'Pear', 'Peach', 'Grape', 'Tangerine', 'Pineapple']"></my-autocomplete> --}}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<div class="pure-control-group checkboxlist">
<label v-for="(person, index) in persons" :for="person.id" class="pure-checkbox">
<input type="checkbox" name="persons[]" :value="person.id" class="form-check-input">
@{{ person.full_name }}
{{-- {!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'person.type']) !!} --}}
<label v-for="(person, index) in persons" :for="person.id" class="pure-checkbox">
<input type="checkbox" name="persons" v-bind:value="person.id" v-model="dataset.checkedAuthors" class="form-check-input" data-vv-scope="step-3">
@{{ person.full_name }}
</label>
<br />
<span>Checked Authors: @{{ dataset.checkedAuthors }}</span>
</div>
{{-- <span v-for="(person, index) in persons">
<strong>@{{ person.full_name }}</strong>
</span> --}}
<small id="authorHelp" class="pure-form-message-inline">Authoren werden noch nicht abgespeichert - nur für Demo</small>
<strong>@{{ person.full_name }}</strong>
</span> --}}
</div>
</div>
</fieldset>
<fieldset id="fieldset-general">
<legend>Contributors</legend>
<small id="contributorHelp" class="pure-form-message-inline">will come soon...</small>
</fieldset>
<fieldset id="fieldset-general">
<legend>Submitters</legend>
<small id="submitterHelp" class="pure-form-message-inline">will come soon...</small>
</fieldset>
<br />
<div class="pure-controls">
<button @click.prevent="prev()" class="pure-button button-small">
</div>
</fieldset>
<fieldset id="fieldset-general">
<legend>Contributors</legend>
<small id="contributorHelp" class="pure-form-message-inline">will come soon...</small>
</fieldset>
<fieldset id="fieldset-general">
<legend>Submitters</legend>
<small id="submitterHelp" class="pure-form-message-inline">will come soon...</small>
</fieldset>
<br />
<div class="pure-controls">
<button @click.prevent="prev()" class="pure-button button-small">
<i class="fa fa-arrow-left"></i>
<span>Back</span>
</button>
<button @click.prevent="next('step-3')" class="pure-button button-small">
<button @click.prevent="next('step-3')" class="pure-button button-small">
<i class="fa fa-arrow-right"></i>
<span>Review Dataset</span>
</button>
</div>
</div>
</form>
<form v-if="step === 4" data-vv-scope="step-4">
<h1>File Upload</h1>
<div v-if="step === 4" data-vv-scope="step-4">
<h1>File Upload</h1>
<div class="dropbox">
<input type="file" multiple name="files" v-bind:disabled="isSaving" @change="filesChange($event.target.name, $event.target.files)"
class="input-file" data-vv-scope="step-4">
<p v-if="isInitial">
Drag your file(s) here to begin<br> or click to browse
</p>
<p v-if="isSaving">
Uploading @{{ fileCount }} files...
</p>
</div>
{{-- <button @click.prevent="resetDropbox()" v-bind:disabled="isInitial" class="pure-button is-warning">Reset Dropbox</button> --}} {{--
<ul class="list-unstyled">
<li v-for="(item, index) in dataset.files">
@{{ item.name }} <i class="fa fa-remove"></i><span class="remove-file" v-on:click="removeFile(index)"> Remove</span>
</li>
</ul> --}}
<table class="table table-hover">
<thead>
<tr>
<th style="width: 20px;">Sorting</th>
<th>File</th>
<th>Label</th>
<th style="width: 130px;"></th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in dataset.files">
<td>
@{{ index +1 }}
</td>
<td>
<input class="form-control" v-model="item.file.name" />
</td>
<td>
<input class="form-control" v-model="item.label" />
</td>
<td>
<button class="pure-button button-small is-warning" @click.prevent="removeFile(index)">Remove</button>
</td>
</tr>
</tbody>
</table>
<button @click.prevent="prev()" class="pure-button button-small">
<i class="fa fa-arrow-left"></i>
<span>Zurück</span>
</button>
<button @click.prevent="submit()" class="pure-button button-small">
<i class="fa fa-save"></i>
<span>Create Dataset</span>
</button>
<div class="dropbox">
<input type="file" multiple name="files" :disabled="isSaving" @change="filesChange($event.target.name, $event.target.files)"
class="input-file">
<p v-if="isInitial">
Drag your file(s) here to begin<br> or click to browse
</p>
<p v-if="isSaving">
Uploading @{{ fileCount }} files...
</p>
</div>
{{-- <button @click.prevent="resetDropbox()" v-bind:disabled="isInitial" class="pure-button is-warning">Reset Dropbox</button> --}} {{--
<ul class="list-unstyled">
<li v-for="(item, index) in dataset.files">
@{{ item.name }} <i class="fa fa-remove"></i><span class="remove-file" v-on:click="removeFile(index)"> Remove</span>
</li>
</ul> --}}
<table class="table table-hover">
<thead>
<tr>
<th style="width: 20px;">Sorting</th>
<th>File</th>
<th>Label</th>
<th style="width: 130px;"></th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in dataset.files">
<td>
@{{ index +1 }}
</td>
<td>
<input class="form-control" v-model="item.file.name" />
</td>
<td>
<input class="form-control" v-model="item.label" />
</td>
<td>
<button class="pure-button button-small is-warning" @click.prevent="removeFile(index)">Remove</button>
</td>
</tr>
</tbody>
</table>
<button @click.prevent="prev()" class="pure-button button-small">
<i class="fa fa-arrow-left"></i>
<span>Zurück</span>
</button>
<button @click.prevent="submit()" class="pure-button button-small">
<i class="fa fa-save"></i>
<span>Create Dataset</span>
</button>
</form>
<div v-if="serrors.length > 0">
<b>Please correct the following server error(s):</b>
<ul class="alert validation-summary-errors">
<li style="margin-left:5px;" v-for="error in serrors">@{{ error }}</li>
</ul>
</div>
<div v-if="serrors.length > 0">
<b>Please correct the following server error(s):</b>
<ul class="alert validation-summary-errors">
<li style="margin-left:5px;" v-for="error in serrors">@{{ error }}</li>
</ul>
</div>
</main>
{{-- <br/><br/>Debug:@{{ dataset }} --}}
</main>
{{-- <br/><br/>Debug:@{{ dataset }} --}}
</div>
@stop
@section('styles')
@section('styles')
<style type="text/css">
/* main.steps article {
display:block;
} */
@ -336,13 +339,12 @@
}
.has-error .help-block {
display:block;
display: block;
}
</style>
@stop
@stop
@section('after-scripts') {{--
<script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}} {{--
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
@ -350,4 +352,6 @@
<script type="text/javascript" src="{{ resource_path('assets\js\datasetPublish.js') }}"></script> --}}
<script type="text/javascript" src="{{ asset('backend/publish/datasetPublish.js') }}"></script>
@stop

View File

@ -0,0 +1,55 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-file"></i> Datasets to be processed
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1">
<table class="pure-table pure-table-horizontal">
<thead>
<th>Dataset Title</th>
<th>ID</th>
<th>Server State</th>
</thead>
<tbody>
@foreach($datasets as $dataset)
<tr>
<td>
@if ($dataset->titles()->first())
{{ $dataset->titles()->first()->value }}
@else
no title
@endif
</td>
<td>
{{ $dataset->id }}
</td>
<td>
{{ $dataset->server_state }}
</td>
<td>
{{-- <a class="edit" href="{{ route('settings.document.edit', $dataset->id) }}">
<span>publish</span>
</a> --}}
<a href="" class="pure-button button-small">Publish</a>
<a href="" class="pure-button button-small">Restrict</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop

View File

@ -69,30 +69,35 @@
<li class="pure-menu-item {{ Route::is('settings.project*') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ route('settings.project') }}"><i class="fa fa-tasks"></i> Projects</a>
</li>
@permission('page')
<li class="{{ active_class(Active::checkUriPattern('settings/page*')) }}">
<a class="pure-menu-link" href="{{ route('settings.page.index') }}">
<i class="fa fa-file-text"></i>
<span>{{ trans('labels.backend.pages.title') }}</span>
</a>
</li>
@endpermission
</ul>
</li>
@endpermission
@permission('review')
<li class="{{ active_class(Active::checkUriPattern('publish/dataset/*')) }}">
<li class="treeview">
<h2 class="pure-menu-heading">Publish</h2>
<ul class="pure-menu-list">
<li class="pure-menu-item {{ Route::is('publish.dataset.*') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.dataset.create') }}"><i class="fa fa-upload"></i> Publish</a>
</li>
<li class="pure-menu-item {{ Route::is('publish.dataset.create') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.dataset.create') }}"><i class="fa fa-upload"></i> Create</a>
</li>
<li class="pure-menu-item {{ Route::is('publish.dataset.index') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.dataset.index') }}"><i class="fa fa-upload"></i> Publish created datasets</a>
</li>
</ul>
</li>
@endpermission
@permission('page')
<li class="{{ active_class(Active::checkUriPattern('settings/page*')) }}">
<a class="pure-menu-link" href="{{ route('settings.page.index') }}">
<i class="fa fa-file-text"></i>
<span>{{ trans('labels.backend.pages.title') }}</span>
</a>
</li>
@endpermission
<li class="treeview">

View File

@ -23,7 +23,9 @@ Route::get('/oai', 'Oai\RequestController@identify');
Route::get('/api/persons', function () {
$request = request();
$query = Person::query();//->with('group');
//$query = Person::query();//->with('group');
$query = Person::where('status', true);
// handle sort option
//if (request()->has('sort')) {
if (null !== ($request->input('sort'))) {
@ -36,17 +38,20 @@ Route::get('/api/persons', function () {
} else {
$query = $query->orderBy('id', 'asc');
}
//handle filter
if ($request->exists('filter')) {
$query->where(function ($q) use ($request) {
$value = "%{$request->filter}%";
$q->where('first_name', 'like', $value)
// ->orWhere('nickname', 'like', $value)
->orWhere('last_name', 'like', $value)
->orWhere('email', 'like', $value);
});
}
$perPage = request()->has('per_page') ? (int) request()->per_page : null;
// $pagination = $query->with('address')->paginate($perPage);
$pagination = $query->paginate($perPage);
// $pagination = $query->get();
$pagination->appends([
'sort' => request()->sort,
'filter' => request()->filter,

View File

@ -25,13 +25,16 @@ Route::group(
'as' => 'publish.'
],
function () {
Route::get('dataset', [
'as' => 'dataset.index', 'uses' => 'IndexController@index',
]);
Route::get('dataset/create-step1', ['as' => 'dataset.create', 'uses' => 'IndexController@createStep1']);
Route::post('dataset/store-step1', ['as' => 'dataset.store1', 'uses' => 'IndexController@storeStep1']);
// Route::post('dataset/store-step1', ['as' => 'dataset.store1', 'uses' => 'IndexController@storeStep1']);
Route::get('dataset/create-step2', ['as' => 'dataset.create2', 'uses' => 'IndexController@createStep2']);
Route::post('dataset/store-step2', ['as' => 'dataset.store2', 'uses' => 'IndexController@storeStep2']);
// Route::get('dataset/create-step2', ['as' => 'dataset.create2', 'uses' => 'IndexController@createStep2']);
// Route::post('dataset/store-step2', ['as' => 'dataset.store2', 'uses' => 'IndexController@storeStep2']);
Route::get('dataset/create-step3', ['as' => 'dataset.create3', 'uses' => 'IndexController@createStep3']);
// Route::get('dataset/create-step3', ['as' => 'dataset.create3', 'uses' => 'IndexController@createStep3']);
Route::post('dataset/store', ['as' => 'dataset.store', 'uses' => 'IndexController@store']);
}
);

View File

@ -16,6 +16,7 @@ let mix = require('laravel-mix');
mix.js('resources/assets/js/datasetPublish.js', 'public/backend/publish')
.js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/lib.js', 'public/js')
.scripts([
'node_modules/datatables.net/js/jquery.dataTables.js',
'node_modules/datatables.net-buttons/js/dataTables.buttons.js',