Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package Jobeet::Form::Job; | ||
use Ark 'Form'; | ||
|
||
use Jobeet::Models; | ||
|
||
param category => ( | ||
label => 'Category', | ||
type => 'ChoiceField', | ||
choices => [map { $_->slug => $_->name } models('Schema::Category')->all], | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
param type => ( | ||
label => 'Type', | ||
type => 'ChoiceField', | ||
choices => [ | ||
'full-time' => 'Full time', | ||
'part-time' => 'Part time', | ||
'freelance' => 'Freelance', | ||
], | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
param company => ( | ||
label => 'Company', | ||
type => 'TextField', | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
param url => ( | ||
label => 'URL', | ||
type => 'URLField', | ||
); | ||
|
||
param position => ( | ||
label => 'position', | ||
type => 'TextField', | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
param location => ( | ||
label => 'Location', | ||
type => 'TextField', | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
param description => ( | ||
label => 'Description', | ||
type => 'TextField', | ||
widget => 'textarea', | ||
attr => { | ||
cols => 30, | ||
rows => 4, | ||
}, | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
param how_to_apply => ( | ||
label => 'How to apply?', | ||
type => 'TextField', | ||
widget => 'textarea', | ||
attr => { | ||
cols => 30, | ||
rows => 4, | ||
}, | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
param email => ( | ||
label => 'Email', | ||
type => 'TextField', | ||
constraints => [ | ||
'NOT_NULL', | ||
], | ||
); | ||
|
||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
? my $form = $c->stash->{form}; | ||
|
||
? extends 'common/jobs_base'; | ||
|
||
? block content => sub { | ||
|
||
<h1>New Job</h1> | ||
|
||
<form method="post"> | ||
|
||
<table id="job_form"> | ||
<tfoot> | ||
<tr> | ||
<td colspan="2"> | ||
<input type="submit" value="Preview your job" /> | ||
</td> | ||
</tr> | ||
</tfoot> | ||
<tbody> | ||
? for my $field (qw/category type company url position location description how_to_apply email/) { | ||
<tr> | ||
<th><?= raw_string $form->label($field) ?></th> | ||
<td> | ||
? if ($form->is_error($field)) { | ||
<ul class="error_list"> | ||
? for my $err (@{ $form->error_messages($field) }) { | ||
<li><?= raw_string $err ?></li> | ||
? } # endfor $err | ||
</ul> | ||
? } # endif | ||
<?= raw_string $form->input($field) ?> | ||
</td> | ||
</tr> | ||
? } # endfor $field | ||
</tbody> | ||
</table> | ||
</form> | ||
|
||
? } # endblock content | ||
|