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() 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'); ->pluck('part2_t', 'part2_t');
// ->toArray(); // ->toArray();
$persons = Person::where('status', 1) // $persons = Person::where('status', 1)
->pluck('last_name', 'id'); // ->pluck('last_name', 'id');
$projects = Project::pluck('label', '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'); $licenses = $request->input('licenses');
$dataset->licenses()->sync($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: //save main title:
if (isset($data['title_main'])) { if (isset($data['title_main'])) {
$formTitle = $request->input('title_main'); $formTitle = $request->input('title_main');

View File

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

View File

@ -73,8 +73,9 @@ class Dataset extends Model
//return all persons attached to this film //return all persons attached to this film
public function persons() public function persons()
{ {
return $this->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id') return $this
->withPivot('role'); ->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", "name": "jakub-onderka/php-console-highlighter",
"version": "v0.3.2", "version": "v0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git",
"reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" "reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/9f7a229a69d52506914b4bc61bfdb199d90c5547",
"reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", "reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"jakub-onderka/php-console-color": "~0.1", "ext-tokenizer": "*",
"php": ">=5.3.0" "jakub-onderka/php-console-color": "~0.2",
"php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"jakub-onderka/php-code-style": "~1.0", "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", "jakub-onderka/php-var-dump-check": "~0.1",
"phpunit/phpunit": "~4.0", "phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~1.5" "squizlabs/php_codesniffer": "~1.5"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"JakubOnderka\\PhpConsoleHighlighter": "src/" "JakubOnderka\\PhpConsoleHighlighter\\": "src/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -584,7 +585,8 @@
"homepage": "http://www.acci.cz/" "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", "name": "laravel/framework",
@ -722,16 +724,16 @@
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
"version": "v1.0.7", "version": "v1.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/tinker.git", "url": "https://github.com/laravel/tinker.git",
"reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d" "reference": "cafbf598a90acde68985660e79b2b03c5609a405"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", "url": "https://api.github.com/repos/laravel/tinker/zipball/cafbf598a90acde68985660e79b2b03c5609a405",
"reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", "reference": "cafbf598a90acde68985660e79b2b03c5609a405",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -781,7 +783,7 @@
"laravel", "laravel",
"psysh" "psysh"
], ],
"time": "2018-05-17T13:42:07+00:00" "time": "2018-10-12T19:39:35+00:00"
}, },
{ {
"name": "laravelcollective/html", "name": "laravelcollective/html",
@ -853,16 +855,16 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.0.47", "version": "1.0.48",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c" "reference": "a6ded5b2f6055e2db97b4b859fdfca2b952b78aa"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a11e4a75f256bdacf99d20780ce42d3b8272975c", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a6ded5b2f6055e2db97b4b859fdfca2b952b78aa",
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c", "reference": "a6ded5b2f6055e2db97b4b859fdfca2b952b78aa",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -933,7 +935,7 @@
"sftp", "sftp",
"storage" "storage"
], ],
"time": "2018-09-14T15:30:29+00:00" "time": "2018-10-15T13:53:10+00:00"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
@ -1354,23 +1356,23 @@
}, },
{ {
"name": "psy/psysh", "name": "psy/psysh",
"version": "v0.9.8", "version": "v0.9.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/bobthecow/psysh.git", "url": "https://github.com/bobthecow/psysh.git",
"reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555" "reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/ed3c32c4304e1a678a6e0f9dc11dd2d927d89555", "url": "https://api.github.com/repos/bobthecow/psysh/zipball/9aaf29575bb8293206bb0420c1e1c87ff2ffa94e",
"reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555", "reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"dnoegel/php-xdg-base-dir": "0.1", "dnoegel/php-xdg-base-dir": "0.1",
"ext-json": "*", "ext-json": "*",
"ext-tokenizer": "*", "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", "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"php": ">=5.4.0", "php": ">=5.4.0",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0", "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
@ -1424,7 +1426,7 @@
"interactive", "interactive",
"shell" "shell"
], ],
"time": "2018-09-05T11:40:09+00:00" "time": "2018-10-13T15:16:03+00:00"
}, },
{ {
"name": "ramsey/uuid", "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", "/js/app.js": "/js/app.js",
"/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js", "/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js",
"/js/lib.js": "/js/lib.js",
"/js/dataTable.js": "/js/dataTable.js" "/js/dataTable.js": "/js/dataTable.js"
} }

View File

@ -2,17 +2,20 @@
https://alligator.io/vuejs/vue-autocomplete-component/ --> https://alligator.io/vuejs/vue-autocomplete-component/ -->
<template> <template>
<div style="position:relative"> <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" v-show="results.length > 0"> -->
<ul class="autocomplete-results pure-u-23-24" v-show="isOpen"> <ul class="autocomplete-results pure-u-23-24" v-show="isOpen">
<li class="loading" v-if="isLoading" >Loading results...</li> <li class="loading" v-if="isLoading" >Loading results...</li>
<li <li
v-else v-else
v-for="suggestion in results" v-for="(suggestion, i) in results"
:key="suggestion.id" :key="i"
@click="setResult(suggestion)" @click="setResult(suggestion)"
class="autocomplete-result"> class="autocomplete-result"
:class="{ 'is-active': i === arrowCounter }"
>
<strong>{{ suggestion.full_name }}</strong> <strong>{{ suggestion.full_name }}</strong>
</li> </li>
</ul> </ul>
@ -20,6 +23,9 @@ https://alligator.io/vuejs/vue-autocomplete-component/ -->
</template> </template>
<script> <script>
import _ from 'lodash';
import axios from 'axios';
export default { export default {
//data from parent component //data from parent component
props: { props: {
@ -42,7 +48,8 @@ export default {
isOpen: false, isOpen: false,
isLoading: false, isLoading: false,
isAsync: true, isAsync: true,
items: [] items: [],
arrowCounter: -1
}; };
}, },
@ -98,15 +105,14 @@ export default {
}); });
this.isOpen = true; this.isOpen = true;
} }
} } else {
else{
this.items = []; this.items = [];
} }
}, },
filterResults() { filterResults: _.debounce(function() {
var self = this; var self = this;
axios axios
.get("/api/persons", { params: { filter: this.search } }) .get("/api/persons", { params: { filter: this.search.toLowerCase() } })
.then(function(response) { .then(function(response) {
return (self.items = response.data.data); return (self.items = response.data.data);
}) })
@ -116,13 +122,32 @@ export default {
// this.results = this.items.filter(item => { // this.results = this.items.filter(item => {
// return item.toLowerCase().indexOf(this.search.toLowerCase()) > -1; // 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: { computed: {
// isOpen() { // isOpen() {
// return this.results.length > 0; // return this.results.length > 0;
// } // }
} }
}; };
</script> </script>
@ -143,6 +168,7 @@ export default {
cursor: pointer; cursor: pointer;
} }
.autocomplete-result.is-active,
.autocomplete-result:hover { .autocomplete-result:hover {
background-color: #4aae9b; background-color: #4aae9b;
color: white; color: white;

View File

@ -19,18 +19,18 @@
// else { // else {
// console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); // 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'); // window.Vue = require('vue');
// Vue.prototype.$http = axios; // Vue.prototype.$http = axios;
// import Vue from 'vue'; import Vue from 'vue';
// Vue.component('example', require('./components/Example.vue')); // Vue.component('example', require('./components/Example.vue'));
//Vue.component('my-autocomplete', require('./components/MyAutocomplete.vue')); //Vue.component('my-autocomplete', require('./components/MyAutocomplete.vue'));
import MyAutocomplete from './components/MyAutocomplete.vue'; import MyAutocomplete from './components/MyAutocomplete.vue';
import VeeValidate from 'vee-validate'; import VeeValidate from 'vee-validate';
// import { Validator } from 'vee-validate'; // import { Validator } from 'vee-validate';
Vue.use(VeeValidate); Vue.use(VeeValidate);
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3; const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
@ -55,7 +55,7 @@ const app = new Vue({
step: 1, step: 1,
dataset: { dataset: {
type: '', type: '',
state: '', state: 'inprogress',
rights: null, rights: null,
project_id: '', project_id: '',
@ -71,7 +71,7 @@ const app = new Vue({
value: '', value: '',
language: '' language: ''
}, },
checkedPersons: [], checkedAuthors: [],
checkedLicenses: [],// [], checkedLicenses: [],// [],
files: [] files: []
} }
@ -160,6 +160,10 @@ const app = new Vue({
formData.append('licenses[' + i + ']', this.dataset.checkedLicenses[i]); 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 Make the request to the POST /multiple-files URL
*/ */
@ -238,7 +242,12 @@ const app = new Vue({
}, },
onAddAuthor(person) { onAddAuthor(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.persons.push(person);
this.dataset.checkedAuthors.push(person.id);
}
}, },
/* /*
Removes a select file the user has uploaded 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 * includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel. * building robust, powerful web applications using Vue and Laravel.
*/ */
require('./bootstrap'); // require('./bootstrap');
// window.Vue = require('vue');
import Vue from 'vue';
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')); // Vue.component('example', require('./components/Example.vue'));

View File

@ -10,11 +10,13 @@
</div> </div>
<div id="app" class="box-content"> <div id="app" class="box-content">
{{-- <form action={{ route( 'publish.dataset.store1') }} method="post" class="pure-form" enctype="multipart/form-data"> --}} {{--
<form action={{ route( 'publish.dataset.store1') }} method="post" class="pure-form" enctype="multipart/form-data">
--}}
<main class="steps pure-form" enctype="multipart/form-data"> <main class="steps pure-form" enctype="multipart/form-data">
{{ csrf_field() }} {{ csrf_field() }}
<form v-if="step === 1" data-vv-scope="step-1"> <div v-if="step === 1" data-vv-scope="step-1">
<h1>Step One</h1> <h1>Step One</h1>
<div class="form-group"> <div class="form-group">
@ -26,8 +28,8 @@
<div class="form-item"> <div class="form-item">
<label for="documentType">Datensatztyp<span class="required" title="Dieses Feld muss ausgefüllt werden."> *</span></label> <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."> <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 --', {!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'v-model' => 'dataset.type', "v-validate" => "'required'"]) !!} 'dataset.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
</div> </div>
</div> </div>
</div> </div>
@ -45,14 +47,13 @@
<span class="required" title="Dieses Feld muss ausgefüllt werden.">*</span> <span class="required" title="Dieses Feld muss ausgefüllt werden.">*</span>
</small> {{-- <input name="rights" value="0" type="hidden"> --}} </small> {{-- <input name="rights" value="0" type="hidden"> --}}
<label> <label>
<input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" v-validate="'required'"> <input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" v-validate="'required'" data-vv-scope="step-1">
<br /> <br />
<i v-show="errors.has('step-1.rights')" class="fa fa-warning"></i> <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> <span v-show="errors.has('step-1.rights')" class="text-danger">@{{ errors.first('step-1.rights') }}</span>
</label> </label>
<span class="help-block">You must agree to continue</span> <span class="help-block">You must agree to continue</span> {{-- </div> --}}
{{-- </div> --}}
</div> </div>
<br /> <br />
@ -68,9 +69,9 @@
<li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li> <li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li>
</ul> </ul>
</div> </div>
</form> </div>
<form v-if="step === 2" data-vv-scope="step-2"> <div v-if="step === 2" data-vv-scope="step-2">
<h1>Step Two</h1> <h1>Step Two</h1>
<fieldset id="fieldset-general"> <fieldset id="fieldset-general">
<legend>General</legend> <legend>General</legend>
@ -87,36 +88,40 @@
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Type', 'Type..') !!} {!! Form::label('Type', 'Type..') !!}
<div class="select pure-u-23-24"> <div class="select pure-u-23-24">
{!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', {!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'v-model' => 'dataset.type', "v-validate" => "'required'"]) !!} 'dataset.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</div> </div>
</div> </div>
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('State', 'State..') !!} {!! Form::label('State', 'State..') !!}
<div class="select pure-u-23-24"> {{ 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']), '', {!! Form::select( 'State', array_except(Config::get('enums.server_states'),['published', 'deleted', 'temporary']), '',
['placeholder' => '-- select server state --', 'v-model' => 'dataset.state', "v-validate" => "'required'"] ) !!} ['placeholder' => '-- select server state --', 'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2'] ) !!}
</div> </div> --}}
</div> </div>
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('CreatingCorporation', 'Creating Corporation') !!} {!! Form::text('CreatingCorporation', null, ['class' => {!! Form::label('CreatingCorporation', 'Creating Corporation') !!}
'pure-u-23-24', 'v-model' => 'dataset.creating_corporation', "v-validate" => "'required'"]) !!} {!! 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"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('project_id', 'Project..') !!} {!! Form::label('project_id', 'Project..') !!}
<div class="select pure-u-23-24"> <div class="select pure-u-23-24">
{!! Form::select('project_id', $projects, null, ['id' => 'project_id', 'placeholder' => '--no project--', 'v-model' => 'dataset.project_id']) {!! Form::select('project_id', $projects, null, ['id' => 'project_id', 'placeholder' => '--no project--', 'v-model' => 'dataset.project_id', 'data-vv-scope' => 'step-2'])
!!} !!}
</div> </div>
<small id="projectHelp" class="pure-form-message-inline">project is optional</small> <small id="projectHelp" class="pure-form-message-inline">project is optional</small>
</div> </div>
<div class="pure-u-1 pure-u-md-1-2 pure-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' {!! Form::label('EmbargoDate', 'Embargo Date') !!}
=> 'pure-u-23-24', 'v-model' => 'dataset.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> <small id="projectHelp" class="pure-form-message-inline">EmbargoDate is optional</small>
</div> </div>
@ -124,7 +129,7 @@
<!-- checkboxes --> <!-- checkboxes -->
<label for="BelongsToBibliography" class="pure-checkbox"> <label for="BelongsToBibliography" class="pure-checkbox">
{{-- <input type="hidden" name="BelongsToBibliography" value="0"> --}} {{-- <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"> false-value="0" type="checkbox" class="form-check-input">
Belongs To Bibliography? Belongs To Bibliography?
</label> </label>
@ -139,26 +144,27 @@
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleMain', 'Main Title ') !!} {!! Form::label('TitleMain', 'Main Title ') !!}
{!! Form::text('TitleMain[Value]', null, ['class' => 'pure-u-23-24', 'v-model' {!! 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"]) !!} => 'dataset.title_main.value', "v-validate" => "'required|min:3'", "data-vv-as" => "Main Title", 'data-vv-scope' => 'step-2']) !!}
</div> </div>
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleLanguage', 'Title Language..') !!} {!! Form::label('TitleLanguage', 'Title Language..') !!}
<div class="select pure-u-23-24"> <div class="select pure-u-23-24">
{!! Form::select('TitleMain[Language]', $languages, null, {!! Form::select('TitleMain[Language]', $languages, null, ['placeholder' => '--no language--', 'v-model' => 'dataset.title_main.language',
['placeholder' => '--no language--', 'v-model' => 'dataset.title_main.language', "v-validate" => "'required'", "data-vv-as" => "Title Language"]) !!} "v-validate" => "'required'", "data-vv-as" => "Title Language", 'data-vv-scope' => 'step-2']) !!}
</div> </div>
</div> </div>
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleAbstract', 'Main Abstract ') !!} {!! Form::label('TitleAbstract', 'Main Abstract ') !!}
{{ Form::textarea('TitleAbstract[Value]', null, ['class' => 'pure-u-23-24', {{ 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"]) }} '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>
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('AbstractLanguage', 'Abstract Language..') !!} {!! Form::label('AbstractLanguage', 'Abstract Language..') !!}
<div class="select pure-u-23-24"> <div class="select pure-u-23-24">
{!! Form::select('TitleAbstract[Language]', $languages, null, {!! Form::select('TitleAbstract[Language]', $languages, null, ['placeholder' => '--no language--', 'v-model' => 'dataset.abstract_main.language',
['placeholder' => '--no language--', 'v-model' => 'dataset.abstract_main.language', "v-validate" => "'required'", "data-vv-as" => "Abstract Language"]) !!} "v-validate" => "'required'", "data-vv-as" => "Abstract Language", 'data-vv-scope' => 'step-2']) !!}
</div> </div>
</div> </div>
</div> </div>
@ -170,10 +176,11 @@
@foreach ($licenses as $indexKey => $license) @foreach ($licenses as $indexKey => $license)
<label for={{ "license". $license->id }} class="pure-checkbox"> <label for={{ "license". $license->id }} class="pure-checkbox">
@if ($loop->first) @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 }} {{ $license->name_long }}
@else @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 }} {{ $license->name_long }}
@endif @endif
</label> </label>
@ -201,9 +208,9 @@
<li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li> <li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li>
</ul> </ul>
</div> </div>
</form> </div>
<form v-if="step === 3" data-vv-scope="step-3"> <div v-if="step === 3" data-vv-scope="step-3">
<h1>Select authors, contributors</h1> <h1>Select authors, contributors</h1>
<fieldset id="fieldset-general"> <fieldset id="fieldset-general">
<legend>Authors</legend> <legend>Authors</legend>
@ -216,18 +223,15 @@
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
<div class="pure-control-group checkboxlist"> <div class="pure-control-group checkboxlist">
<label v-for="(person, index) in persons" :for="person.id" class="pure-checkbox"> <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"> <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 }} @{{ person.full_name }}
{{-- {!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'person.type']) !!} --}}
</label> </label>
<br />
<span>Checked Authors: @{{ dataset.checkedAuthors }}</span>
</div> </div>
{{-- <span v-for="(person, index) in persons"> {{-- <span v-for="(person, index) in persons">
<strong>@{{ person.full_name }}</strong> <strong>@{{ person.full_name }}</strong>
</span> --}} </span> --}}
<small id="authorHelp" class="pure-form-message-inline">Authoren werden noch nicht abgespeichert - nur für Demo</small>
</div> </div>
</div> </div>
</fieldset> </fieldset>
@ -251,14 +255,14 @@
<span>Review Dataset</span> <span>Review Dataset</span>
</button> </button>
</div> </div>
</form> </div>
<form v-if="step === 4" data-vv-scope="step-4"> <div v-if="step === 4" data-vv-scope="step-4">
<h1>File Upload</h1> <h1>File Upload</h1>
<div class="dropbox"> <div class="dropbox">
<input type="file" multiple name="files" :disabled="isSaving" @change="filesChange($event.target.name, $event.target.files)" <input type="file" multiple name="files" v-bind:disabled="isSaving" @change="filesChange($event.target.name, $event.target.files)"
class="input-file"> class="input-file" data-vv-scope="step-4">
<p v-if="isInitial"> <p v-if="isInitial">
Drag your file(s) here to begin<br> or click to browse Drag your file(s) here to begin<br> or click to browse
</p> </p>
@ -298,7 +302,6 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<button @click.prevent="prev()" class="pure-button button-small"> <button @click.prevent="prev()" class="pure-button button-small">
<i class="fa fa-arrow-left"></i> <i class="fa fa-arrow-left"></i>
<span>Zurück</span> <span>Zurück</span>
@ -308,7 +311,7 @@
<span>Create Dataset</span> <span>Create Dataset</span>
</button> </button>
</form> </div>
<div v-if="serrors.length > 0"> <div v-if="serrors.length > 0">
<b>Please correct the following server error(s):</b> <b>Please correct the following server error(s):</b>
@ -321,11 +324,11 @@
</main> </main>
{{-- <br/><br/>Debug:@{{ dataset }} --}} {{-- <br/><br/>Debug:@{{ dataset }} --}}
</div> </div>
@stop
@stop
@section('styles') @section('styles')
<style type="text/css"> <style type="text/css">
/* main.steps article { /* main.steps article {
display:block; display:block;
} */ } */
@ -338,11 +341,10 @@
.has-error .help-block { .has-error .help-block {
display: block; display: block;
} }
</style> </style>
@stop @stop
@section('after-scripts') {{-- @section('after-scripts') {{--
<script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}} {{-- <script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}} {{--
<script src="https://unpkg.com/axios/dist/axios.min.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="{{ resource_path('assets\js\datasetPublish.js') }}"></script> --}}
<script type="text/javascript" src="{{ asset('backend/publish/datasetPublish.js') }}"></script> <script type="text/javascript" src="{{ asset('backend/publish/datasetPublish.js') }}"></script>
@stop @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

@ -70,21 +70,6 @@
<a class="pure-menu-link" href="{{ route('settings.project') }}"><i class="fa fa-tasks"></i> Projects</a> <a class="pure-menu-link" href="{{ route('settings.project') }}"><i class="fa fa-tasks"></i> Projects</a>
</li> </li>
</ul>
</li>
@endpermission
@permission('review')
<li class="{{ active_class(Active::checkUriPattern('publish/dataset/*')) }}">
<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>
</ul>
</li>
@endpermission
@permission('page') @permission('page')
<li class="{{ active_class(Active::checkUriPattern('settings/page*')) }}"> <li class="{{ active_class(Active::checkUriPattern('settings/page*')) }}">
<a class="pure-menu-link" href="{{ route('settings.page.index') }}"> <a class="pure-menu-link" href="{{ route('settings.page.index') }}">
@ -94,6 +79,26 @@
</li> </li>
@endpermission @endpermission
</ul>
</li>
@endpermission
@permission('review')
<li class="treeview">
<h2 class="pure-menu-heading">Publish</h2>
<ul class="pure-menu-list">
<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
<li class="treeview"> <li class="treeview">
<h2 class="pure-menu-heading"> <h2 class="pure-menu-heading">

View File

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

View File

@ -25,13 +25,16 @@ Route::group(
'as' => 'publish.' 'as' => 'publish.'
], ],
function () { function () {
Route::get('dataset', [
'as' => 'dataset.index', 'uses' => 'IndexController@index',
]);
Route::get('dataset/create-step1', ['as' => 'dataset.create', 'uses' => 'IndexController@createStep1']); 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::get('dataset/create-step2', ['as' => 'dataset.create2', 'uses' => 'IndexController@createStep2']);
Route::post('dataset/store-step2', ['as' => 'dataset.store2', 'uses' => 'IndexController@storeStep2']); // 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']); 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') mix.js('resources/assets/js/datasetPublish.js', 'public/backend/publish')
.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/lib.js', 'public/js')
.scripts([ .scripts([
'node_modules/datatables.net/js/jquery.dataTables.js', 'node_modules/datatables.net/js/jquery.dataTables.js',
'node_modules/datatables.net-buttons/js/dataTables.buttons.js', 'node_modules/datatables.net-buttons/js/dataTables.buttons.js',