Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e1722b8
redesigning article page
SamuelmdLow Jan 2, 2024
f8665cd
Redesigning footer
SamuelmdLow Jan 2, 2024
35e6940
Undo not working category link function
SamuelmdLow Jan 2, 2024
965e57e
Styling fixes
SamuelmdLow Jan 8, 2024
9276473
Fix latest column margin
SamuelmdLow Jan 19, 2024
4292599
Merge branch 'develop' of https://github.com/ubyssey/ubyssey.ca into …
SamuelmdLow Jan 19, 2024
583e5e4
Add funding logo to footer
SamuelmdLow Jan 19, 2024
a8f41b0
Started fixing some fw banners
SamuelmdLow Jan 22, 2024
cb927d2
Added author block at end
SamuelmdLow Jan 23, 2024
674a8c1
fix some styling on article page
SamuelmdLow May 8, 2024
093312c
Merge commit '6bbb5d78893d6b8da458edbd91088a359fc2a130' into articlep…
SamuelmdLow May 8, 2024
079147f
Added subtitle and disclaimer
SamuelmdLow May 9, 2024
32b65c6
Create staging.py
SamuelmdLow May 9, 2024
25aa49e
Update wsgi.py
SamuelmdLow May 9, 2024
0a96305
Correct some stuff with env variables
SamuelmdLow May 13, 2024
4a11c46
Add back google storage envs
SamuelmdLow May 15, 2024
d3dee71
Added alt text to images
SamuelmdLow May 16, 2024
b5802cb
Add link text to links
SamuelmdLow May 16, 2024
f2e3582
Merge branch 'develop' of https://github.com/ubyssey/ubyssey.ca into …
SamuelmdLow May 16, 2024
b82ff17
Merge branch 'articlepage-redesign' of https://github.com/ubyssey/uby…
SamuelmdLow May 17, 2024
e00e246
added redesign, removed renditions cache
SamuelmdLow May 17, 2024
0d818dc
ensured disclaimer isn't too long
SamuelmdLow May 17, 2024
d99ec11
Merge branch 'articlepage-redesign' of https://github.com/ubyssey/uby…
SamuelmdLow May 17, 2024
cf9d7cf
Merge branch 'develop' of https://github.com/ubyssey/ubyssey.ca into …
SamuelmdLow May 17, 2024
92ccf2e
Merge branch '1444-accessibility' of https://github.com/ubyssey/ubyss…
SamuelmdLow May 17, 2024
8db53ef
Made changes suggested by iman
SamuelmdLow May 18, 2024
dee6461
Merge branch 'articlepage-redesign' of https://github.com/ubyssey/uby…
SamuelmdLow May 18, 2024
5708216
Make issue text white again
SamuelmdLow May 18, 2024
51d0bed
Merge branch 'articlepage-redesign' of https://github.com/ubyssey/uby…
SamuelmdLow May 18, 2024
2de6fc2
Change disclaimer font, stop boxlabel date from wrapping
SamuelmdLow May 21, 2024
4bf5811
Merge branch 'articlepage-redesign' of https://github.com/ubyssey/uby…
SamuelmdLow May 21, 2024
9e9336c
Sorry wrong font for disclaimer!
SamuelmdLow May 21, 2024
2cbf4a7
Merge branch 'articlepage-redesign' of https://github.com/ubyssey/uby…
SamuelmdLow May 21, 2024
34d3b42
Made links blue again
SamuelmdLow May 21, 2024
41cfb7c
Merge branch 'articlepage-redesign' of https://github.com/ubyssey/uby…
SamuelmdLow May 21, 2024
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: 2 additions & 0 deletions ads/templates/ads/gpt_placement_tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
</script>
</div>
</div>
{% comment %}
{% if size == "box" %}
<a href='http://ubyssey.ca/volunteer' target="_blank">
<div class="o-hidden o-replacement o-replacement--{{ size }}{% if div_class %} o-replacement--{{ div_class }}{% endif %}" style="background-image:url({% static 'ubyssey/images/house/volunteer.jpg' %});">
</div>
</a>
{% endif %}
{% endcomment %}
</div>
2 changes: 1 addition & 1 deletion ads/templatetags/ubyssey_ad_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def inject_ads(value, is_mobile):

# Break down content into paragraphs
soup = BeautifulSoup(value, 'html.parser')
paragraphs = soup.select(".article-content > p")
paragraphs = soup.select("p:not(div > p)")

if PARAGRAPHS_PER_AD < len(paragraphs): # If the article is somehow too short for even one ad, it doesn't get any
x = range(0, len(paragraphs), PARAGRAPHS_PER_AD)
Expand Down
4 changes: 2 additions & 2 deletions archive/templates/archive/objects/article_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<div class="o-article__left">
<a class="o-article__image" href="{% pageurl article %}">
{% if article.featured_media.first.image %}
{% image article.featured_media.first.image fill-340x238-c100 format-webp %}
{% image article.featured_media.first.image fill-340x238-c100 format-webp alt=article.featured_media.first.alt_text %}
{% elif article.featured_media.first.video %}
<img src="http://img.youtube.com/vi/{{ article.featured_media.first.video.url|youtube_embed_id|safe }}/0.jpg"
alt="Thumbnail" />
alt="{{article.featured_media.first.alt_text}}" />
{% endif %}
</a>
</div>
Expand Down
18 changes: 18 additions & 0 deletions article/migrations/0024_articlepage_disclaimer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1 on 2024-05-09 00:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('article', '0023_merge_20240416_1049'),
]

operations = [
migrations.AddField(
model_name='articlepage',
name='disclaimer',
field=models.TextField(blank=True, default='', help_text="Use this format: <br>This is an opinion letter.</br> It does not reflect the opinions of The Ubyssey as a whole. You can submit an opinion <a href='ubyssey.ca/pages/submit-an-opinion'>here</a>."),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generated by Django 4.1 on 2024-05-18 00:30

from django.db import migrations, models
import images.models
import wagtail.blocks
import wagtail.documents.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
import wagtail.snippets.blocks


class Migration(migrations.Migration):

dependencies = [
('article', '0024_articlepage_disclaimer'),
]

operations = [
migrations.RemoveField(
model_name='articlepage',
name='fw_optional_subtitle',
),
migrations.AddField(
model_name='articlefeaturedmediaorderable',
name='alt_text',
field=models.TextField(blank=True, default='', help_text='For accessibility to screen reader users, enter a description of this image. Included any relevant text inside the image.'),
),
migrations.AddField(
model_name='articlepage',
name='title_tag',
field=models.CharField(blank=True, default='', help_text='This appears above the title. It mimics the title tags in the print issue.', max_length=255, verbose_name='Title Tag (Optional)'),
),
migrations.AlterField(
model_name='articlepage',
name='content',
field=wagtail.fields.StreamField([('richtext', wagtail.blocks.RichTextBlock(help_text='Write your article contents here. See documentation: https://docs.wagtail.io/en/latest/editor_manual/new_pages/creating_body_content.html#rich-text-fields', label='Rich Text Block')), ('plaintext', wagtail.blocks.TextBlock(help_text='Warning: Rich Text Blocks preferred! Plain text primarily exists for importing old Dispatch text.', label='Plain Text Block')), ('dropcap', wagtail.blocks.TextBlock(help_text='DO NOT USE - Legacy block. Create a block where special dropcap styling with be applied to the first letter and the first letter only.\n\nThe contents of this block will be enclosed in a <p class="drop-cap">...</p> element, allowing its targetting for styling.\n\nNo RichText allowed.', label='Dropcap Block', template='article/stream_blocks/dropcap.html')), ('video', wagtail.blocks.StructBlock([('video_embed', wagtail.embeds.blocks.EmbedBlock(blank=False, null=False)), ('title', wagtail.blocks.CharBlock(max_length=255, required=False)), ('caption', wagtail.blocks.CharBlock(max_length=255, required=False)), ('credit', wagtail.blocks.CharBlock(max_length=255, required=False))], help_text='Use this to credit or caption videos that will only be associated with this current article, rather than entered into our video library. You can also embed videos in a Rich Text Block.', label='Credited/Captioned One-Off Video')), ('audio', wagtail.blocks.StructBlock([('caption', wagtail.blocks.CharBlock(required=False)), ('audio', wagtail.documents.blocks.DocumentChooserBlock(help_text='Must be mp3 format', required=True))])), ('image', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('style', wagtail.blocks.ChoiceBlock(choices=[('default', 'Default'), ('left', 'Left'), ('right', 'Right')])), ('width', wagtail.blocks.ChoiceBlock(choices=[('full', 'Full'), ('small', 'Small'), ('medium', 'Medium'), ('large', 'Large')])), ('caption', wagtail.blocks.CharBlock(max_length=255, required=False)), ('credit', wagtail.blocks.CharBlock(max_length=255, required=False)), ('alt_text', wagtail.blocks.CharBlock(help_text='For accessibility to screen reader users, enter a description of this image. Included any relevant text inside the image.', max_length=255, required=False))])), ('raw_html', wagtail.blocks.RawHTMLBlock(help_text="WARNING: DO NOT use this unless you really know what you're doing!", label='Raw HTML Block')), ('quote', wagtail.blocks.StructBlock([('content', wagtail.blocks.CharBlock(required=True)), ('source', wagtail.blocks.CharBlock(required=False)), ('audio', wagtail.documents.blocks.DocumentChooserBlock(help_text='optional, must be mp3 format', required=False))])), ('gallery', wagtail.snippets.blocks.SnippetChooserBlock(target_model=images.models.GallerySnippet, template='article/stream_blocks/gallery.html')), ('header_link', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('id', wagtail.blocks.CharBlock(help_text='Intended to be shared with a page link button so that clicking the button will scroll the user to this header'))])), ('header_menu', wagtail.blocks.StructBlock([('list', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('id', wagtail.blocks.CharBlock(help_text='Intended to be shared with a header so that this button will send the user to the section of the page with said header')), ('colour', wagtail.blocks.CharBlock(default='0071c9'))], label='Page Link')))])), ('visual_essay', wagtail.blocks.StructBlock([('view', wagtail.blocks.StructBlock([('view', wagtail.blocks.ChoiceBlock(choices=[('vs-side-by-side', 'Side By Side'), ('vs-over-image', 'Text Over Image')]))])), ('content', wagtail.blocks.StreamBlock([('rich_text', wagtail.blocks.StructBlock([('block', wagtail.blocks.RichTextBlock(help_text='Write your article contents here. See documentation: https://docs.wagtail.io/en/latest/editor_manual/new_pages/creating_body_content.html#rich-text-fields', label='Rich Text Block')), ('side', wagtail.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right')]))], icon='doc-full')), ('image', wagtail.blocks.StructBlock([('block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('style', wagtail.blocks.ChoiceBlock(choices=[('default', 'Default'), ('left', 'Left'), ('right', 'Right')])), ('width', wagtail.blocks.ChoiceBlock(choices=[('full', 'Full'), ('small', 'Small'), ('medium', 'Medium'), ('large', 'Large')])), ('caption', wagtail.blocks.CharBlock(max_length=255, required=False)), ('credit', wagtail.blocks.CharBlock(max_length=255, required=False)), ('alt_text', wagtail.blocks.CharBlock(help_text='For accessibility to screen reader users, enter a description of this image. Included any relevant text inside the image.', max_length=255, required=False))])), ('side', wagtail.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right')]))], icon='image')), ('video', wagtail.blocks.StructBlock([('block', wagtail.blocks.StructBlock([('video_embed', wagtail.embeds.blocks.EmbedBlock(blank=False, null=False)), ('title', wagtail.blocks.CharBlock(max_length=255, required=False)), ('caption', wagtail.blocks.CharBlock(max_length=255, required=False)), ('credit', wagtail.blocks.CharBlock(max_length=255, required=False))], help_text='Use this to credit or caption videos that will only be associated with this current article, rather than entered into our video library. You can also embed videos in a Rich Text Block.', label='Credited/Captioned One-Off Video')), ('side', wagtail.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right')]))], icon='media')), ('audio', wagtail.blocks.StructBlock([('block', wagtail.blocks.StructBlock([('caption', wagtail.blocks.CharBlock(required=False)), ('audio', wagtail.documents.blocks.DocumentChooserBlock(help_text='Must be mp3 format', required=True))])), ('side', wagtail.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right')]))], icon='media')), ('raw_html', wagtail.blocks.StructBlock([('block', wagtail.blocks.RawHTMLBlock(help_text="WARNING: DO NOT use this unless you really know what you're doing!", label='Raw HTML Block')), ('side', wagtail.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right')]))], icon='code')), ('quote', wagtail.blocks.StructBlock([('block', wagtail.blocks.StructBlock([('content', wagtail.blocks.CharBlock(required=True)), ('source', wagtail.blocks.CharBlock(required=False)), ('audio', wagtail.documents.blocks.DocumentChooserBlock(help_text='optional, must be mp3 format', required=False))])), ('side', wagtail.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right')]))], icon='openquote')), ('header_link', wagtail.blocks.StructBlock([('block', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('id', wagtail.blocks.CharBlock(help_text='Intended to be shared with a page link button so that clicking the button will scroll the user to this header'))])), ('side', wagtail.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right')]))], icon='title')), ('gap', wagtail.blocks.StructBlock([('id', wagtail.blocks.CharBlock(required=False)), ('height', wagtail.blocks.IntegerBlock(default=0, min_value=0, required=True))])), ('switch_view', wagtail.blocks.StructBlock([('view', wagtail.blocks.ChoiceBlock(choices=[('vs-side-by-side', 'Side By Side'), ('vs-over-image', 'Text Over Image')]))]))]))]))], blank=True, null=True, use_json_field=True),
),
migrations.AlterField(
model_name='articlepage',
name='disclaimer',
field=models.TextField(blank=True, default='', help_text="Use this format: <strong>This is an opinion letter.</strong> It does not reflect the opinions of The Ubyssey as a whole. You can submit an opinion at <a href='ubyssey.ca/pages/submit-an-opinion'>ubyssey.ca/pages/submit-an-opinion</a>."),
),
]
19 changes: 19 additions & 0 deletions article/migrations/0026_alter_articlepage_disclaimer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.1 on 2024-05-18 02:34

from django.db import migrations
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('article', '0025_remove_articlepage_fw_optional_subtitle_and_more'),
]

operations = [
migrations.AlterField(
model_name='articlepage',
name='disclaimer',
field=wagtail.fields.RichTextField(blank=True, default='', help_text='Used for Opinion articles or when corrections are made'),
),
]
35 changes: 27 additions & 8 deletions article/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
)

from wagtail import blocks
from wagtail.fields import StreamField
from wagtail.fields import StreamField, RichTextField
from wagtail.models import Page, PageManager, Orderable
from wagtail.documents.models import Document
from wagtail.documents.blocks import DocumentChooserBlock
Expand Down Expand Up @@ -266,6 +266,8 @@ class ArticleFeaturedMediaOrderable(Orderable):

caption = models.TextField(blank=True, null=False, default='')
credit = models.TextField(blank=True, null=False, default='')
alt_text = models.TextField(blank=True, null=False, default='',
help_text="For accessibility to screen reader users, enter a description of this image. Included any relevant text inside the image.")
# style = models.CharField(max_length=255, blank=True, null=False, default='')
# width = models.CharField(max_length=255, blank=True, null=False, default='')
image = models.ForeignKey(
Expand Down Expand Up @@ -295,6 +297,7 @@ class ArticleFeaturedMediaOrderable(Orderable):
[
FieldPanel("caption"),
FieldPanel("credit"),
FieldPanel("alt_text"),
],
heading="Caption/Credits",
),
Expand Down Expand Up @@ -532,6 +535,13 @@ class ArticlePage(RoutablePageMixin, SectionablePage, UbysseyMenuMixin):
)
tags = ClusterTaggableManager(through='article.ArticlePageTag', blank=True)

disclaimer = RichTextField(
null=False,
blank=True,
default='',
help_text = "Used for Opinion articles or when corrections are made"
)

# template #TODO

#-----Promote panel stuff------
Expand Down Expand Up @@ -611,12 +621,12 @@ class ArticlePage(RoutablePageMixin, SectionablePage, UbysseyMenuMixin):
max_length=255,
)

fw_optional_subtitle = models.CharField(
title_tag = models.CharField(
null=False,
blank=True,
default='',
verbose_name='Subtitle (Optional)',
help_text="When there is a \"special feature\" or full-width style article, sometime we want to add a subtitle alongside the title",
verbose_name='Title Tag (Optional)',
help_text="This appears above the title. It mimics the title tags in the print issue.",
max_length=255,
)

Expand Down Expand Up @@ -750,6 +760,13 @@ def get_template(self, request):
heading="Featured Media",
classname="collapsible",
),
MultiFieldPanel(
[
FieldPanel("disclaimer")
],
heading="Disclaimer",
classname="collapsible",
),
] + UbysseyMenuMixin.menu_content_panels # content_panels

promote_panels = Page.promote_panels + [
Expand Down Expand Up @@ -838,7 +855,7 @@ def get_template(self, request):
help_text='This field is used to set variations on the \"Full-Width Story\" and similar layouts.',
),
FieldPanel('fw_alternate_title'),
FieldPanel('fw_optional_subtitle'),
FieldPanel('title_tag'),
FieldPanel('fw_above_cut_lede'),
],
heading = "Optional Header/Banner Fields",
Expand Down Expand Up @@ -1071,7 +1088,7 @@ def get_section_articles(self, order='-explicit_published_at') -> QuerySet:

return section_articles

def get_suggested(self, number_suggested=6):
def get_suggested(self, number_suggested=3):
"""
Defines the title and articles in the suggested box
"""
Expand All @@ -1081,12 +1098,14 @@ def get_suggested(self, number_suggested=6):

if self.category == None or len(category_articles) == 0:
suggested = {}
suggested['title'] = "From " + self.get_parent().title
suggested['title'] = self.get_parent().title
suggested['articles'] = section_articles[:number_suggested]
suggested['link'] = self.get_parent().url
elif len(section_articles) > 0:
suggested = {}
suggested['title'] = "From " + self.get_parent().title + " - " + self.category.title
suggested['title'] = self.category.title
suggested['articles'] = category_articles[:number_suggested]
suggested['link'] = self.category.section_page.url + "category/" + self.category.slug
else:
suggested = False

Expand Down
Loading