Skip to content

Commit

Permalink
IP-188: progress on form fields
Browse files Browse the repository at this point in the history
  • Loading branch information
papandrk committed Oct 25, 2024
1 parent 797d474 commit ea4b81d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,26 @@ public function create() {
* Store a newly created resource in storage.
*/
public function store(Request $request) {
request()->validate([ // bookmark2
$validated = $request->validate([ // bookmark2
'problem-title' => ['required'],
'problem-description' => ['required'],
'problem-status' => ['required'], // bookmark2
'problem-default-language' => ['required'], // bookmark2
'problem-slug' => ['required','unique:crowd_sourcing_project_problems,slug'],
]);

$crowdSourcingProjectProblem = CrowdSourcingProjectProblem::create([
'project_id' => '3', // bookmark2
'user_creator_id' => '2', // bookmark2
'slug' => 'test-slug-1', // bookmark2
'status_id' => request('problem-status'), // bookmark2
'slug' => $request->input('problem-slug'),
'status_id' => $request->input('problem-status'),
'img_url' => 'zxcv', // bookmark2
'default_language_id' => request('problem-default-language'), // bookmark2 - default or generally another translation language?
'default_language_id' => $request->input('problem-default-language'), // bookmark2 - default or generally another translation language?
]);

$crowdSourcingProjectProblemTranslation = $crowdSourcingProjectProblem->defaultTranslation()->create([ // bookmark2 - default or regular translation?
'title' => request('problem-title'),
'description' => request('problem-description'),
'title' => $request->input('problem-title'),
'description' => $request->input('problem-description'),
]);

return redirect()->route('problems.index');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class="form-control"
<div class="row" style="display: none;{{-- bookmark2 --}}">
<div class="col-md-12">
<div class="form-group">
<label for="problem-status-2">Problem Status</label>
<label for="problem-status-2">Problem Status-2</label>
@if(!Gate::check('manage-platform-content'))
<small class="text-blue">(The problem status can only be changed by a platform administrator.)</small>{{-- bookmark2 - is this what we want? --}}
@endif
Expand Down Expand Up @@ -147,7 +147,7 @@ class="form-control"
<div class="row" style="display: none;{{-- bookmark2 --}}">
<div class="col-md-12">
<div class="form-group">
<label for="problem-default-language-2">Problem Default Language</label>
<label for="problem-default-language-2">Problem Default Language-2</label>
<select id="problem-default-language-2" class="form-control" name="problem-default-language-2">
{{-- @foreach ($viewModel->languagesLkp as $language) --}}
<option
Expand All @@ -165,25 +165,31 @@ class="form-control"
</div>
</div>

{{-- <div class="row">
<label class="col-md-12 control-label" for="slug">Project Slug
<br>(it defines the project's url, for example:
<br><i>For english | https://crowdsourcing.ecas.org/en/your-project-slug</i>)
<br><i>For greek | https://crowdsourcing.ecas.org/gr/your-project-slug</i>)
<br><i>For dutch | https://crowdsourcing.ecas.org/nl/your-project-slug</i>)
<div class="row">
<label class="col-md-12{{-- bookmark2 - md here? or sm? --}} control-label" for="problem-slug">Problem Slug (<span class="red">*</span>)
<br>(it defines the problems's url, for example:
<br><i>For english | https://crowdsourcing.ecas.org/en/your-problem-slug</i>)
<br><i>For greek | https://crowdsourcing.ecas.org/gr/your-problem-slug</i>)
<br><i>For dutch | https://crowdsourcing.ecas.org/nl/your-problem-slug</i>)
<br>The url can contain only letters, numbers, and dashes.
<br>If left empty, we will take care of creating the URL, based on the project name.
<br>Please note that once you publish the project you <i>cannot</i> change the slug.
<br>If left empty, we will take care of creating the URL, based on the problem name. {{-- bookmark2 - implement auto-creation - best done with js (client-side) --}}
<br>Please note that once you publish the problem you <i>cannot</i> change the slug. {{-- bookmark2 - once published or once created? --}}
</label>
<div class="col-sm-12">
<div class="form-group has-feedback {{ $errors->has('slug') ? 'has-error' : '' }}">
<input id="slug" type="text" class="form-control" name="slug"
value="{{ old('slug') ? old('slug') : $viewModel->project->slug }}"
placeholder="Project Slug">
<span class="help-block"><strong>{{ $errors->first('slug') }}</strong></span>
<div class="form-group has-feedback {{ $errors->has('problem-slug') ? 'has-error' : '' }}">
<input type="text"
id="problem-slug"
name="problem-slug"
class="form-control"
required
placeholder="Problem Slug"
{{-- value="{{ old('problem-slug') ? old('problem-slug') : $viewModel->problem->slug }}" bookmark2 --}}
value="{{ old('problem-slug') ? old('problem-slug') : '' }}"
>
<span class="help-block"><strong>{{ $errors->first('problem-slug') }}</strong></span>
</div>
</div>
</div> --}}
</div>

<input type="submit">

Expand Down

0 comments on commit ea4b81d

Please sign in to comment.