From 4b9759a3363f9ea8fb58293c6debf5ccbc6e2920 Mon Sep 17 00:00:00 2001 From: Manav Gabhawala Date: Sat, 25 Mar 2017 21:25:01 -0400 Subject: [PATCH] Fixed some UI things, made announcement categories even better --- MHacks/models.py | 2 +- static/javascript/announcements.js | 47 ++++++++++++++++-------------- static/stylesheets/live.css | 1 + 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/MHacks/models.py b/MHacks/models.py index f99347a..1ad4a8e 100644 --- a/MHacks/models.py +++ b/MHacks/models.py @@ -178,7 +178,7 @@ class Announcement(Any): info = models.TextField(default='') broadcast_at = models.DateTimeField() category = models.PositiveIntegerField(validators=[MinValueValidator(0), - MaxValueValidator(31)]) + MaxValueValidator(31)], help_text="0 for none; 1 for emergency; 2 for logistics; 4 for food; 8 for event; Add 16 to make sponsored") approved = models.BooleanField(default=False) sent = models.BooleanField(default=False) diff --git a/static/javascript/announcements.js b/static/javascript/announcements.js index 667f44f..68830c2 100644 --- a/static/javascript/announcements.js +++ b/static/javascript/announcements.js @@ -68,33 +68,36 @@ refresh.click(function(){ }); function mapCategoryIndex(category) { - switch (category) { - case 1: - return 0; - case 2: - return 1; - case 4: - return 2; - case 8: - return 3; + if (category & 1) { + return 0; + } + if (category & 2) { + return 1; + } + if (category & 4) { + return 2; + } + if (category & 8) { + return 3; } - return 0; } function formatAnnouncementCategoryIdentifier(category) { - switch (category) { - case 1: - return "Emergency"; - case 2: - return "Logistics"; - case 4: - return "Food"; - case 8: - return "Event"; - case 16: - return "Sponsor"; + if (category & 1) { + return "Emergency"; + } + if (category & 2) { + return "Logistics"; + } + if (category & 4) { + return "Food"; + } + if (category & 8) { + return "Event"; + } + if (category & 16) { + return "Sponsor"; } - return "Other"; } diff --git a/static/stylesheets/live.css b/static/stylesheets/live.css index 74d91dc..84e9669 100644 --- a/static/stylesheets/live.css +++ b/static/stylesheets/live.css @@ -114,6 +114,7 @@ body{ .content-box { background-color: rgba(0,0,0,0.4); border-radius: 20px; + -webkit-backdrop-filter: saturate(150%) blur(20px); } @media only screen and (max-width: 850px){