'code.*' => 'string',
'rolled_by' => 'nullable|exists:App\\Models\\User,id',
'seed' => 'url',
+ 'spoiler' => 'url',
'title' => 'string',
]);
$round->code = array_filter($validatedData['code']);
$round->rolled_by = $validatedData['rolled_by'];
$round->seed = $validatedData['seed'];
+ $round->spoiler = $validatedData['spoiler'];
$round->title = $validatedData['title'];
$round->update();
--- /dev/null
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('rounds', function(Blueprint $table) {
+ $table->string('spoiler')->default('');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('rounds', function(Blueprint $table) {
+ $table->dropColumn('spoiler');
+ });
+ }
+};
: null}
</Form.Group>
</Row>
+ <Row>
+ <Form.Group as={Col} controlId="round.spoiler">
+ <Form.Label>{i18n.t('rounds.spoiler')}</Form.Label>
+ <Form.Control
+ isInvalid={!!(touched.spoiler && errors.spoiler)}
+ name="spoiler"
+ onBlur={handleBlur}
+ onChange={handleChange}
+ type="text"
+ value={values.spoiler || ''}
+ />
+ {touched.spoiler && errors.spoiler ?
+ <Form.Control.Feedback type="invalid">
+ {i18n.t(errors.spoiler)}
+ </Form.Control.Feedback>
+ : null}
+ </Form.Group>
+ </Row>
<Row>
<Form.Group as={Col}>
<Form.Label>{i18n.t('rounds.code')}</Form.Label>
code: PropTypes.arrayOf(PropTypes.string),
rolled_by: PropTypes.string,
seed: PropTypes.string,
+ spoiler: PropTypes.string,
title: PropTypes.string,
}),
handleBlur: PropTypes.func,
code: PropTypes.arrayOf(PropTypes.bool),
rolled_by: PropTypes.bool,
seed: PropTypes.bool,
+ spoiler: PropTypes.bool,
title: PropTypes.bool,
}),
values: PropTypes.shape({
game: PropTypes.string,
rolled_by: PropTypes.string,
seed: PropTypes.string,
+ spoiler: PropTypes.string,
title: PropTypes.string,
}),
};
rolled_by: round.rolled_by || null,
round_id: round.id,
seed: round.seed || '',
+ spoiler: round.spoiler || '',
title: round.title || '',
}),
validationSchema: yup.object().shape({
code: yup.array().of(yup.string()),
rolled_by: yup.string().nullable(),
seed: yup.string().url(),
+ spoiler: yup.string().url(),
title: yup.string(),
}),
})(withTranslation()(EditForm));
const [showDialog, setShowDialog] = useState(false);
if (round.seed) {
- return (
+ return <>
<Button href={round.seed} target="_blank" variant="primary">
{i18n.t('rounds.seed')}
</Button>
- );
+ {round.spoiler ?
+ <Button
+ className="ms-2"
+ href={round.spoiler}
+ target="_blank"
+ variant="outline-primary"
+ >
+ {i18n.t('rounds.spoiler')}
+ </Button>
+ : null}
+ </>;
}
if (maySetSeed(user, tournament, round)) {
return <>
SeedButton.propTypes = {
round: PropTypes.shape({
seed: PropTypes.string,
+ spoiler: PropTypes.string,
}),
tournament: PropTypes.shape({
}),
setSeed: 'Seed eintragen',
setSeedError: 'Seed konnte nicht eintragen werden',
setSeedSuccess: 'Seed eingetragen',
+ spoiler: 'Spoiler',
title: 'Titel',
unlock: 'Runde entsperren',
unlockDescription: 'Die Runde wird wieder freigegeben und Runner können wieder Änderungen an ihrem Ergebnis vornehmen.',