-
Notifications
You must be signed in to change notification settings - Fork 6
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
11 changed files
with
236 additions
and
5 deletions.
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
42 changes: 42 additions & 0 deletions
42
backend/clubs/migrations/0117_clubapprovalresponsetemplate.py
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,42 @@ | ||
# Generated by Django 5.0.4 on 2024-10-15 05:12 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("clubs", "0116_alter_club_approved_on_and_more"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ClubApprovalResponseTemplate", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("title", models.CharField(max_length=255)), | ||
("content", models.TextField()), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="templates", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
), | ||
] |
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
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
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
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,59 @@ | ||
import { Field } from 'formik' | ||
import moment from 'moment-timezone' | ||
import React, { ReactElement } from 'react' | ||
|
||
import { Template } from '../../types' | ||
import { OBJECT_NAME_SINGULAR } from '../../utils/branding' | ||
import { Text } from '../common' | ||
import { TextField } from '../FormComponents' | ||
import ModelForm from '../ModelForm' | ||
|
||
type TemplatesTabProps = { | ||
templates: Template[] | ||
} | ||
|
||
export default function TemplatesTab({ | ||
templates, | ||
}: TemplatesTabProps): ReactElement { | ||
return ( | ||
<> | ||
<Text> | ||
You can use this page to manage {OBJECT_NAME_SINGULAR} approval response | ||
templates. Since your account has the required permissions, you are able | ||
to view this page. | ||
</Text> | ||
<ModelForm | ||
baseUrl="/templates/" | ||
initialData={templates} | ||
fields={ | ||
<> | ||
<Field | ||
name="title" | ||
as={TextField} | ||
required | ||
helpText={`The title of the ${OBJECT_NAME_SINGULAR} approval response template. This will be shown in the template dropdown menu.`} | ||
/> | ||
<Field name="content" as={TextField} type="textarea" required /> | ||
</> | ||
} | ||
tableFields={[ | ||
{ name: 'title', label: 'Title' }, | ||
{ name: 'content', label: 'Content' }, | ||
{ name: 'author', label: 'Author' }, | ||
{ | ||
name: 'created_at', | ||
label: 'Date Created', | ||
converter: (field) => moment(field).format('MMMM Do, YYYY'), | ||
}, | ||
{ | ||
name: 'updated_at', | ||
label: 'Last Updated', | ||
converter: (field) => moment(field).format('MMMM Do, YYYY'), | ||
}, | ||
]} | ||
noun="Template" | ||
confirmDeletion={true} | ||
/> | ||
</> | ||
) | ||
} |
Oops, something went wrong.