Skip to content
Snippets Groups Projects
Commit b1b079f3 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

add url resize generator

parent 125ea1dd
Branches
No related tags found
1 merge request!8Release
Pipeline #12528 passed
This commit is part of merge request !8. Comments created here will be created in the context of that merge request.
Showing
with 789 additions and 193 deletions
...@@ -27,7 +27,6 @@ venv: .venv/bin/python ...@@ -27,7 +27,6 @@ venv: .venv/bin/python
install: venv install: venv
${VENV}/bin/pip install -r requirements/base.txt -r requirements/production.txt ${VENV}/bin/pip install -r requirements/base.txt -r requirements/production.txt
${VENV}/bin/nodeenv --python-virtualenv --node=19.3.0
${VENV}/bin/npm install ${VENV}/bin/npm install
......
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class AutoServerResizeConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'asset_server_resize'
from django.db import models
# Create your models here.
{% extends "shared/base.html" %}
{% load render_bundle from webpack_loader %}
{% block title %}Generátor škálovaných odkazů na obrázky v Asset Serveru{% endblock %}
{% block header_name %}Škálované obrázky{% endblock %}
{% block description %}Vyplněním získáš odkaz na zmenšený obrázek z asset serveru, který se dá použít pro embedování.{% endblock %}
{% block head %}
<link
rel="stylesheet"
href="https://styleguide.pirati.cz/2.12.x/css/styles.css"
>
{% render_bundle "asset_server_resize" %}
{% endblock %}
{% block content %}
<main>
<h1 class="text-6xl font-bebas mb-5">Generátor škálovaných odkazů na obrázky v Asset Serveru</h1>
<div class="grid grid-cols-2 gap-4">
<div class="flex flex-col gap-2">
<form class="flex flex-col gap-2 mb-4" id="asset-info-form">
<input
id="path"
name="path"
type="text"
pattern="[^ :]+\.(jpg|jpeg|png|webp|gif)"
class="text-input form-field__control"
placeholder="Cesta k souboru"
required
>
<small class="prose text-sm">
<p>
Například <code>/jihomoravsky/img/flags/gb.png</code>, pro soubor
<a href="https://mrak.pirati.cz/f/475789" target="_blank">zde na
Mraku</a>. Cestu najdeš nahoře, vynechej z ní <code>Assets</code>.
Na konec dodej název souboru, na který chceš odkázat.
</p>
</small>
<input
id="height"
name="height"
type="number"
class="text-input form-field__control"
placeholder="Výška"
>
<input
id="width"
name="width"
type="number"
class="text-input form-field__control"
placeholder="Šírka"
>
<small class="prose text-sm my-2">
<p>
Stačí vyplnit pouze jeden rozměr. Obrázek se mu přizpůsobí.
</p>
</small>
<div>
<button
type="submit"
class="btn btn--icon"
id="generate-url"
>
<div class="btn__body-wrap">
<div class="btn__body">Vygenerovat</div>
<div class="btn__icon">
<i class="ico--chevron-right"></i>
</div>
</div>
</button>
</div>
</form>
<small class="prose text-sm">
<p>
Další informace o Asset serveru najdeš na <a
href="https://wiki.pirati.cz/to/navody/asset-server" target="_blank">
Wiki v návodu</a>.
</p>
</small>
</div>
<div id="result-wrapper" class="flex flex-col gap-2 hidden">
<h3 class="head-alt-sm">Vygenerovaný odkaz</h3>
<a href="" id="result"></a>
</div>
</div>
</main>
{% endblock %}
from django.test import TestCase
# Create your tests here.
from django.urls import path
from . import views
app_name = "asset_server_resize"
urlpatterns = [
path("", views.index, name="index"),
]
from django.conf import settings
from django.shortcuts import render
from django_http_exceptions import HTTPExceptions
# Create your views here.
def index(request):
return render(
request,
"asset_server_resize/index.html",
{}
)
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% block head %} {% block head %}
<link <link
rel="stylesheet" rel="stylesheet"
href="https://styleguide.pirati.cz/2.11.x/css/styles.css" href="https://styleguide.pirati.cz/2.12.x/css/styles.css"
> >
{% endblock %} {% endblock %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% block head %} {% block head %}
<link <link
rel="stylesheet" rel="stylesheet"
href="https://styleguide.pirati.cz/2.11.x/css/styles.css" href="https://styleguide.pirati.cz/2.12.x/css/styles.css"
> >
{% endblock %} {% endblock %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% block head %} {% block head %}
<link <link
rel="stylesheet" rel="stylesheet"
href="https://styleguide.pirati.cz/2.11.x/css/styles.css" href="https://styleguide.pirati.cz/2.12.x/css/styles.css"
> >
{% render_bundle "mail_signature" %} {% render_bundle "mail_signature" %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% block head %} {% block head %}
<link <link
rel="stylesheet" rel="stylesheet"
href="https://styleguide.pirati.cz/2.11.x/css/styles.css" href="https://styleguide.pirati.cz/2.12.x/css/styles.css"
> >
{% render_bundle "member_group_size_calc" %} {% render_bundle "member_group_size_calc" %}
......
This diff is collapsed.
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
"description": "", "description": "",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.4.1",
"alertifyjs": "^1.13.1", "alertifyjs": "^1.13.1",
"css-loader": "^6.7.3", "css-loader": "^6.7.3",
"jquery": "^3.6.4", "jquery": "^3.6.4",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
"select2": "^4.1.0-rc.0", "select2": "^4.1.0-rc.0",
"style-loader": "^3.3.2", "style-loader": "^3.3.2",
"tailwindcss": "^3.3.1", "tailwindcss": "^2.2.2",
"webpack": "^5.77.0", "webpack": "^5.77.0",
"webpack-bundle-tracker": "^1.8.1", "webpack-bundle-tracker": "^1.8.1",
"webpack-cli": "^5.0.1" "webpack-cli": "^5.0.1"
......
...@@ -4,6 +4,5 @@ django-environ==0.9.0 ...@@ -4,6 +4,5 @@ django-environ==0.9.0
django-webpack-loader==1.8.0 django-webpack-loader==1.8.0
django-http-exceptions==1.4.0 django-http-exceptions==1.4.0
gql[requests]==3.4.0 gql[requests]==3.4.0
nodeenv==1.7.0
psycopg2-binary==2.9.5 psycopg2-binary==2.9.5
requests==2.28.2 requests==2.28.2
...@@ -54,6 +54,7 @@ INSTALLED_APPS = [ ...@@ -54,6 +54,7 @@ INSTALLED_APPS = [
"rv_voting_calc", "rv_voting_calc",
"mail_signature", "mail_signature",
"instagram_token", "instagram_token",
"asset_server_resize",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
...@@ -20,5 +20,6 @@ urlpatterns = [ ...@@ -20,5 +20,6 @@ urlpatterns = [
path("hlasovani-rv/", include("rv_voting_calc.urls")), path("hlasovani-rv/", include("rv_voting_calc.urls")),
path("emailove-podpisy/", include("mail_signature.urls")), path("emailove-podpisy/", include("mail_signature.urls")),
path("instagram/", include("instagram_token.urls")), path("instagram/", include("instagram_token.urls")),
path("asset-server/", include("asset_server_resize.urls")),
path("", include("shared.urls")), path("", include("shared.urls")),
] ]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment