diff --git a/.gitignore b/.gitignore index 515537f30..11865a673 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ # Visual Studio Code .vscode/* !.vscode/settings.json +!.vscode/tailwind.json !.vscode/extensions.json # Webstorm diff --git a/.vscode/settings.json b/.vscode/settings.json index f0a0fd5f1..6c30e88b6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,21 @@ { - "eslint.validate": ["javascript", "typescript", "vue"], + "eslint.validate": [ + "javascript", + "typescript", + "vue" + ], "eslint.useFlatConfig": true, "typescript.tsdk": "./frontend/node_modules/typescript/lib", -} + "cSpell.words": [ + "headlessui", + "organizationimage", + "viewsets", + "vuedraggable" + ], + // This gets rid of 'Unknown at-rule @apply' messages in VSCode 'Problems' tab. First noticed in MediaImageCarousel.vue. + // Look at tailwind.json for more info. + // https://github.com/tailwindlabs/tailwindcss/discussions/5258#discussioncomment-1979394 + "css.customData": [ + ".vscode/tailwind.json" + ], +} \ No newline at end of file diff --git a/.vscode/tailwind.json b/.vscode/tailwind.json new file mode 100644 index 000000000..d5d952624 --- /dev/null +++ b/.vscode/tailwind.json @@ -0,0 +1,55 @@ +{ + "version": 1.1, + "atDirectives": [ + { + "name": "@tailwind", + "description": "Use the `@tailwind` directive to insert Tailwind's `base`, `components`, `utilities` and `screens` styles into your CSS.", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#tailwind" + } + ] + }, + { + "name": "@apply", + "description": "Use the `@apply` directive to inline any existing utility classes into your own custom CSS. This is useful when you find a common utility pattern in your HTML that you’d like to extract to a new component.", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#apply" + } + ] + }, + { + "name": "@responsive", + "description": "You can generate responsive variants of your own classes by wrapping their definitions in the `@responsive` directive:\n```css\n@responsive {\n .alert {\n background-color: #E53E3E;\n }\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#responsive" + } + ] + }, + { + "name": "@screen", + "description": "The `@screen` directive allows you to create media queries that reference your breakpoints by **name** instead of duplicating their values in your own CSS:\n```css\n@screen sm {\n /* ... */\n}\n```\n…gets transformed into this:\n```css\n@media (min-width: 640px) {\n /* ... */\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#screen" + } + ] + }, + { + "name": "@variants", + "description": "Generate `hover`, `focus`, `active` and other **variants** of your own utilities by wrapping their definitions in the `@variants` directive:\n```css\n@variants hover, focus {\n .btn-brand {\n background-color: #3182CE;\n }\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#variants" + } + ] + } + ] +} \ No newline at end of file diff --git a/backend/communities/urls.py b/backend/communities/urls.py index ed109028e..552727a37 100644 --- a/backend/communities/urls.py +++ b/backend/communities/urls.py @@ -8,10 +8,10 @@ GroupViewSet, ) from communities.organizations.views import ( + OrganizationImageViewSet, OrganizationSocialLinkViewSet, OrganizationTextViewSet, OrganizationViewSet, - OrganizationImageViewSet, ) from communities.views import StatusViewSet diff --git a/backend/content/models.py b/backend/content/models.py index e3bd92961..d4f8cf64d 100644 --- a/backend/content/models.py +++ b/backend/content/models.py @@ -42,7 +42,7 @@ def __str__(self) -> str: class Image(models.Model): id = models.UUIDField(primary_key=True, default=uuid4, editable=False) - file_location = models.ImageField( + file_object = models.ImageField( upload_to="images/", validators=[validate_image_file_extension] ) diff --git a/backend/content/serializers.py b/backend/content/serializers.py index fae7f4ea7..6a2b01d3f 100644 --- a/backend/content/serializers.py +++ b/backend/content/serializers.py @@ -37,20 +37,20 @@ class Meta: class ImageSerializer(serializers.ModelSerializer[Image]): class Meta: model = Image - fields = ["id", "file_location", "creation_date"] + fields = ["id", "file_object", "creation_date"] read_only_fields = ["id", "creation_date"] def validate(self, data: Dict[str, Union[str, int]]) -> Dict[str, Union[str, int]]: # Remove string validation since we're getting a file object - if "file_location" not in data: + if "file_object" not in data: raise serializers.ValidationError("No file was submitted.") return data def create(self, validated_data): # Handle file upload properly - file_obj = self.context["request"].FILES.get("file_location") + file_obj = self.context["request"].FILES.get("file_object") if file_obj: - validated_data["file_location"] = file_obj + validated_data["file_object"] = file_obj # Create the image first image = super().create(validated_data) diff --git a/frontend/components/media/image-carousel/MediaImageCarousel.vue b/frontend/components/media/image-carousel/MediaImageCarousel.vue index 3199f3fc5..9424f45dc 100644 --- a/frontend/components/media/image-carousel/MediaImageCarousel.vue +++ b/frontend/components/media/image-carousel/MediaImageCarousel.vue @@ -2,18 +2,18 @@