- 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); $dataset = Dataset::findOrFail($id);
$input = $request->all(); $input = $request->all();
$input['server_state'] = 'approved'; $input['server_state'] = 'approved';
$input['reject_reviewer_note'] = ''; if ($dataset->reject_reviewer_note != null) {
$input['[reject_reviewer_note'] = null;
}
if ($dataset->update($input)) { if ($dataset->update($input)) {
// event(new PageUpdated($page)); // event(new PageUpdated($page));

View File

@ -60,10 +60,23 @@ class SubmitController extends Controller
public function releaseUpdate(Request $request, $id) public function releaseUpdate(Request $request, $id)
{ {
$dataset = Dataset::findOrFail($id); $dataset = Dataset::findOrFail($id);
if ($dataset->files->count() == 0) {
return back()
->withErrors(['datasets_count' => ['At least one dataset is required.']]);
}
$input = $request->all(); $input = $request->all();
//immer released setzen
$input['server_state'] = 'released'; $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)) { if ($dataset->update($input)) {
// event(new PageUpdated($page)); // event(new PageUpdated($page));
return redirect() return redirect()

View File

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

10
composer.lock generated
View File

@ -335,16 +335,16 @@
}, },
{ {
"name": "egulias/email-validator", "name": "egulias/email-validator",
"version": "2.1.7", "version": "2.1.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/egulias/EmailValidator.git", "url": "https://github.com/egulias/EmailValidator.git",
"reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e" "reference": "c26463ff9241f27907112fbcd0c86fa670cfef98"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e", "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c26463ff9241f27907112fbcd0c86fa670cfef98",
"reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e", "reference": "c26463ff9241f27907112fbcd0c86fa670cfef98",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -388,7 +388,7 @@
"validation", "validation",
"validator" "validator"
], ],
"time": "2018-12-04T22:38:24+00:00" "time": "2019-05-16T22:02:54+00:00"
}, },
{ {
"name": "erusev/parsedown", "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', el: '#app1',
data() { data() {
return { return {
dataset: { // dataset: {
firstName: '', // firstName: '',
preferred_reviewer: '', // preferred_reviewer: null,
preferred_reviewer_email: '' // preferred_reviewer_email: null
}, // },
dataset: window.Laravel.dataset,
submitted: false, submitted: false,
preferation: "no_preferation", preferation: "yes_preferation",
} }
}, },
computed: { computed: {
@ -22,6 +23,14 @@ const app = new Vue({
return this.preferation === "yes_preferation"; return this.preferation === "yes_preferation";
}, },
}, },
watch: {
preferation(val) {
if (val === "no_preferation") {
this.dataset.preferred_reviewer = "";
this.dataset.preferred_reviewer_email = "";
}
}
},
methods: { methods: {
checkForm(e) { checkForm(e) {
// Log entire model to console // Log entire model to console
@ -29,7 +38,11 @@ const app = new Vue({
this.submitted = true; this.submitted = true;
this.$validator.validate().then(result => { this.$validator.validate().then(result => {
if (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(); document.getElementById("releaseForm").submit();
return; return;
} }

View File

@ -3,7 +3,8 @@
<div class="pure-g"> <div class="pure-g">
<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('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--']) !!} => '--no language--']) !!}
</div> </div>

View File

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

View File

@ -12,6 +12,17 @@
</h3> </h3>
</div> </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-g box-content">
<div class="pure-u-1 pure-u-md-1"> <div class="pure-u-1 pure-u-md-1">
@ -63,7 +74,7 @@
{!! Form::text('preferred_reviewer_email', null, array( {!! Form::text('preferred_reviewer_email', null, array(
'placeholder' => 'Email', 'id' => 'preferred_reviewer_email', 'class' => 'pure-u-23-24', 'placeholder' => 'Email', 'id' => 'preferred_reviewer_email', 'class' => 'pure-u-23-24',
'v-model' => 'dataset.preferred_reviewer_email', 'v-model' => 'dataset.preferred_reviewer_email',
"v-validate" => "this.isPreferationRequired ? 'required|mail' : ''")) !!} "v-validate" => "this.isPreferationRequired ? 'required|email' : ''")) !!}
<em>*</em> <em>*</em>
<span class="help is-danger" v-if="errors.has('preferred_reviewer_email')" v-text="errors.first('preferred_reviewer_email')"></span> <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://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>--}} {{-- <script src="https://cdn.jsdelivr.net/npm/vue"></script>--}} {{--
<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>
window.Laravel = <?php echo json_encode([
'csrf_token' => csrf_token(),
'dataset' => $dataset
]); ?>
</script>
<script type="text/javascript" src="{{ asset('backend/publish/releaseDataset.js') }}"></script> <script type="text/javascript" src="{{ asset('backend/publish/releaseDataset.js') }}"></script>
@stop @stop