Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "Tinkering Resources" footer link editable and attach to frontend #391

Merged
merged 18 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zubhub_backend/zubhub/zubhub/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def save_model(self, request, obj, form, change):


class HeroAdmin(admin.ModelAdmin):
list_display = ["title", "image", "activity_url", "explore_ideas_url"]
list_display = ["title", "image", "activity_url", "explore_ideas_url", "tinkering_resource_url"]
search_fields = ["title", 'description']
exclude = ["id"]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2 on 2022-04-05 03:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('zubhub', '0005_data_sanitization'),
]

operations = [
migrations.AddField(
model_name='hero',
name='tinkering_resource_url',
field=models.URLField(blank=True, max_length=1000, null=True),
),
]
1 change: 1 addition & 0 deletions zubhub_backend/zubhub/zubhub/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Hero(models.Model):
validators=[FileExtensionValidator(["","jpg", "jpeg", "jfif", "pjpeg", "pjp", "png", "svg", "webp"])])
activity_url = models.URLField(max_length=1000, blank=True, null=True)
explore_ideas_url = models.URLField(max_length=1000, blank=True, null=True)
tinkering_resource_url = models.URLField(max_length=1000, blank=True, null=True)

class Meta:
verbose_name = "Hero"
Expand Down
3 changes: 2 additions & 1 deletion zubhub_backend/zubhub/zubhub/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class Meta:
"description",
"image_url",
"activity_url",
"explore_ideas_url"
"explore_ideas_url",
"tinkering_resource_url",
]

def get_image_url(self, instance):
Expand Down
9 changes: 7 additions & 2 deletions zubhub_frontend/zubhub/src/views/PageWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ function PageWrapper(props) {

const { anchor_el, loading, open_search_form } = state;
const { t } = props;
const { zubhub } = props.projects;
const { zubhub, hero } = props.projects;

const profileMenuOpen = Boolean(anchor_el);
return (
<>
Expand Down Expand Up @@ -675,7 +676,11 @@ function PageWrapper(props) {
<a
target="__blank"
rel="noreferrer"
href="http://kriti.unstructured.studio/"
href={
hero.tinkering_resource_url
? hero.tinkering_resource_url
:'https://kriti.unstructured.studio/'
}
className={common_classes.textDecorationNone}
>
<Typography
Expand Down
4 changes: 3 additions & 1 deletion zubhub_frontend/zubhub/src/views/projects/Projects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ function Projects(props) {
href={
hero.explore_ideas_url
? hero.explore_ideas_url
: 'https://kriti.unstructured.studio/'
: hero.tinkering_resource_url
? hero.tinkering_resource_url
:'https://kriti.unstructured.studio/'
}
target="__blank"
rel="noreferrer"
Expand Down