Merge branch 'beta'
This commit is contained in:
commit
1ab5174c40
@ -8,8 +8,8 @@ ALKATOR_CHOICES = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
ALKATOR_CLASSES = (
|
ALKATOR_CLASSES = (
|
||||||
(2, "Podzim 2024"),
|
(1, "Jaro 2024 Sobkovice"),
|
||||||
(1, "Jaro 2024"),
|
(2, "Podzim 2024 Studené"),
|
||||||
)
|
)
|
||||||
|
|
||||||
ALKATOR_CHOICES_DICT = {
|
ALKATOR_CHOICES_DICT = {
|
||||||
|
@ -11,6 +11,7 @@ import json
|
|||||||
import glob
|
import glob
|
||||||
import PIL.Image
|
import PIL.Image
|
||||||
import random
|
import random
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
from .models import User, ALKATOR_CHOICES_DICT, ALKATOR_CLASSES
|
from .models import User, ALKATOR_CHOICES_DICT, ALKATOR_CLASSES
|
||||||
from alkator.settings import COMGATE_MERCHANT, COMGATE_SECRET, COMGATE_TEST
|
from alkator.settings import COMGATE_MERCHANT, COMGATE_SECRET, COMGATE_TEST
|
||||||
@ -194,16 +195,22 @@ def results(request):
|
|||||||
def photos(request):
|
def photos(request):
|
||||||
rtn = []
|
rtn = []
|
||||||
for (i, name) in ALKATOR_CLASSES:
|
for (i, name) in ALKATOR_CLASSES:
|
||||||
|
photos = {}
|
||||||
|
rtn.append(photos)
|
||||||
|
photos['name'] = name
|
||||||
|
photos['index'] = i
|
||||||
|
photos['photos'] = []
|
||||||
files = glob.glob(f"photos/{i}/*.jpg")
|
files = glob.glob(f"photos/{i}/*.jpg")
|
||||||
random.shuffle(files)
|
random.shuffle(files)
|
||||||
for file in files:
|
for file in files:
|
||||||
img = PIL.Image.open(file)
|
img = PIL.Image.open(file)
|
||||||
rtn.append({
|
photos['photos'].append({
|
||||||
'original': '/' + file.replace(".jpg", ".webp"),
|
'original': '/' + file.replace(".jpg", ".webp"),
|
||||||
'thumbnail': '/' + file.replace(f'photos/{i}/', f'photos/{i}/thumbnail/').replace(".jpg", ".webp"),
|
'thumbnail': '/' + file.replace(f'photos/{i}/', f'photos/{i}/thumbnail/').replace(".jpg", ".webp"),
|
||||||
'original_width': img.width,
|
'original_width': img.width,
|
||||||
'original_height': img.height,
|
'original_height': img.height,
|
||||||
})
|
})
|
||||||
|
|
||||||
return HttpResponse(json.dumps(rtn), content_type='application/json')
|
return HttpResponse(json.dumps(rtn), content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ class Main extends Component {
|
|||||||
status: "",
|
status: "",
|
||||||
faq: false,
|
faq: false,
|
||||||
results: [],
|
results: [],
|
||||||
|
gallery_open: undefined,
|
||||||
page: window.location.hash,
|
page: window.location.hash,
|
||||||
photos: [],
|
photos: [],
|
||||||
photoIsOpen: false,
|
photoIsOpen: false,
|
||||||
@ -46,6 +47,9 @@ class Main extends Component {
|
|||||||
}
|
}
|
||||||
window.addEventListener("hashchange", (e) => {this.onHashChange(e)})
|
window.addEventListener("hashchange", (e) => {this.onHashChange(e)})
|
||||||
}
|
}
|
||||||
|
openGallery = (i) => {
|
||||||
|
this.setState({gallery_open: i})
|
||||||
|
}
|
||||||
closePhoto = () => {
|
closePhoto = () => {
|
||||||
this.setState(state => ({ photoIsOpen: false }))
|
this.setState(state => ({ photoIsOpen: false }))
|
||||||
}
|
}
|
||||||
@ -56,7 +60,7 @@ class Main extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
onHashChange(event){
|
onHashChange(event){
|
||||||
this.setState({page: window.location.hash})
|
this.setState({page: window.location.hash, gallery_open: undefined})
|
||||||
}
|
}
|
||||||
handleChangeFiles(event) {
|
handleChangeFiles(event) {
|
||||||
this.setState({files: [...event.target.files]})
|
this.setState({files: [...event.target.files]})
|
||||||
@ -105,8 +109,9 @@ class Main extends Component {
|
|||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
let photos_gallery = [];
|
let photos_gallery = [];
|
||||||
let photos_carousel = []
|
let photos_carousel = [];
|
||||||
for (const photo of this.state.photos){
|
if(this.state.gallery_open !== undefined){
|
||||||
|
for (const photo of this.state.photos[this.state.gallery_open].photos){
|
||||||
photos_gallery.push({
|
photos_gallery.push({
|
||||||
src: photo.thumbnail,
|
src: photo.thumbnail,
|
||||||
width: photo.original_width,
|
width: photo.original_width,
|
||||||
@ -116,6 +121,7 @@ class Main extends Component {
|
|||||||
original: photo.original
|
original: photo.original
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<ModalGateway>
|
<ModalGateway>
|
||||||
@ -176,8 +182,21 @@ class Main extends Component {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{this.state.page == "#gallery" &&
|
{this.state.page == "#gallery" &&
|
||||||
|
<div class="container" style={{display: "flex"}}>
|
||||||
|
{this.state.photos.map((photos, index) =>
|
||||||
|
<div class="card" style={{"width": "18rem", margin: "10px"}}>
|
||||||
|
<img src={'/photos/plakat_' + photos.index + '.jpg'} class="card-img-top" />
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{photos.name}</h5>
|
||||||
|
<a href="#gallery" class="btn btn-primary" onClick={(e) => {e.preventDefault(); this.openGallery(index)}}>Otevřít galerii</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{this.state.page == "#gallery" && this.state.gallery_open !== undefined &&
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<Gallery photos={photos_gallery} onClick={this.openPhoto}/>
|
<Gallery style={{}} photos={photos_gallery} onClick={this.openPhoto}/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{this.state.page == "" &&
|
{this.state.page == "" &&
|
||||||
@ -377,7 +396,8 @@ class Main extends Component {
|
|||||||
Číslo účtu: 131-2219860207/0100<br />
|
Číslo účtu: 131-2219860207/0100<br />
|
||||||
E-mail: info@alkator.cz<br />
|
E-mail: info@alkator.cz<br />
|
||||||
Tel: +420 728 018 088<br />
|
Tel: +420 728 018 088<br />
|
||||||
<img src="/public/footer.png" style={{"width":"100%","height":"auto"}} />
|
<img src="/public/footer.png" style={{"width":"100%","height":"auto"}} /><br/>
|
||||||
|
© Alkátor team 2024
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
BIN
photos/plakat_2.jpg
Normal file
BIN
photos/plakat_2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 KiB |
Loading…
x
Reference in New Issue
Block a user