- release form mit radio buttons um preferred reviewer verpflichtend auswählen zu müssen

- reject form for editor
- beim Releasen mind. 1 Datensatz angeben
This commit is contained in:
Arno Kaimbacher 2019-05-22 14:02:16 +02:00
parent 178d0e7f6b
commit fed2fafd55
9 changed files with 66 additions and 17 deletions

View File

@ -210,7 +210,9 @@ class EditorController extends Controller
$dataset = Dataset::findOrFail($id);
$input = $request->all();
$input['server_state'] = 'approved';
$input['reject_reviewer_note'] = '';
if ($dataset->reject_reviewer_note != null) {
$input['[reject_reviewer_note'] = null;
}
if ($dataset->update($input)) {
// event(new PageUpdated($page));

View File

@ -60,9 +60,22 @@ class SubmitController extends Controller
public function releaseUpdate(Request $request, $id)
{
$dataset = Dataset::findOrFail($id);
if ($dataset->files->count() == 0) {
return back()
->withErrors(['datasets_count' => ['At least one dataset is required.']]);
}
$input = $request->all();
//immer released setzen
$input['server_state'] = 'released';
//editor wieder löschen falls rejected
if ($dataset->editor_id !== null) {
$input['editor_id'] = null;
}
if ($dataset->reject_editor_note != null) {
$input['reject_editor_note'] = null;
}
if ($dataset->update($input)) {
// event(new PageUpdated($page));

View File

@ -40,7 +40,8 @@ class Dataset extends Model
'preferred_reviewer',
'preferred_reviewer_email',
'reviewer_id',
'reject_reviewer_note'
'reject_reviewer_note',
'reject_editor_note'
];
//protected $guarded = [];
/**

10
composer.lock generated
View File

@ -335,16 +335,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.7",
"version": "2.1.8",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e"
"reference": "c26463ff9241f27907112fbcd0c86fa670cfef98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e",
"reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c26463ff9241f27907112fbcd0c86fa670cfef98",
"reference": "c26463ff9241f27907112fbcd0c86fa670cfef98",
"shasum": ""
},
"require": {
@ -388,7 +388,7 @@
"validation",
"validator"
],
"time": "2018-12-04T22:38:24+00:00"
"time": "2019-05-16T22:02:54+00:00"
},
{
"name": "erusev/parsedown",

File diff suppressed because one or more lines are too long

View File

@ -8,13 +8,14 @@ const app = new Vue({
el: '#app1',
data() {
return {
dataset: {
firstName: '',
preferred_reviewer: '',
preferred_reviewer_email: ''
},
// dataset: {
// firstName: '',
// preferred_reviewer: null,
// preferred_reviewer_email: null
// },
dataset: window.Laravel.dataset,
submitted: false,
preferation: "no_preferation",
preferation: "yes_preferation",
}
},
computed: {
@ -22,6 +23,14 @@ const app = new Vue({
return this.preferation === "yes_preferation";
},
},
watch: {
preferation(val) {
if (val === "no_preferation") {
this.dataset.preferred_reviewer = "";
this.dataset.preferred_reviewer_email = "";
}
}
},
methods: {
checkForm(e) {
// Log entire model to console
@ -29,7 +38,11 @@ const app = new Vue({
this.submitted = true;
this.$validator.validate().then(result => {
if (result) {
console.log('From Submitted!');
if (this.preferation === "no_preferation") {
this.dataset.preferred_reviewer = "";
this.dataset.preferred_reviewer_email = "";
}
// console.log('From Submitted!');
document.getElementById("releaseForm").submit();
return;
}

View File

@ -3,7 +3,8 @@
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('name_long', 'Lizenzname') !!} {!! Form::text('name_long', null, ['class' => 'pure-u-23-24', 'placeholder'
{!! Form::label('name_long', 'Lizenzname') !!}
{!! Form::text('name_long', null, ['class' => 'pure-u-23-24', 'placeholder'
=> '--no language--']) !!}
</div>

View File

@ -44,6 +44,7 @@
@else
no title
@endif
{{ $dataset->files->count() }}
</td>
<td>
{{ $dataset->user->login }}

View File

@ -12,6 +12,17 @@
</h3>
</div>
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-1">
@ -63,7 +74,7 @@
{!! Form::text('preferred_reviewer_email', null, array(
'placeholder' => 'Email', 'id' => 'preferred_reviewer_email', 'class' => 'pure-u-23-24',
'v-model' => 'dataset.preferred_reviewer_email',
"v-validate" => "this.isPreferationRequired ? 'required|mail' : ''")) !!}
"v-validate" => "this.isPreferationRequired ? 'required|email' : ''")) !!}
<em>*</em>
<span class="help is-danger" v-if="errors.has('preferred_reviewer_email')" v-text="errors.first('preferred_reviewer_email')"></span>
@ -98,6 +109,13 @@
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>--}} {{--
<script type="text/javascript" src="{{ resource_path('assets\js\datasetPublish.js') }}"></script> --}}
<script>
window.Laravel = <?php echo json_encode([
'csrf_token' => csrf_token(),
'dataset' => $dataset
]); ?>
</script>
<script type="text/javascript" src="{{ asset('backend/publish/releaseDataset.js') }}"></script>
@stop