diff --git a/.gitignore b/.gitignore index 1254248..9c2ea03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ data -static fixtures \ No newline at end of file diff --git a/ausglamr/settings.py b/ausglamr/settings.py index 8df39b4..b8e98ab 100644 --- a/ausglamr/settings.py +++ b/ausglamr/settings.py @@ -32,7 +32,7 @@ SECRET_KEY = env("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env("DEBUG") -ALLOWED_HOSTS = ['.localhost', '127.0.0.1', '[::1]', env("DOMAIN")] +ALLOWED_HOSTS = [".localhost", "127.0.0.1", "[::1]", env("DOMAIN")] CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True CSRF_TRUSTED_ORIGINS = [f'https://{env("DOMAIN")}'] diff --git a/ausglamr/urls.py b/ausglamr/urls.py index 31123cb..c41a90b 100644 --- a/ausglamr/urls.py +++ b/ausglamr/urls.py @@ -16,13 +16,19 @@ urlpatterns = [ path("contact", views.Contact.as_view(), name="contact"), path("blogs", views.Blogs.as_view(), name="blogs"), path("blogs/", views.Blogs.as_view(), name="blog-category "), + path("blog-articles", views.Articles.as_view(), name="blog-articles"), path("events", views.Conferences.as_view(), name="events"), path("events/", views.Conferences.as_view(), name="events-category"), re_path(r"^cfps/?$", views.CallsForPapers.as_view(), name="cfps"), path("groups", views.Groups.as_view(), name="groups"), path("groups/", views.Groups.as_view(), name="group-category"), path("newsletters", views.Newsletters.as_view(), name="newsletters"), - path("newsletters/", views.Newsletters.as_view(), name="newsletters-category"), + path( + "newsletters/", + views.Newsletters.as_view(), + name="newsletters-category", + ), + path("newsletter-editions", views.Editions.as_view(), name="newsletter-editions"), path("register-blog", views.RegisterBlog.as_view(), name="register-blog"), path( "submit-blog-registration", diff --git a/blogs/admin.py b/blogs/admin.py index 1e0e5ba..3c5bb08 100644 --- a/blogs/admin.py +++ b/blogs/admin.py @@ -192,9 +192,27 @@ class Group(admin.ModelAdmin): class Newsletter(admin.ModelAdmin): """display settings for newsletters""" - list_display = ("name", "approved", "category", "description") - ordering = ["approved", "name"] - actions = [approve, unapprove] + list_display = ( + "name", + "approved", + "announced", + "failing", + "active", + ) + ordering = ["approved", "-failing"] + actions = [approve, unapprove, suspend, activate, disable] + + +@admin.register(models.Edition) +class Edition(admin.ModelAdmin): + """display settings for editions""" + + date_hierarchy = "pubdate" + list_display = ("title", "newsletter_name", "pubdate") + + def newsletter_name(self, obj): # pylint: disable=no-self-use + """get the title of the parent newsletter""" + return obj.newsletter.name @admin.register(models.ContentWarning) diff --git a/blogs/forms.py b/blogs/forms.py index 89d492b..6f82496 100644 --- a/blogs/forms.py +++ b/blogs/forms.py @@ -2,6 +2,7 @@ from django import forms from django.utils import timezone +from django.utils.translation import gettext_lazy as _ from .models import Blog, CallForPapers, Event, Group, Newsletter, Subscriber @@ -82,6 +83,10 @@ class RegisterCallForPapersForm(forms.ModelForm): "closing_date": DateInput(), } + help_texts = { + "name": _("'Call for papers', 'Call for participation' etc"), + } + class RegisterGroupForm(forms.ModelForm): """form for registering a group""" @@ -113,11 +118,18 @@ class RegisterNewsletterForm(forms.ModelForm): "author", "category", "url", + "feed", "description", "activitypub_account_name", "contact_email", ] + help_texts = { + "feed": _( + "The Atom/RSS feed of your newsletter. If you include this, issues will be shown in AusGLAMR" + ), + } + class ContactForm(forms.Form): """form for contacting site admin""" diff --git a/blogs/management/commands/check_feeds.py b/blogs/management/commands/check_feeds.py index b2b3c0c..3686f19 100644 --- a/blogs/management/commands/check_feeds.py +++ b/blogs/management/commands/check_feeds.py @@ -9,10 +9,13 @@ import feedparser from django.core.management.base import BaseCommand from django.db.models import Q +from django.utils import html from django.utils import timezone as django_timezone from blogs import models +agent = "AusGLAMR/1.0 +https://ausglamr.newcardigan.org" + def date_to_tz_aware(date_tuple): """turn a 9-tuple into something usable""" @@ -58,11 +61,11 @@ class Command(BaseCommand): ).all() for blog in blogs: try: - data = feedparser.parse(blog.feed) + data = feedparser.parse(blog.feed, agent=agent) for article in data.entries: if not models.Article.objects.filter( - Q(url=article.link) | Q(guid=article.id) + Q(url=article.link) | Q(guid=getattr(article, "id", article.link)) ).exists(): if blog.suspension_lifted and ( blog.suspension_lifted @@ -102,15 +105,30 @@ class Command(BaseCommand): blog, "author", None ) + description = ( + html.strip_tags(article.summary) + if ( + hasattr(article, "summary") + and len(article.summary) > 0 + ) + else html.strip_tags(article.description) + if ( + hasattr(article, "description") + and len(article.summary) + ) + else html.strip_tags(article.content[0].value)[:200] + ) + description += "..." + instance = models.Article.objects.create( title=article.title, author_name=author_name, url=article.link, - description=article.summary, + description=description, updateddate=date_to_tz_aware(article.updated_parsed), blog=blog, pubdate=date_to_tz_aware(article.published_parsed), - guid=article.id, + guid=getattr(article, "id", article.link), ) tags_to_add = get_tags( @@ -135,6 +153,64 @@ class Command(BaseCommand): except Exception as e: blog.set_failing() logging.error(f"ERROR WITH BLOG {blog.title} - {blog.url}") + logging.info(article) + logging.error(e) + + newsletters = models.Newsletter.objects.filter( + approved=True, active=True, feed__isnull=False + ).all() + for newsletter in newsletters: + try: + data = feedparser.parse(newsletter.feed, agent=agent) + + for edition in data.entries: + if not models.Edition.objects.filter( + Q(url=edition.link) | Q(guid=getattr(edition, "id", edition.link)) + ).exists(): + author_name = getattr(edition, "author", None) or getattr( + blog, "author", None + ) + + description = ( + html.strip_tags(edition.summary) + if ( + hasattr(edition, "summary") and len(edition.summary) + ) + else html.strip_tags(edition.description) + if ( + hasattr(edition, "description") and len(edition.summary) + ) + else html.strip_tags(edition.content[0].value)[:200] + "..." + ) + description += "..." + + instance = models.Edition.objects.create( + title=edition.title, + author_name=author_name, + url=edition.link, + description=description, + updateddate=date_to_tz_aware(edition.updated_parsed), + newsletter=newsletter, + pubdate=date_to_tz_aware(edition.published_parsed), + guid=getattr(edition, "id", edition.link), + ) + + instance.save() + + cutoff = django_timezone.now() - timedelta(days=3) + newish = instance.pubdate > cutoff + if newish: + instance.announce() + + newsletter.set_success( + updateddate=date_to_tz_aware(edition.updated_parsed) + ) + + except Exception as e: + newsletter.set_failing() + logging.error( + f"ERROR WITH NEWSLETTER {newsletter.name} - {newsletter.url}" + ) logging.error(e) if not options["q"]: diff --git a/blogs/migrations/0001_initial.py b/blogs/migrations/0001_initial.py index 6fb129b..b08e1d3 100644 --- a/blogs/migrations/0001_initial.py +++ b/blogs/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.7 on 2024-01-07 04:55 +# Generated by Django 4.2.7 on 2024-01-21 04:31 import blogs.models.blog from django.db import migrations, models @@ -43,7 +43,10 @@ class Migration(migrations.Migration): ), ), ("title", models.CharField(max_length=2000)), - ("author_name", models.CharField(max_length=1000, null=True)), + ( + "author_name", + models.CharField(blank=True, max_length=1000, null=True), + ), ("url", models.URLField(max_length=2000, unique=True)), ("description", models.TextField(blank=True, null=True)), ("updateddate", models.DateTimeField()), @@ -63,6 +66,7 @@ class Migration(migrations.Migration): max_length=4, ), ), + ("added", models.DateTimeField(default=django.utils.timezone.now)), ("approved", models.BooleanField(default=False)), ("announced", models.BooleanField(default=False)), ("failing", models.BooleanField(blank=True, default=False, null=True)), @@ -118,7 +122,7 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("name", models.CharField(max_length=999)), + ("name", models.CharField(max_length=100)), ( "category", models.CharField( @@ -135,7 +139,10 @@ class Migration(migrations.Migration): ), ), ("url", models.URLField(max_length=400, unique=True)), - ("description", models.TextField(blank=True, null=True)), + ( + "description", + models.TextField(blank=True, max_length=250, null=True), + ), ("pub_date", models.DateTimeField()), ("start_date", models.DateField()), ( @@ -165,7 +172,7 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("name", models.CharField(max_length=999)), + ("name", models.CharField(max_length=100)), ( "category", models.CharField( @@ -202,7 +209,10 @@ class Migration(migrations.Migration): ), ("url", models.URLField(max_length=400, unique=True)), ("registration_url", models.URLField(max_length=400, unique=True)), - ("description", models.TextField(blank=True, null=True)), + ( + "description", + models.TextField(blank=True, max_length=250, null=True), + ), ( "contact_email", models.EmailField(blank=True, max_length=254, null=True), @@ -224,8 +234,8 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("name", models.CharField(max_length=999)), - ("author", models.CharField(max_length=999)), + ("name", models.CharField(max_length=100)), + ("author", models.CharField(max_length=100)), ( "category", models.CharField( @@ -242,7 +252,16 @@ class Migration(migrations.Migration): ), ), ("url", models.URLField(max_length=400, unique=True)), - ("description", models.TextField(blank=True, null=True)), + ( + "feed", + models.URLField( + blank=True, max_length=1000, null=True, unique=True + ), + ), + ( + "description", + models.TextField(blank=True, max_length=250, null=True), + ), ( "activitypub_account_name", models.CharField(blank=True, max_length=200, null=True), @@ -253,6 +272,9 @@ class Migration(migrations.Migration): ), ("announced", models.BooleanField(default=False)), ("approved", models.BooleanField(default=False)), + ("active", models.BooleanField(default=True, null=True)), + ("failing", models.BooleanField(blank=True, default=False, null=True)), + ("updateddate", models.DateTimeField()), ("pub_date", models.DateTimeField(default=None, null=True)), ], ), @@ -308,6 +330,38 @@ class Migration(migrations.Migration): ("name", models.CharField(max_length=100, unique=True)), ], ), + migrations.CreateModel( + name="Edition", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=2000)), + ( + "author_name", + models.CharField(blank=True, max_length=1000, null=True), + ), + ("url", models.URLField(max_length=2000, unique=True)), + ("description", models.TextField(blank=True, null=True)), + ("updateddate", models.DateTimeField()), + ("pubdate", models.DateTimeField()), + ("guid", models.CharField(max_length=2000)), + ( + "newsletter", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="editions", + to="blogs.newsletter", + ), + ), + ], + ), migrations.CreateModel( name="CallForPapers", fields=[ @@ -320,8 +374,8 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("name", models.CharField(max_length=999)), - ("details", models.TextField(blank=True, null=True)), + ("name", models.CharField(max_length=100)), + ("details", models.TextField(blank=True, max_length=250, null=True)), ("pub_date", models.DateTimeField(default=None, null=True)), ("opening_date", models.DateField()), ("closing_date", models.DateField()), @@ -350,7 +404,10 @@ class Migration(migrations.Migration): ), ), ("title", models.CharField(max_length=2000)), - ("author_name", models.CharField(max_length=1000, null=True)), + ( + "author_name", + models.CharField(blank=True, max_length=1000, null=True), + ), ("url", models.URLField(max_length=2000, unique=True)), ("description", models.TextField(blank=True, null=True)), ("updateddate", models.DateTimeField()), diff --git a/blogs/models/__init__.py b/blogs/models/__init__.py index 00db077..95fa488 100644 --- a/blogs/models/__init__.py +++ b/blogs/models/__init__.py @@ -3,6 +3,6 @@ from .blog import Article, Blog, Tag from .event import Event, CallForPapers from .group import Group -from .newsletter import Newsletter +from .newsletter import Newsletter, Edition from .utils import Announcement, Category, ContentWarning, SiteMessage from .subscriber import Subscriber diff --git a/blogs/models/blog.py b/blogs/models/blog.py index ab3e139..3100f21 100644 --- a/blogs/models/blog.py +++ b/blogs/models/blog.py @@ -55,7 +55,7 @@ class Blog(BlogData): feed = models.URLField(max_length=2000) category = models.CharField(choices=Category.choices, max_length=4) - added = models.DateTimeField() + added = models.DateTimeField(default=timezone.now) approved = models.BooleanField(default=False) announced = models.BooleanField(default=False) failing = models.BooleanField(default=False, blank=True, null=True) @@ -67,11 +67,6 @@ class Blog(BlogData): ) contact_email = models.EmailField(blank=True, null=True) - def save(self, *args, **kwargs): - if not self.added: - self.added = timezone.now() - super().save(*args, **kwargs) - def announce(self): """queue announcement""" @@ -114,7 +109,7 @@ class Article(BlogData): blog = models.ForeignKey(Blog, on_delete=models.CASCADE, related_name="articles") pubdate = models.DateTimeField() guid = models.CharField(max_length=2000) - tags = models.ManyToManyField("Tag", related_name="articles", null=True, blank=True) + tags = models.ManyToManyField("Tag", related_name="articles") # pylint: disable=undefined-variable def announce(self): diff --git a/blogs/models/newsletter.py b/blogs/models/newsletter.py index 2e20b8c..47f68ec 100644 --- a/blogs/models/newsletter.py +++ b/blogs/models/newsletter.py @@ -13,12 +13,17 @@ class Newsletter(models.Model): author = models.CharField(max_length=100) category = models.CharField(choices=Category.choices, max_length=4) url = models.URLField(max_length=400, unique=True) - + feed = models.URLField(max_length=1000, unique=True, blank=True, null=True) description = models.TextField(null=True, blank=True, max_length=250) activitypub_account_name = models.CharField(max_length=200, blank=True, null=True) contact_email = models.EmailField(blank=True, null=True) + announced = models.BooleanField(default=False) approved = models.BooleanField(default=False) + active = models.BooleanField(null=True, default=True) + failing = models.BooleanField(default=False, blank=True, null=True) + + updateddate = models.DateTimeField() pub_date = models.DateTimeField(null=True, default=None) def announce(self): @@ -36,6 +41,38 @@ class Newsletter(models.Model): super().save() def save(self, *args, **kwargs): - if not self.pub_date: - self.pub_date = timezone.now() + if not self.updateddate: + self.updateddate = timezone.now() super().save(*args, **kwargs) + + def set_failing(self): + """set the newsletter feed as failing""" + + self.failing = True + super().save() + + def set_success(self, updateddate): + """ + set failing to false + set the updateddate to a datetime + + """ + + self.failing = False + self.updateddate = updateddate + super().save() + + +class Edition(models.Model): + """A newsletter edition""" + + title = models.CharField(max_length=2000) + author_name = models.CharField(max_length=1000, null=True, blank=True) + url = models.URLField(max_length=2000, unique=True) + description = models.TextField(null=True, blank=True) + updateddate = models.DateTimeField() + newsletter = models.ForeignKey( + Newsletter, on_delete=models.CASCADE, related_name="editions" + ) + pubdate = models.DateTimeField() + guid = models.CharField(max_length=2000) diff --git a/blogs/static/css/custom.css b/blogs/static/css/custom.css new file mode 100644 index 0000000..0c0fbd3 --- /dev/null +++ b/blogs/static/css/custom.css @@ -0,0 +1,857 @@ +/* Fonts +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +@font-face { + font-family: "Source Sans Pro"; + src: url("../fonts/source-sans-pro/SourceSansPro-Regular.otf") format("opentype"); + } + @font-face { + font-family: "Helsinki"; + src: url("../fonts/helsinki/helsinki.ttf") format("opentype"); + } + +html { + font-size: 62.5%; } + +body { +font-size: 2em; +line-height: 1.6; +font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; +color: #222; } + +a { + color: #ff748c; +} + +.page-title { + color: #000; + text-shadow: -2px -2px #eee; + font-variant-caps: small-caps; +} + +@media (prefers-color-scheme: dark) { + body { + color: #ccc; + background-color: #333; + } + + a { + text-decoration-line:underline; + text-decoration-color: hsla(349.6,100%,72.7%, 0.5); + text-decoration-style: solid; + text-decoration-thickness: 2px; + color: #ccc; + } + + a:hover { + color: hsla(349.6,100%,72.7%, 0.5); + } + + .page-title { + color: #ccc; + text-shadow: none; + } + + code { + background-color: transparent; + font-family: monospace; + border: none; + font-size: large; + font-style: italic; + } +} + + +/* Sections +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +body { + display: flex; + flex-direction: column; +} + +header { + height: 100%; + min-height: 10vh; + background-color: lightpink; + font-family: "Helsinki", Helvetica, Arial, sans-serif; + padding-top: 3rem; + margin-bottom: 2rem; +} + +header, +header a { + text-decoration: none; + color: black; + text-shadow: 1px 1px #fff; +} + +header a:hover { + color: #fff; + text-shadow: 1px 1px black; +} + +header a h1 { + text-shadow: 2px 2px #fff; +} + +header a:hover h1 { + text-shadow: 2px 2px black; +} + +main { + flex: auto; + min-height: 80vh; +} + +footer { + margin-top: 4em; + padding: 3rem; + font-size: 1.75rem; + min-height: 4.5rem; + background-color: #eee; +} + +footer a { + color: #ff748c; +} + +footer p { + text-align: right; +} + +footer .left p { + text-align: left; + font-style: italic; +} + +@media screen and (max-width: 80rem) { + footer .left p { + text-align: right; + font-style: italic; + } +} + +.trending { + margin-top: 4em; +} + +.help h4 { + display: inline-block; +} + +.help h4 + a { + font-size: 14px; + text-decoration: none; + margin-left: 1rem; + position: relative; + top: -1rem; +} + + +@media (prefers-color-scheme: dark) { + header { + background-color: hsla(349.6,100%,72.7%, 0.5); + } + + header, + header a { + color: #ccc; + text-shadow: 1px 1px #000; + } + + header a:hover { + color: #000; + text-shadow: 1px 1px #ccc; + } + + header a h1 { + text-shadow: 2px 2px #000; + } + + header a:hover h1 { + text-shadow: 2px 2px #ccc; + } + + footer { + color: #ccc; + background-color: #111; + } + + footer a { + color: hsla(349.6,100%,72.7%, 0.5); + } + +} +/* Subscribe and contribute +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.pop-boxes { + max-width: 1200px; +} + +.subscribe { + display: grid; + align-items: start; + column-gap: 2rem; + grid-template-columns: 33% 33% 33%; +} + +.subscribe .pop, +.contribute .pop { + min-height: 48rem; +} + +.contribute { + display: grid; + align-items: start; + column-gap: 2rem; + grid-template-columns: 33% 33% 33%; +} + +/* .contribute .pop { + min-height: 28rem; +} */ + +.pop { + margin-top: 2em; + border: 1px solid #999; + padding: 2em; + border-radius: 5px; + box-shadow: 10px 10px 10px #bbb; +} + +@media screen and (max-width: 90rem) { + + .subscribe, + .contribute { + grid-template-columns: 50% 50%; + } + + .subscribe .pop { + min-height: 34rem; + } + + .contribute .pop { + min-height: 30rem; + } + +} + +@media screen and (max-width: 75rem) { + + .subscribe, + .contribute { + grid-template-columns: auto; + } + + .contribute .pop, + .subscribe .pop { + min-height: 0; + } + +} + +@media (prefers-color-scheme: dark) { + .pop { + border: 1px solid #bbb; + box-shadow: 5px 5px 5px #999; + } +} + +/* Card +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.card { + background-color: transparent; + border-radius: 4px; + border: 1px solid #000; + box-shadow: 10px 10px 10px #bbb; + margin: 3rem auto; + padding: 20px; +} + +.card-body { + margin: 1em auto; + font-size: small; +} + +.card a, +.card a h3 { + text-decoration-color: lightpink; + text-decoration-thickness: 3px; + color: black; +} + +.card .blog_title, +.card .author_name { + font-style: italic; + color: #999; +} + +.card .author_name { + font-style: normal; +} + +.meta div { + margin: 0; +} + +@media (prefers-color-scheme: dark) { + .card { + background-color: transparent; + border: 1px solid #bbb; + box-shadow: 5px 5px 5px #999; + + } + + .card a, + .card a h3 { + text-decoration-color: hsla(349.6,100%,72.7%, 0.5); + color: #bbb; + } + + .card .blog_title, + .card .author_name { + color: #999; + } +} + +/* Badge +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.badge { + display: inline-block; + height: 24px; + padding: 2px 5px; + color: #3a3a3a; + text-align: center; + font-size: 1.25rem; + font-weight: 400; + line-height: 20px; + letter-spacing: .1rem; + text-transform: uppercase; + text-decoration: none; + white-space: nowrap; + background-color: transparent; + border-radius: 4px; + border: 1px solid #aaa; + cursor: pointer; + box-sizing: border-box; +} + +.badge a { + text-decoration: none; + color: #3a3a3a; +} + +.trending .badge { + font-size: 1.5rem; + padding: 0 10px; + margin: 0.5rem; +} + +.badge_GAL { + color: #fff; + border-color: #0d799b; + background-color: #0d799b; +} + +.badge_LIB { + color: #fff; + border-color: #8e0574; + background-color: #8e0574; +} + +.badge_ARC{ + color: #fff; + border-color: #32761b; + background-color: #32761b; +} + +.badge_MUS { + color: #fff; + border-color: #9b4d5f; + background-color: #9b4d5f; +} + +.badge_REC { + color: #fff; + border-color: #7252a0; + background-color: #7252a0; +} + +.badge_DH { + color: #fff; + border-color: #685ef5; + background-color: #685ef5; +} + +.badge_GLAM { + color: #fff; + border-color: #db2096; + background-color: #db2096; +} + +[class*="badge_"] a { + color: #fff; +} + +@media (prefers-color-scheme: dark) { + + .badge { + color: #ccc + } + + .badge_LIB { + border-color: #b9712d; + background-color: #b9712d; + } + + [class*="badge_"], + [class*="badge_"] a { + color: #000; + } +} +/* Menu +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.menu-item { + display: inline-block; + padding: 10px; + text-align: center; + font-size: 14px; + font-weight: 400; + letter-spacing: .1rem; + text-transform: uppercase; + text-decoration: none; + white-space: nowrap; + cursor: pointer; + box-sizing: border-box; +} + +.core-menu { + background-color: #eee; +} + +.core-menu a:hover { + color: black; + text-shadow: 1px 1px lightpink; +} + +@media (prefers-color-scheme: dark) { + .core-menu { + background-color: #999; + } + + .core-menu a { + /* color: #333; */ + color: #000; + text-shadow: none; + } + + .core-menu a:hover { + color: #ccc; + text-shadow: 1px 1px #333; + } +} + +/* Button +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.buttons { + margin-bottom: 4rem; +} + +.button.button, +button.button, +input[type="submit"].button, +input[type="reset"].button, +input[type="button"].button { + color: #000; + border-color: #222; +} + +.button.button-primary, +button.button-primary, +input[type="submit"].button-primary, +input[type="reset"].button-primary, +input[type="button"].button-primary { + color: #FFF; + background-color: #222; + border-color: #222; + } + +.button.button-primary:hover, +button.button-primary:hover, +input[type="submit"].button-primary:hover, +input[type="reset"].button-primary:hover, +input[type="button"].button-primary:hover, +.button.button-primary:focus, +button.button-primary:focus, +input[type="submit"].button-primary:focus, +input[type="reset"].button-primary:focus, +input[type="button"].button-primary:focus { + color: #000; + background-color: lightpink; + border-color: #222; +} + +.button.button:hover, +button.button:hover, +input[type="submit"].button:hover, +input[type="reset"].button:hover, +input[type="button"].button:hover, +.button.button:focus, +button.button:focus, +input[type="submit"].button:focus, +input[type="reset"].button:focus, +input[type="button"].button:focus { + color: #FFF; + background-color: #222; + border-color: #222; +} + +.button-first { + margin-right: 1em; +} + +@media (prefers-color-scheme: dark) { + + .button.button, + button.button, + input[type="submit"].button, + input[type="reset"].button, + input[type="button"].button { + color: #ddd; + border-color: #ddd; + } + + .button.button-primary, + button.button-primary, + input[type="submit"].button-primary, + input[type="reset"].button-primary, + input[type="button"].button-primary { + color: #333; + background-color: #ddd; + border-color: #ddd; + } + + .button.button-primary:hover, + button.button-primary:hover, + input[type="submit"].button-primary:hover, + input[type="reset"].button-primary:hover, + input[type="button"].button-primary:hover, + .button.button-primary:focus, + button.button-primary:focus, + input[type="submit"].button-primary:focus, + input[type="reset"].button-primary:focus, + input[type="button"].button-primary:focus { + color: #333; + background-color: hsla(349.6,100%,72.7%, 0.5); + border-color: #ddd; + } + + .button.button:hover, + button.button:hover, + input[type="submit"].button:hover, + input[type="reset"].button:hover, + input[type="button"].button:hover, + .button.button:focus, + button.button:focus, + input[type="submit"].button:focus, + input[type="reset"].button:focus, + input[type="button"].button:focus { + color: #333; + background-color: #ddd; + border-color: #ddd; + } +} + +/* Forms +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +input[type="text"], +input[type="url"], +input[type="email"] { + width: 100%; + box-sizing: border-box; +} + +label:has(+ input[required=""])::after, +label:has(+ select[required=""])::after { + content: "*"; + color: red; +} + +.hint { + color: #999; + font-style: italic; +} + +@media (prefers-color-scheme: dark) { + input[type="email"], + input[type="number"], + input[type="search"], + input[type="text"], + input[type="tel"], + input[type="url"], + input[type="date"], + input[type="password"], + textarea, + select { + background-color: transparent; + color: #bbb; + } + + input::placeholder { + color: #888; + } +} + +/* Alerts +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.alert { + border: 2px solid #000; + border-radius: 5px; + padding: 0.5em; + text-align: center; + margin-bottom: 2em; +} + +.alert p { + margin: 0; +} + +.success { + border-color: green; + background-color: rgb(175, 228, 175); + color: #000; +} + +.failure { + border-color: red; + background-color: rgb(238, 199, 200); + color: #000; +} + +.info { + border-color: orange; + background-color: lightgoldenrodyellow; + color: #000; +} + +.errorlist { + list-style: none; + color: red; + margin-left: 1rem; + margin-bottom: -1rem; +} + +@media (prefers-color-scheme: dark) { + .success { + border-color: green; + background-color: rgb(117, 157, 117); + color: #000; + } + + .failure { + border-color: rgb(58, 31, 31); + background-color: rgb(134, 105, 106); + color: #000; + } + + .info { + border-color: darkorange; + background-color: orange; + } + + .errorlist { + color: rgb(134, 105, 106); + } +} + +/* Tables +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.table-description { + min-width: 33%; + max-width: 50%; +} + +.table-date { + width:8em; +} + + + +/* Grids +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.listing { + display: grid; + align-items: start; + column-gap: 4rem; +} + +.listing.header { + font-weight: bold; + margin-bottom: 2em; +} + +.l-two { + grid-template-columns: 80% 20%; +} + + +.l-three { + grid-template-columns: 60% 15% 25%; +} + +.l-four { + grid-template-columns: 40% 20% 20% 20%; +} + +.listing + hr { + margin-top: 1rem; + margin-bottom: 1.5rem; +} + +@media screen and (max-width: 60rem) { + + .listing.header { + display: none; + } + + .start-date::before { + content: "Starts: "; + font-weight: bold; + } + + .closing-date::before { + content: "Closes: "; + font-weight: bold; + } + + .l-two, + .l-three, + .l-four { + grid-template-columns: auto; + } + +} + +/* Pagination +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.pagination { + text-align: center; +} + +.inactive { + color: #999; +} + +/* utils +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.svg * { + max-width: 20px; + max-height: 20px; + fill: #222; + margin-left: 1rem; + } + +svg *:hover { + fill: lightpink; + } + +@media (prefers-color-scheme: dark) { + .svg * { + fill: hsla(349.6,100%,72.7%, 0.5); +} + +svg *:hover { + fill: #ddd; + } +} + +.helptext { + margin-left: 2rem; + font-style: italic; +} + +.helptext + label { + margin-top: 2.5rem; +} +/* Loading spinner +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +.lds-text { + margin: auto; + padding-top: 80px; + text-align: center; + color: #999; + font-style: italic; +} + +.lds-heart { + display: inline-block; + position: fixed; + margin-left: auto; + margin-right: auto; + margin-bottom: calc(50vh - 40px); + left: 0; + right: 0; + text-align: center; + width: 80px; + height: 80px; + transform: rotate(45deg); + transform-origin: 40px 40px; + } + .lds-heart div { + top: 32px; + left: 32px; + position: absolute; + width: 32px; + height: 32px; + background: lightpink; + animation: lds-heart 1.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1); + } + .lds-heart div:after, + .lds-heart div:before { + content: " "; + position: absolute; + display: block; + width: 32px; + height: 32px; + background: lightpink; + } + .lds-heart div:before { + left: -24px; + border-radius: 50% 0 0 50%; + } + .lds-heart div:after { + top: -24px; + border-radius: 50% 50% 0 0; + } + @keyframes lds-heart { + 0% { + transform: scale(0.95); + } + 5% { + transform: scale(1.1); + } + 39% { + transform: scale(0.85); + } + 45% { + transform: scale(1); + } + 60% { + transform: scale(0.95); + } + 100% { + transform: scale(0.9); + } + } diff --git a/blogs/static/css/normalize.css b/blogs/static/css/normalize.css new file mode 100644 index 0000000..81c6f31 --- /dev/null +++ b/blogs/static/css/normalize.css @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} \ No newline at end of file diff --git a/blogs/static/css/skeleton.css b/blogs/static/css/skeleton.css new file mode 100644 index 0000000..e026fd5 --- /dev/null +++ b/blogs/static/css/skeleton.css @@ -0,0 +1,418 @@ +/* +* Skeleton V2.0.4 +* Copyright 2014, Dave Gamache +* www.getskeleton.com +* Free to use under the MIT license. +* http://www.opensource.org/licenses/mit-license.php +* 12/29/2014 +*/ + + +/* Table of contents +–––––––––––––––––––––––––––––––––––––––––––––––––– +- Grid +- Base Styles +- Typography +- Links +- Buttons +- Forms +- Lists +- Code +- Tables +- Spacing +- Utilities +- Clearing +- Media Queries +*/ + + +/* Grid +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.container { + position: relative; + width: 100%; + max-width: 960px; + margin: 0 auto; + padding: 0 20px; + box-sizing: border-box; } +.column, +.columns { + width: 100%; + float: left; + box-sizing: border-box; } + +/* For devices larger than 400px */ +@media (min-width: 400px) { + .container { + width: 85%; + padding: 0; } +} + +/* For devices larger than 550px */ +@media (min-width: 550px) { + .container { + width: 80%; } + .column, + .columns { + margin-left: 4%; } + .column:first-child, + .columns:first-child { + margin-left: 0; } + + .one.column, + .one.columns { width: 4.66666666667%; } + .two.columns { width: 13.3333333333%; } + .three.columns { width: 22%; } + .four.columns { width: 30.6666666667%; } + .five.columns { width: 39.3333333333%; } + .six.columns { width: 48%; } + .seven.columns { width: 56.6666666667%; } + .eight.columns { width: 65.3333333333%; } + .nine.columns { width: 74.0%; } + .ten.columns { width: 82.6666666667%; } + .eleven.columns { width: 91.3333333333%; } + .twelve.columns { width: 100%; margin-left: 0; } + + .one-third.column { width: 30.6666666667%; } + .two-thirds.column { width: 65.3333333333%; } + + .one-half.column { width: 48%; } + + /* Offsets */ + .offset-by-one.column, + .offset-by-one.columns { margin-left: 8.66666666667%; } + .offset-by-two.column, + .offset-by-two.columns { margin-left: 17.3333333333%; } + .offset-by-three.column, + .offset-by-three.columns { margin-left: 26%; } + .offset-by-four.column, + .offset-by-four.columns { margin-left: 34.6666666667%; } + .offset-by-five.column, + .offset-by-five.columns { margin-left: 43.3333333333%; } + .offset-by-six.column, + .offset-by-six.columns { margin-left: 52%; } + .offset-by-seven.column, + .offset-by-seven.columns { margin-left: 60.6666666667%; } + .offset-by-eight.column, + .offset-by-eight.columns { margin-left: 69.3333333333%; } + .offset-by-nine.column, + .offset-by-nine.columns { margin-left: 78.0%; } + .offset-by-ten.column, + .offset-by-ten.columns { margin-left: 86.6666666667%; } + .offset-by-eleven.column, + .offset-by-eleven.columns { margin-left: 95.3333333333%; } + + .offset-by-one-third.column, + .offset-by-one-third.columns { margin-left: 34.6666666667%; } + .offset-by-two-thirds.column, + .offset-by-two-thirds.columns { margin-left: 69.3333333333%; } + + .offset-by-one-half.column, + .offset-by-one-half.columns { margin-left: 52%; } + +} + + +/* Base Styles +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +/* NOTE +html is set to 62.5% so that all the REM measurements throughout Skeleton +are based on 10px sizing. So basically 1.5rem = 15px :) */ +html { + font-size: 62.5%; } +body { + font-size: 1.5em; + line-height: 1.6; + font-weight: 400; + font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #222; } + + +/* Typography +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +h1, h2, h3, h4, h5, h6 { + margin-top: 0; + margin-bottom: 2rem; + font-weight: 300; } +h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;} +h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; } +h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; } +h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; } +h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; } +h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; } + +/* Larger than phablet */ +@media (min-width: 550px) { + h1 { font-size: 5.0rem; } + h2 { font-size: 4.2rem; } + h3 { font-size: 3.6rem; } + h4 { font-size: 3.0rem; } + h5 { font-size: 2.4rem; } + h6 { font-size: 1.5rem; } +} + +p { + margin-top: 0; } + + +/* Links +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +a { + color: #1EAEDB; } +a:hover { + color: #0FA0CE; } + + +/* Buttons +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.button, +button, +input[type="submit"], +input[type="reset"], +input[type="button"] { + display: inline-block; + height: 38px; + padding: 0 30px; + color: #555; + text-align: center; + font-size: 11px; + font-weight: 600; + line-height: 38px; + letter-spacing: .1rem; + text-transform: uppercase; + text-decoration: none; + white-space: nowrap; + background-color: transparent; + border-radius: 4px; + border: 1px solid #bbb; + cursor: pointer; + box-sizing: border-box; } +.button:hover, +button:hover, +input[type="submit"]:hover, +input[type="reset"]:hover, +input[type="button"]:hover, +.button:focus, +button:focus, +input[type="submit"]:focus, +input[type="reset"]:focus, +input[type="button"]:focus { + color: #333; + border-color: #888; + outline: 0; } +.button.button-primary, +button.button-primary, +input[type="submit"].button-primary, +input[type="reset"].button-primary, +input[type="button"].button-primary { + color: #FFF; + background-color: #33C3F0; + border-color: #33C3F0; } +.button.button-primary:hover, +button.button-primary:hover, +input[type="submit"].button-primary:hover, +input[type="reset"].button-primary:hover, +input[type="button"].button-primary:hover, +.button.button-primary:focus, +button.button-primary:focus, +input[type="submit"].button-primary:focus, +input[type="reset"].button-primary:focus, +input[type="button"].button-primary:focus { + color: #FFF; + background-color: #1EAEDB; + border-color: #1EAEDB; } + + +/* Forms +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea, +select { + height: 38px; + padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ + background-color: #fff; + border: 1px solid #D1D1D1; + border-radius: 4px; + box-shadow: none; + box-sizing: border-box; } +/* Removes awkward default styles on some inputs for iOS */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; } +textarea { + min-height: 65px; + padding-top: 6px; + padding-bottom: 6px; } +input[type="email"]:focus, +input[type="number"]:focus, +input[type="search"]:focus, +input[type="text"]:focus, +input[type="tel"]:focus, +input[type="url"]:focus, +input[type="password"]:focus, +textarea:focus, +select:focus { + border: 1px solid #33C3F0; + outline: 0; } +label, +legend { + display: block; + margin-bottom: .5rem; + font-weight: 600; } +fieldset { + padding: 0; + border-width: 0; } +input[type="checkbox"], +input[type="radio"] { + display: inline; } +label > .label-body { + display: inline-block; + margin-left: .5rem; + font-weight: normal; } + + +/* Lists +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +ul { + list-style: circle inside; } +ol { + list-style: decimal inside; } +ol, ul { + padding-left: 0; + margin-top: 0; } +ul ul, +ul ol, +ol ol, +ol ul { + margin: 1.5rem 0 1.5rem 3rem; + font-size: 90%; } +li { + margin-bottom: 1rem; } + + +/* Code +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +code { + padding: .2rem .5rem; + margin: 0 .2rem; + font-size: 90%; + white-space: nowrap; + background: #F1F1F1; + border: 1px solid #E1E1E1; + border-radius: 4px; } +pre > code { + display: block; + padding: 1rem 1.5rem; + white-space: pre; } + + +/* Tables +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +th, +td { + padding: 12px 15px; + text-align: left; + border-bottom: 1px solid #E1E1E1; } +th:first-child, +td:first-child { + padding-left: 0; } +th:last-child, +td:last-child { + padding-right: 0; } + + +/* Spacing +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +button, +.button { + margin-bottom: 1rem; } +input, +textarea, +select, +fieldset { + margin-bottom: 1.5rem; } +pre, +blockquote, +dl, +figure, +table, +p, +ul, +ol, +form { + margin-bottom: 2.5rem; } + + +/* Utilities +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.u-full-width { + width: 100%; + box-sizing: border-box; } +.u-max-full-width { + max-width: 100%; + box-sizing: border-box; } +.u-pull-right { + float: right; } +.u-pull-left { + float: left; } + + +/* Misc +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +hr { + margin-top: 3rem; + margin-bottom: 3.5rem; + border-width: 0; + border-top: 1px solid #E1E1E1; } + + +/* Clearing +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +/* Self Clearing Goodness */ +.container:after, +.row:after, +.u-cf { + content: ""; + display: table; + clear: both; } + + +/* Media Queries +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +/* +Note: The best way to structure the use of media queries is to create the queries +near the relevant code. For example, if you wanted to change the styles for buttons +on small devices, paste the mobile query code up in the buttons section and style it +there. +*/ + + +/* Larger than mobile */ +@media (min-width: 400px) {} + +/* Larger than phablet (also point when grid becomes active) */ +@media (min-width: 550px) {} + +/* Larger than tablet */ +@media (min-width: 750px) {} + +/* Larger than desktop */ +@media (min-width: 1000px) {} + +/* Larger than Desktop HD */ +@media (min-width: 1200px) {} diff --git a/blogs/static/fonts/helsinki/Vic Fieger License.txt b/blogs/static/fonts/helsinki/Vic Fieger License.txt new file mode 100755 index 0000000..bd8b712 --- /dev/null +++ b/blogs/static/fonts/helsinki/Vic Fieger License.txt @@ -0,0 +1,2 @@ +The Vic Fieger fonts are freeware, to be downloaded and used by anyone who wants them for free. I didn't put them here so people couldn't use them! You don't have to ask for my permission, though it's always good to receive an e-mail from somebody to show me what they are using them for. +If you wish to write to let me know how a certain font will be used, and for what purpose, send your e-mail to: vic@vicfieger.com \ No newline at end of file diff --git a/blogs/static/fonts/helsinki/helsinki.ttf b/blogs/static/fonts/helsinki/helsinki.ttf new file mode 100755 index 0000000..4857e4d Binary files /dev/null and b/blogs/static/fonts/helsinki/helsinki.ttf differ diff --git a/blogs/static/fonts/source-sans-pro/SIL Open Font License.txt b/blogs/static/fonts/source-sans-pro/SIL Open Font License.txt new file mode 100755 index 0000000..295975a --- /dev/null +++ b/blogs/static/fonts/source-sans-pro/SIL Open Font License.txt @@ -0,0 +1,43 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the copyright statement(s). + +"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. + +5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-Black.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-Black.otf new file mode 100755 index 0000000..0c25f3d Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-Black.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-BlackIt.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-BlackIt.otf new file mode 100755 index 0000000..da3504c Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-BlackIt.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-Bold.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-Bold.otf new file mode 100755 index 0000000..98dbee7 Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-Bold.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-BoldIt.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-BoldIt.otf new file mode 100755 index 0000000..6600c86 Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-BoldIt.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-ExtraLight.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-ExtraLight.otf new file mode 100755 index 0000000..f885ce7 Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-ExtraLight.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-ExtraLightIt.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-ExtraLightIt.otf new file mode 100755 index 0000000..f932024 Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-ExtraLightIt.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-It.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-It.otf new file mode 100755 index 0000000..2d627d9 Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-It.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-Light.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-Light.otf new file mode 100755 index 0000000..159979f Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-Light.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-LightIt.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-LightIt.otf new file mode 100755 index 0000000..e3d49b5 Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-LightIt.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-Regular.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-Regular.otf new file mode 100755 index 0000000..bdcfb27 Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-Regular.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-Semibold.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-Semibold.otf new file mode 100755 index 0000000..fffdbaf Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-Semibold.otf differ diff --git a/blogs/static/fonts/source-sans-pro/SourceSansPro-SemiboldIt.otf b/blogs/static/fonts/source-sans-pro/SourceSansPro-SemiboldIt.otf new file mode 100755 index 0000000..e90515b Binary files /dev/null and b/blogs/static/fonts/source-sans-pro/SourceSansPro-SemiboldIt.otf differ diff --git a/blogs/static/js/glamr.js b/blogs/static/js/glamr.js new file mode 100644 index 0000000..771d1e9 --- /dev/null +++ b/blogs/static/js/glamr.js @@ -0,0 +1,8 @@ +function showLoading(){ + form = document.querySelector("form") + loader = document.querySelector(".loader") + loader.removeAttribute("hidden") + form.setAttribute("hidden", "hidden") +} + +addEventListener('submit', showLoading) \ No newline at end of file diff --git a/blogs/templates/blogs/confirm-register.html b/blogs/templates/blogs/confirm-register.html index 15f2de4..cefc181 100644 --- a/blogs/templates/blogs/confirm-register.html +++ b/blogs/templates/blogs/confirm-register.html @@ -33,6 +33,7 @@ + The Atom/RSS feed of your blog. Articles will be shown in AusGLAMR. {{ form.category.errors }} diff --git a/blogs/templates/browse/articles.html b/blogs/templates/browse/articles.html new file mode 100644 index 0000000..bc169db --- /dev/null +++ b/blogs/templates/browse/articles.html @@ -0,0 +1,29 @@ +{% extends "layout.html" %} + +{% block content %} + {% for post in latest %} +
+
+

{{ post.title }}

+
+ {% if post.author_name %} + {{ post.author_name }} | + {% endif %} + {{ post.blog.title }} +
+ {% for tag in post.tags.all %} + {{ tag.name }} + {% endfor %} +
+
+
+ {% if post.description %} +
+ {% autoescape off %} +

{{ post.description|truncatewords_html:60 }}

+ {% endautoescape %} +
+ {% endif %} +
+ {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/blogs/templates/browse/blogs.html b/blogs/templates/browse/blogs.html index 5b1fca7..29faa21 100644 --- a/blogs/templates/browse/blogs.html +++ b/blogs/templates/browse/blogs.html @@ -1,8 +1,9 @@ {% extends "layout.html" %} {% block content %} -
- +
Title
@@ -13,7 +14,7 @@ {% for blog in blogs %}
diff --git a/blogs/templates/browse/editions.html b/blogs/templates/browse/editions.html new file mode 100644 index 0000000..220a6cd --- /dev/null +++ b/blogs/templates/browse/editions.html @@ -0,0 +1,24 @@ +{% extends "layout.html" %} + +{% block content %} + {% for edition in latest %} +
+
+

{{ edition.title }}

+

+ {% if edition.author_name %} + {{ edition.author_name }} | + {% endif %} + {{ edition.newsletter.title }} +

+
+ {% if edition.description %} +
+ {% autoescape off %} +

{{ edition.description|truncatewords_html:60 }}

+ {% endautoescape %} +
+ {% endif %} +
+ {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/blogs/templates/browse/events.html b/blogs/templates/browse/events.html index c0a67a3..382765b 100644 --- a/blogs/templates/browse/events.html +++ b/blogs/templates/browse/events.html @@ -2,8 +2,9 @@ {% block content %} -
- +
diff --git a/blogs/templates/browse/newsletters.html b/blogs/templates/browse/newsletters.html index ec39592..ea9feef 100644 --- a/blogs/templates/browse/newsletters.html +++ b/blogs/templates/browse/newsletters.html @@ -1,8 +1,9 @@ {% extends "layout.html" %} {% block content %} -
- +
Title @@ -12,7 +13,12 @@
{% for pub in news %}
- {{pub.name}} + + {{pub.name}} + {% if pub.feed %} + {% include 'utils/rss-img.html' %} + {% endif %} + {{pub.author}} {{pub.category_name}}
diff --git a/blogs/templates/events/cfp.html b/blogs/templates/events/cfp.html index 50744e8..a0823da 100644 --- a/blogs/templates/events/cfp.html +++ b/blogs/templates/events/cfp.html @@ -29,7 +29,6 @@
{{ form }} -
diff --git a/blogs/templates/index.html b/blogs/templates/index.html index d13ae66..716cb4a 100644 --- a/blogs/templates/index.html +++ b/blogs/templates/index.html @@ -1,36 +1,12 @@ {% extends "layout.html" %} -{% block intro %} +{% block intro %}{% endblock %} + +{% block content %}

Aus GLAMR is the place to find out what's happening in the Australasian cultural memory professions. Whether you work in galleries, libraries, archives, museums, or records, you'll find the latest blog posts, conferences and events, newsletters, and discussion groups here!

Browse one of the lists, search by keywords, or contribute by registering your blog, event, group or newsletter.

You can stay up to date by following the Mastodon bot or subscribing to email updates or to one of the RSS feeds - check out the subscribe page.

Please note that whilst off-topic or egregiously offensive content may be refused or removed, inclusion on this site does not imply endorsement by Hugh or newCardigan of the content of any particular listed publication or event.

-{% endblock %} - -{% block content %} - {% for article in latest %} -
-
-

{{ article.title }}

-

- {% if article.author_name %} - {{ article.author_name }} | - {% endif %} - {{ article.blog.title }} -

- {% for tag in article.tags.all %} - {{ tag.name }} - {% endfor %} -
- {% if article.description %} -
- {% autoescape off %} -

{{ article.description|truncatewords_html:60 }}

- {% endautoescape %} -
- {% endif %} -
- {% endfor %} {% endblock %} \ No newline at end of file diff --git a/blogs/templates/utils/rss-img.html b/blogs/templates/utils/rss-img.html new file mode 100644 index 0000000..6adcd3d --- /dev/null +++ b/blogs/templates/utils/rss-img.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/blogs/utilities.py b/blogs/utilities.py index 2d7344e..5ccf81f 100644 --- a/blogs/utilities.py +++ b/blogs/utilities.py @@ -22,9 +22,7 @@ def get_feed_info(feed): blog["feed"] = feed blog["title"] = getattr(b.feed, "title", "") blog["author_name"] = getattr(b.feed, "author", None) - blog["description"] = getattr(b.feed, "summary", None) or getattr( - b.feed, "subtitle", None - ) + blog["description"] = getattr(b.feed, "subtitle", None) # summary for a FEED is "subtitle" return blog diff --git a/blogs/views/__init__.py b/blogs/views/__init__.py index 465dd37..7823dd4 100644 --- a/blogs/views/__init__.py +++ b/blogs/views/__init__.py @@ -3,6 +3,7 @@ from .public import ( ConfirmBlogRegistration, HomeFeed, + Articles, Blogs, Browse, Contribute, @@ -10,6 +11,7 @@ from .public import ( Conferences, ConfirmEmail, CallsForPapers, + Editions, Groups, Help, Newsletters, diff --git a/blogs/views/feeds.py b/blogs/views/feeds.py index 7fded5d..38ee387 100644 --- a/blogs/views/feeds.py +++ b/blogs/views/feeds.py @@ -71,3 +71,6 @@ class EventFeed(Feed): def item_categories(self, item): """event GLAMR category""" return [_(item.category)] + + +# TODO: newsletter editions feed diff --git a/blogs/views/public.py b/blogs/views/public.py index ebe03b5..9c6905c 100644 --- a/blogs/views/public.py +++ b/blogs/views/public.py @@ -26,9 +26,10 @@ class HomeFeed(View): def get(self, request): """display home page""" + # TODO: what do we want on front page? latest = models.Article.objects.order_by("-pubdate")[:10] - data = {"title": "Latest blog posts", "latest": latest} + data = {"title": "", "latest": latest} return render(request, "index.html", data) @@ -39,13 +40,11 @@ class Blogs(View): """here they are""" if category: - - blogs = models.Blog.objects.filter(approved=True, active=True, category=category).order_by( - "-updateddate" - ) + blogs = models.Blog.objects.filter( + approved=True, active=True, category=category + ).order_by("-updateddate") else: - blogs = models.Blog.objects.filter(approved=True, active=True).order_by( "-updateddate" ) @@ -55,6 +54,17 @@ class Blogs(View): data = {"title": "Blogs and websites", "blogs": blogs} return render(request, "browse/blogs.html", data) +class Articles(View): + """Blog articles""" + + def get(self, request): + """here they are""" + latest = models.Article.objects.order_by("-pubdate")[:10] + + data = {"title": "Latest blog posts", "latest": latest} + return render(request, "browse/articles.html", data) + + class Conferences(View): """browse the list of conferences""" @@ -64,17 +74,21 @@ class Conferences(View): now = timezone.now() if category: - cons = models.Event.objects.filter(approved=True, start_date__gte=now, category=category).order_by( - "start_date" - ) + cons = models.Event.objects.filter( + approved=True, start_date__gte=now, category=category + ).order_by("start_date") else: - cons = models.Event.objects.filter(approved=True, start_date__gte=now).order_by( - "start_date" - ) + cons = models.Event.objects.filter( + approved=True, start_date__gte=now + ).order_by("start_date") for con in cons: con.category_name = models.Category(con.category).label - con.call_for_papers = con.cfp.filter(closing_date__gte=timezone.now()).order_by("-closing_date").last() + con.call_for_papers = ( + con.cfp.filter(closing_date__gte=timezone.now()) + .order_by("-closing_date") + .last() + ) data = {"title": "Upcoming events", "cons": cons} return render(request, "browse/events.html", data) @@ -100,7 +114,9 @@ class Groups(View): """here they are""" if category: - groups = models.Group.objects.filter(approved=True, category=category).order_by("name") + groups = models.Group.objects.filter( + approved=True, category=category + ).order_by("name") else: groups = models.Group.objects.filter(approved=True).order_by("name") @@ -124,6 +140,17 @@ class Newsletters(View): return render(request, "browse/newsletters.html", data) +class Editions(View): + """Newsletter editions""" + + def get(self, request): + """here they are""" + latest = models.Edition.objects.order_by("-pubdate")[:10] + + data = {"title": "Latest newsletter editions", "latest": latest} + return render(request, "browse/editions.html", data) + + class RegisterBlog(View): """register a blog""" @@ -309,9 +336,11 @@ class Search(View): articles = ( models.Article.objects.annotate( - tagnames=ArrayAgg("tags__name", distinct=True), # see above: this prevents many-to-many objects like tags causing the same article to appear in the results multiple times - rank=SearchRank(article_vector, query) - ) + tagnames=ArrayAgg( + "tags__name", distinct=True + ), # see above: this prevents many-to-many objects like tags causing the same article to appear in the results multiple times + rank=SearchRank(article_vector, query), + ) .filter(rank__gte=0.1) .order_by("-rank") ) @@ -349,6 +378,17 @@ class Search(View): .order_by("-rank") ) + edn_vector = SearchVector("title", weight="A") + SearchVector( + "description", weight="C" + ) + + editions = ( + models.Edition.objects.filter() + .annotate(rank=SearchRank(edn_vector, query)) + .filter(rank__gte=0.1) + .order_by("-rank") + ) + group_vector = SearchVector("name", weight="A") + SearchVector( "description", weight="C" ) @@ -361,7 +401,7 @@ class Search(View): ) combined = sorted( - chain(articles, events, cfps, newsletters, groups), + chain(articles, events, editions, cfps, newsletters, groups), key=attrgetter("rank"), reverse=True, )