Skip to content

Commit

Permalink
Various fixes and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gthole committed Jan 13, 2018
1 parent 9d5e789 commit 7c25ba0
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 36 deletions.
20 changes: 16 additions & 4 deletions gedgo/static/styles/style-default.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
/* Move down content because we have a fixed navbar that is 50px tall */
body {
background-color: #F5F8FA;
background-color: #d5dce0;
font-family: Camphor, Open Sans, Segoe UI, sans-serif;
text-rendering: optimizeLegibility;
}

a {
color: #537484;
}

.navbar {
background-color: #3097D1 !important;
background-color: #538463 !important;
}
.navbar-nav li a {
color: #fcfcfc !important;
Expand All @@ -13,10 +19,10 @@ body {
color: #666 !important;
}
.navbar-nav .active a {
background-color: #3097D1 !important;
background-color: #6e9b7d !important;
}
.navbar-nav .open .dropdown-toggle {
background-color: #3097D1 !important;
background-color: #6e9b7d !important;
}

.navbar-brand {
Expand All @@ -28,6 +34,7 @@ body {
}

.main {
margin: 5px;
color: #666;
background-color: #fff;
padding: 20px;
Expand Down Expand Up @@ -72,6 +79,11 @@ body {
max-width: 100%;
margin-bottom: 10px;
}

.research-file-item {
min-height: 64px;
}

.comment-area {
resize: none;
}
Expand Down
10 changes: 5 additions & 5 deletions gedgo/templates/default/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//opensource.keycdn.com/fontawesome/4.6.3/font-awesome.min.css" rel="stylesheet">
<link href="{{ STATIC_URL }}styles/style-default.css" rel="stylesheet" type="text/css" >
{% block headappend %}{% endblock %}
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
Expand Down Expand Up @@ -66,12 +67,11 @@
{% endfor %}
{% endif %}
<div class="row">
<div class="main col-sm-4 hidden-xs">
{% block leftsidebar %}{% endblock %}
<div class="col-sm-4 hidden-xs">
<div class="main">{% block leftsidebar %}{% endblock %}</div>
</div>
<div class="col-sm-1 hidden-xs"></div>
<div class="main col-sm-7">
{% block content %}{% endblock %}<br>&nbsp;
<div class="col-sm-8">
<div class="main">{% block content %}{% endblock %}</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion gedgo/templates/default/blogpost.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% if post.tagged_photos.all %}
{% for photo in post.tagged_photos.all %}
<a href="{{ photo.docfile.url }}">
<img src="{{ photo.thumb.url }}" class="sidebar-lead img-rounded">
<img src="{{ photo.thumb.thumb }}" class="thumb sidebar-lead img-rounded">
</a>
{% endfor %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion gedgo/templates/default/documentaries.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% for documentary in documentaries.iterator %}
<div class="media">
<a class="pull-left" href="{{ documentary.location }}">
<img class="documentary-thumb media-object" src="{{ MEDIA_URL }}{{ documentary.thumb }}">
<img class="documentary-thumb media-object" src="{{ MEDIA_URL }}{{ documentary.thumb.thumb }}">
</a>
<div class="media-body">
<h4 class="media-heading" id="{{ documentary.title|urlencode }}">{{ documentary.title }}</h4>
Expand Down
12 changes: 5 additions & 7 deletions gedgo/templates/default/person.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@

{% block leftsidebar %}
<div class="row">
{% for photo in person.photos %}
{% if not photo == person.key_photo %}
<div class="col-lg-4 col-md-6">
{% for photo in photos %}
<div class="col-lg-4 col-md-6">
<a href="{{ photo.docfile.url }}">
<img src="{{ photo.thumb.url }}" class="sidebar-thumb img-rounded">
</a>
</div>
{% endif %}
{% empty %}
<div class="col-lg-12">
<span class="text-center text-muted">(no photos)</span>
</div>
<div class="col-lg-12">
<span class="text-center text-muted">(no photos)</span>
</div>
{% endfor %}
</div>
{% endblock %}
Expand Down
20 changes: 10 additions & 10 deletions gedgo/templates/default/research.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@
{% endif %}

{% if files %}
<ul class="list-group">
<ul class="media-list">
{% for f in files %}
<li class="list-group-item" style="min-height: 64px">
<a href="/gedgo/research/{{ dirname | urlencode }}?fn={{ f.path | urlencode }}{% if rq %}&rq={{ rq }}{% endif %}">
<div class="row">
<div class="col-xs-2 text-center">
{% if f.preview %}<img style="max-width: 64px" class="center-block" src="/gedgo/research-preview/{{ dirname | urlencode }}/{{ f.path | urlencode }}">
<li class="media research-file-item">
<a class="pull-left" href="/gedgo/research/{{ dirname | urlencode }}?fn={{ f.path | urlencode }}{% if rq %}&rq={{ rq }}{% endif %}">
<div style="width: 64px; min-width: 64px">
{% if f.preview %}<img style="width: 100%" class="media-object" src="/gedgo/research-preview/{{ dirname | urlencode }}/{{ f.path | urlencode }}">
{% else %}<i class="fa fa-{{ f.type }} fa-2x"></i>
{% endif %}
</div>
<div class="col-xs-10">
{{ f.name|truncatechars:45 }}
</div>
</div>
</a>
<a class="pull-left" href="/gedgo/research/{{ dirname | urlencode }}?fn={{ f.path | urlencode }}{% if rq %}&rq={{ rq }}{% endif %}">
<div class="media-body">
<p class="media-heading">{{ f.name|truncatechars:45 }}</p>
</div>
</a>
</li>
{% endfor %}
</ul>
Expand Down
17 changes: 16 additions & 1 deletion gedgo/templates/default/research_preview.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{% extends "base.html" %}

{% block headappend %}
<link href="http://vjs.zencdn.net/6.6.0/video-js.css" rel="stylesheet">
{% endblock %}

{% block filesactive %}
class = "active"
{% endblock %}
Expand Down Expand Up @@ -39,12 +43,23 @@ <h3>{{ file.name }}</h3>
</div>
<br /><br />

{% if file.preview %}

{% if file.can_video %}
<video class="video-js" data-setup="{}" style="width: 100%; max-width: 100%" controls>
<source type="video/mp4" src="/gedgo/research/{{ dirname | urlencode }}?fn={{ file.path | urlencode }}&download=true">
Sorry, your browser doesn't support embedded videos,
but don't worry, you can download it
and watch it with your favorite video player!
</video>
{% elif file.preview %}
<img style="max-width: 100%" class="center-block" src="/gedgo/research-preview/{{ dirname | urlencode }}/{{ file.path | urlencode }}?size=w640h480">
{% else %}
<br/>
<div class="center-block text-center"><i class="fa fa-{{ file.type }} fa-2x"></i></div>
{% endif %}

{% endblock %}

{% block javascript %}
<script src="http://vjs.zencdn.net/6.6.0/video.js"></script>
{% endblock %}
2 changes: 1 addition & 1 deletion gedgo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}),

# Authenticated media fileserve view
url(r'^media/(?P<storage_name>\w+)/(?P<file_base_name>.*)$', views.media),
url(r'^media/(?P<file_base_name>.*)$', views.media),

url(r'^$', lambda r: redirect('/gedgo/1/')),
]
1 change: 1 addition & 0 deletions gedgo/views/model_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def person(request, gedcom_id, person_id):
context = {
'person': p,
'posts': BlogPost.objects.filter(tagged_people=p),
'photos': [photo for photo in p.photos if not photo.id != p.key_photo],
'gedcom': g,
'form': form,
'comment_noun': noun
Expand Down
7 changes: 4 additions & 3 deletions gedgo/views/research.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from django.contrib.auth.decorators import login_required
from django.core.files.storage import default_storage

import sys
from os import path
import mimetypes

from gedgo.views.util import serve_content, render
from gedgo.storages import research_storage as storage

import sys
sys.stdout = sys.stderr

FOLDER_CACHE = ('', ([], []))
Expand Down Expand Up @@ -124,8 +124,8 @@ def can_preview(name):
(
'.' in name and
name.rsplit('.', 1)[1].lower() in (
'jpeg', 'jpg', 'gif', 'png', 'pdf', 'pages',
'mov', 'avi', 'doc', 'mpg'
'jpeg', 'jpg', 'gif', 'png', 'pdf',
'mov', 'avi', 'doc', 'mpg', 'bmp'
)
)
)
Expand All @@ -143,6 +143,7 @@ def process_file(name, p, is_dir=False):
'full_path': path.join(name, path.basename(p)),
'name': path.basename(p),
'path': fn,
'can_video': not is_dir and p.rsplit('.')[1].lower() in ('mp4', 'avi'),
'preview': can_preview(p)
}

Expand Down
8 changes: 5 additions & 3 deletions gedgo/views/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from os import path
import mimetypes

import sys
sys.stdout = sys.stderr


STORAGES = {
'research': research_storage,
Expand All @@ -24,13 +27,12 @@


@login_required
def media(request, storage_name, file_base_name):
def media(request, file_base_name):
"""
Authenticated view to serve media content and toggle storage classes
"""
filename = file_base_name.strip('/')
storage = STORAGES.get(storage_name, default_storage)
return serve_content(storage, filename)
return serve_content(default_storage, filename)


def process_comments(request, noun):
Expand Down

0 comments on commit 7c25ba0

Please sign in to comment.