Commit a5c3795b authored by onny's avatar onny

style elements

parent 895eccf8
# Installation
```
sudo -u aur aur sync -c python-django-rest-framework
sudo -u aur aur sync -c python-django-rest-framework python-django-easy-thumbnails
pacman -Sy python-django python-django-rest-framework
git clone https://git.project-insanity.org/onny/openart.git
cd openart
......
......@@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'easy_thumbnails',
'openart',
]
......
from django.contrib import admin
from .models import Artist, Project
from .models import Artist, Project, Entry, Media
admin.site.register(Artist)
admin.site.register(Project)
admin.site.register(Entry)
admin.site.register(Media)
# Register your models here.
from __future__ import unicode_literals
import re
import os
from django.db import models
from django.core.validators import RegexValidator
from easy_thumbnails.files import get_thumbnailer
alphanum_regex = RegexValidator(
regex='^[A-Za-z-ÁÀȦÂÄǞǍĂĀÃÅǺǼǢĆĊĈČĎḌḐḒÉÈĖÊËĚĔĒẼE̊ẸǴĠĜǦĞG̃ĢĤḤáàȧâäǟǎăāãåǻǽǣćċĉčďḍḑḓéèėêëěĕēẽe̊ẹǵġĝǧğg̃ģĥḥÍÌİÎÏǏĬĪĨỊĴĶǨĹĻĽĿḼM̂M̄ʼNŃN̂ṄN̈ŇN̄ÑŅṊÓÒȮȰÔÖȪǑŎŌÕȬŐỌǾƠíìiîïǐĭīĩịĵķǩĺļľŀḽm̂m̄ʼnńn̂ṅn̈ňn̄ñņṋóòôȯȱöȫǒŏōõȭőọǿơP̄ŔŘŖŚŜṠŠȘṢŤȚṬṰÚÙÛÜǓŬŪŨŰŮỤẂẀŴẄÝỲŶŸȲỸŹŻŽẒǮp̄ŕřŗśŝṡšşṣťțṭṱúùûüǔŭūũűůụẃẁŵẅýỳŷÿȳỹźżžẓǯßœŒçÇ0-9\s]*$',
......@@ -31,7 +33,6 @@ class Artist(models.Model):
count = count + 1
self.slug = self.name.lower().replace(' ','-')
self.slug = re.sub('[()]','', self.slug) # FIXME
print(self.slug)
super(Artist, self).save(*args, **kwargs)
def __str__(self):
......@@ -100,4 +101,21 @@ class Media(models.Model):
null=False,
blank=False
)
fileName = models.CharField(max_length=100)
fileThumb = models.FileField(
null=True,
blank=True
)
entry = models.ForeignKey(Entry, on_delete=models.CASCADE)
def save(self, *args, **kwargs):
self.fileName = os.path.splitext(str(self.file))[0]
thumbnailer = get_thumbnailer(self.file)
thumbnailer.get_thumbnail({'size': (100, 100)})
#self.fileThumb = # FIXME
super(Media, self).save(*args, **kwargs)
def __str__(self):
return self.fileName
......@@ -48,3 +48,8 @@ class MediaSerializer(serializers.ModelSerializer):
class Meta:
model = Media
fields = ('id', 'file', 'entry')
class MediaReadSerializer(serializers.ModelSerializer):
class Meta:
model = Media
fields = ('id', 'file', 'fileName', 'entry')
......@@ -2,7 +2,7 @@ from django.template.response import TemplateResponse
from django.http import HttpResponse
from .models import Artist, Project, Entry, Media
from rest_framework import viewsets
from .serializers import ArtistSerializer, ArtistReadSerializer, ProjectSerializer, ProjectReadSerializer, EntrySerializer, EntryReadSerializer, MediaSerializer
from .serializers import ArtistSerializer, ArtistReadSerializer, ProjectSerializer, ProjectReadSerializer, EntrySerializer, EntryReadSerializer, MediaSerializer, MediaReadSerializer
from .forms import ArtistForm, ProjectForm, EntryForm, MediaForm
from django.conf import settings
from django.contrib.auth.forms import UserCreationForm
......@@ -103,7 +103,11 @@ class EntryViewSet(viewsets.ModelViewSet):
class MediaViewSet(viewsets.ModelViewSet):
queryset = Media.objects.all()
serializer_class = MediaSerializer
def get_serializer_class(self):
if self.request.method in ['GET']:
return MediaReadSerializer
return MediaSerializer
def login(request):
context = {}
......
.flex-container {
display: flex;
flex-wrap: wrap;
}
.flex-container > div {
width: 220px;
margin: 10px;
overflow-wrap: break-word;
}
.flex-container > div:hover {
margin: -5px -5px;
padding: 15px;
width: 250px;
z-index: 2;
transform: translateZ(0px);
box-shadow: 0 0 5px #bebaba;
}
.flex-container .entryTitle {
font-size: 16px;
font-weight: 600;
display: block;
margin-bottom: 4px;
}
.flex-container .imgbox {
background-color: #f1f1f1;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
width: 220px;
height: 175px;
margin-bottom: 15px;
cursor: pointer;
}
.controlBoxes {
display: none;
justify-content: center;
padding-bottom: 10px;
width: 100%;
height: 100%;
}
.controlBoxes .fa {
font-size: 27px;
padding: 5px;
border-radius: 5px;
background-color: white;
opacity: 0.5;
align-self: flex-end; /* DOKU */
margin: 0px 4px;
}
.controlBoxes .fa:hover {
opacity: 1;
}
.flex-container > div:hover .imgbox .controlBoxes {
display: flex;
}
......@@ -98,35 +98,6 @@ footer > div {
width: 80%;
}
.flex-container {
display: flex;
flex-wrap: wrap;
}
.flex-container > div {
width: 220px;
margin: 10px;
overflow-wrap: break-word;
}
.flex-container .entryTitle {
font-size: 16px;
font-weight: 600;
display: block;
margin-bottom: 4px;
}
.flex-container .imgbox {
background-color: #f1f1f1;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
width: 220px;
height: 175px;
margin-bottom: 15px;
cursor: pointer;
}
.msg {
background-color: green;
display: inline-block;
......@@ -138,3 +109,8 @@ footer > div {
.error {
background-color: red;
}
table th {
text-align: left;
min-width: 120px;
}
......@@ -115,7 +115,7 @@ var demo = new Vue({
.get('/api/artist/')
.then(response => (this.entries = response.data));
break;
case "/projects":
case "projects":
axios
.get('/api/project/')
.then(response => (this.entries = response.data));
......
......@@ -8,7 +8,7 @@
<div class='imgbox'
style='background-image: url("https://uploads.wikiart.org/Content/images/ARTIST-480x600.jpg");'>
</div>
<b><a :href="'/en/' + entry.slug">[[ entry.name ]]</a></b><br>
<span class='entryTitle'><a :href="'/en/' + entry.slug">[[ entry.name ]]</a></span>
<span>German, 1552 - 1615<br>
41 projects</span><br>
{% if authenticated %}
......
......@@ -8,6 +8,7 @@
<link rel="shortcut icon" href="{% static 'img/favicon.ico' %}" type="image/x-icon" />
<link rel="stylesheet" href="{% static 'css/main.css' %}">
<link rel="stylesheet" href="{% static 'css/menu.css' %}">
<link rel="stylesheet" href="{% static 'css/entry.css' %}">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,700' rel='stylesheet' type='text/css'>
<title>openArt</title>
......
......@@ -8,7 +8,7 @@
<div class='imgbox'
style='background-image: url("https://uploads.wikiart.org/Content/images/ARTIST-480x600.jpg");'>
</div>
<b>[[ entry.signatory ]]</b><br>
<span class='entryTitle'>[[ entry.signatory ]]</span>
of [[ entry.project.name ]]<br>
{% if authenticated %}
<button v-on:click="removeEntry('entry', [[ index ]])">Delete</button>
......
......@@ -7,8 +7,12 @@
<div v-for="(entry, index) in entries">
<div class='imgbox'
:style="{ backgroundImage: 'url(' + entry.file + ')' }">
<div class='controlBoxes'>
<i class="fa fa-heart"></i>
<i class="fa fa-search-plus"></i>
</div>
</div>
<span class='entryTitle'>[[ entry.file ]]</span>
<span class='entryTitle'>[[ entry.fileName ]]</span>
of [[ entry.id ]]<br>
{% if authenticated %}
<button v-on:click="removeEntry('media', [[ index ]])">Delete</button>
......
......@@ -8,7 +8,7 @@
<div class='imgbox'
style='background-image: url("https://uploads.wikiart.org/Content/images/ARTIST-480x600.jpg");'>
</div>
<b>[[ entry.name ]]</b><br>
<span class='entryTitle'>[[ entry.name ]]</span>
by [[ entry.artist.name ]]<br>
{% if authenticated %}
<button v-on:click="removeEntry('artist', [[ index ]])">Delete</button>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment