Skip to content

Commit

Permalink
Merge 5a5bed0 into dd4e511
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsuta committed Sep 27, 2018
2 parents dd4e511 + 5a5bed0 commit 21f0072
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -18,3 +18,4 @@ twilio==6.10.0
cherrys==0.4
redis==2.10.6
ics==0.4
pillow==5.2.0
5 changes: 5 additions & 0 deletions uber/configspec.ini
Expand Up @@ -492,6 +492,11 @@ mits_email = string(default="MAGFest Indie Tabletop Showcase <tabletop@magfest.o
# Goes at the bottom of all MITS automated emails.
mits_email_signature = string(default=" - Janus, MITS Department Head")

# We use these (width, height) measurements to mark uploaded images as
# either a header or thumbnail. The measurements below are for Guidebook.
mits_header_size = string_list(default=list('640','240'))
mits_thumbnail_size = string_list(default=list('240','240'))


# =============================
# panels
Expand Down
9 changes: 9 additions & 0 deletions uber/models/mits.py
@@ -1,6 +1,7 @@
import os
from functools import wraps

from PIL import Image
from residue import CoerceUTF8 as UnicodeText, UTCDateTime, UUID
from sideboard.lib import on_startup
from sqlalchemy.schema import ForeignKey
Expand Down Expand Up @@ -161,6 +162,14 @@ def url(self):
def filepath(self):
return os.path.join(c.MITS_PICTURE_DIR, str(self.id))

@property
def is_header(self):
return Image.open(self.filepath).size == tuple(map(int, c.MITS_HEADER_SIZE))

@property
def is_thumbnail(self):
return Image.open(self.filepath).size == tuple(map(int, c.MITS_THUMBNAIL_SIZE))


class MITSDocument(MagModel):
team_id = Column(UUID, ForeignKey('mits_team.id'))
Expand Down
4 changes: 4 additions & 0 deletions uber/templates/mits_applications/index.html
Expand Up @@ -103,6 +103,10 @@ <h3>Manage Your Pictures</h3>
<input type="submit" value="Delete" />
</form>
</td>
<td>
{% if picture.is_header %}<em>Header</em>{% endif %}
{% if picture.is_thumbnail %}<em>Thumbnail</em>{% endif %}
</td>
</tr>
{% endfor %}
</table>
Expand Down

0 comments on commit 21f0072

Please sign in to comment.