From 51366edab95d0a1a6c5ae60d46c379b1048c55f5 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Sat, 2 Mar 2019 01:03:10 +0100 Subject: [PATCH 1/1] Reduce the ugly, just bootstrap things. --- src/archive/static/style.css | 67 +---- src/archive/templates/archive/base.html | 26 +- .../templates/archive/file_managed.html | 243 ++++++++++-------- src/archive/templates/archive/file_new.html | 34 ++- .../templates/archive/file_unmanaged.html | 28 +- src/archive/templates/archive/list.html | 20 +- src/archive/templates/archive/list_new.html | 14 +- .../templates/archive/list_published.html | 12 +- .../templates/archive/list_publishing.html | 27 +- .../templates/archive/list_unmanaged.html | 6 +- .../templates/archive/list_unpublished.html | 42 +-- .../archive/tags/multiple_tags_table.html | 2 +- .../templates/archive/tags/tags_table.html | 2 +- src/archive/templates/base.html | 15 +- src/archive/views.py | 2 +- src/audiobooks/settings.py | 1 + 16 files changed, 270 insertions(+), 271 deletions(-) mode change 100755 => 100644 src/archive/templates/archive/file_managed.html mode change 100755 => 100644 src/archive/templates/archive/file_unmanaged.html mode change 100755 => 100644 src/archive/templates/archive/list_published.html mode change 100755 => 100644 src/archive/templates/archive/list_publishing.html mode change 100755 => 100644 src/archive/templates/archive/list_unmanaged.html mode change 100755 => 100644 src/archive/templates/archive/list_unpublished.html mode change 100755 => 100644 src/archive/templates/base.html diff --git a/src/archive/static/style.css b/src/archive/static/style.css index 434b87b..7aa28b3 100755 --- a/src/archive/static/style.css +++ b/src/archive/static/style.css @@ -1,67 +1,4 @@ body { - margin: 0; - font-family: verdana, sans-serif; - font-size: 12px; -} - -a { - color: #bf6000; - text-decoration: none; -} - -.clr { - clear: both; -} - - -#repo-zones-nav { - padding: 5px 5px 0 10px; - background: #ffdfbf; - border-bottom: 1px solid #ff8000; -} - -#repo-zones-nav a, #repo-zones-nav span { - display: block; - float: left; - padding: 5px 20px 5px 20px; - margin-bottom: -1px; - border-width: 1px; - border-style: solid; - border-color: rgba(0,0,0,0); -} - -#repo-zones-nav .active { - background: white; - border-color: #ff8000 #ff8000 white #ff8000; -} - -#content { - padding: 10px; -} - - -.errorlist { - margin: 0; -} - -.errorlist li { - color: red; -} - - -.tags, .multiple_tags { - border-collapse: collapse; -} - -.tags td, .tags th, .multiple_tags td, .multiple_tags th { - border: 1px solid #ddd; - padding: 3px; -} - - -.list-published-tag, .list-publishing-tag { - font-size: .8em; -} -.list-publishing-tag { - color: #aaa; + background: #bbb; + background-image: url('https://static.wolnelektury.pl/static/img/backdrop/book-drawer2.jpg'); } diff --git a/src/archive/templates/archive/base.html b/src/archive/templates/archive/base.html index 281779b..1382912 100644 --- a/src/archive/templates/archive/base.html +++ b/src/archive/templates/archive/base.html @@ -2,24 +2,28 @@ {% load i18n %} {% block repo-zones-nav %} - {% trans "New" %} - {% trans "Unpublished" %} - {% trans "Publishing" %} - {% trans "Published" %} - {% trans "Archive" %} + + + {% endblock %} diff --git a/src/archive/templates/archive/file_managed.html b/src/archive/templates/archive/file_managed.html old mode 100755 new mode 100644 index 498b27b..6859429 --- a/src/archive/templates/archive/file_managed.html +++ b/src/archive/templates/archive/file_managed.html @@ -1,139 +1,158 @@ {% extends "archive/base.html" %} {% load i18n %} {% load tags %} +{% load bootstrap4 %} {% block content %} -

Plik źródłowy: {{ path }} -(sha1: {{ audiobook.source_sha1 }}). -

-

{% trans "Publishing" %}

-{% if audiobook.mp3_status or audiobook.ogg_status %} +
+
+

{% trans "Publishing" %}

+
+
+ {% if audiobook.mp3_status or audiobook.ogg_status %} +

{% trans "Publishing pending" %}

+
+ {% csrf_token %} + +
-

{% trans "Publishing pending" %}

+ {% if audiobook.mp3_status %} +
+

MP3

-
- {% csrf_token %} - -
+ {% tags_table audiobook.mp3_tags.tags %} +

Status: {{ audiobook.get_mp3_status_display }}

+ {% endif %} -{% if audiobook.mp3_status %} -
-

MP3

- - {% tags_table audiobook.mp3_tags.tags %} - -

Status: {{ audiobook.get_mp3_status_display }}

-{% endif %} - -{% if audiobook.ogg_status %} -
-

Ogg Vorbis

- - {% tags_table audiobook.ogg_tags.tags %} - -

Status: {{ audiobook.get_ogg_status_display }}

-{% endif %} + {% if audiobook.ogg_status %} +
+

Ogg Vorbis

+ {% tags_table audiobook.ogg_tags.tags %} +

Status: {{ audiobook.get_ogg_status_display }}

+ {% endif %} + {% else %} -{% else %} - +
{% tags_table audiobook.new_publish_tags 0 %} -
- {% if user_can_publish %} -
- {% csrf_token %} - -
- {% else %} - Podłącz się - {% endif %} - - {% if not audiobook.mp3_published or not audiobook.ogg_published %} -
- {% csrf_token %} - + {% if user_can_publish %} + + {% csrf_token %} + +
+ {% else %} + Podłącz się + {% endif %} + + {% if not audiobook.mp3_published or not audiobook.ogg_published %} +
+ {% csrf_token %} +
{% endif %} + +
-{% endif %} - -
-{% if audiobook.mp3_file %} -

{% trans "MP3 file" %}

-

{% trans "Download MP3 file." %}

- {% if audiobook.mp3_published %} -

{% trans "Published:" %} {{ audiobook.mp3_published }}

- {% if audiobook.mp3_published_tags.tags %} - {% tags_table audiobook.mp3_published_tags.tags %} - {% endif %} - {% else %} -

{% trans "Not published yet." %}

+ {% endif %} -{% else %} -

{% trans "MP3 file hasn't been generated yet." %}

-{% endif %} - -
-{% if audiobook.ogg_file %} -

{% trans "Ogg Vorbis file" %}

-

{% trans "Download Ogg Vorbis file." %}

- {% if audiobook.ogg_published %} -

{% trans "Published:" %} {{ audiobook.ogg_published }}

- {% if audiobook.ogg_published_tags.tags %} - {% tags_table audiobook.ogg_published_tags.tags %} +
+
+ + +
+
+
+
+

{% trans "MP3 file" %}

+
+
+ {% if audiobook.mp3_file %} +

{% trans "Download MP3 file." %}

+ {% if audiobook.mp3_published %} +

{% trans "Published:" %} {{ audiobook.mp3_published }}

+ {% if audiobook.mp3_published_tags.tags %} + {% tags_table audiobook.mp3_published_tags.tags %} + {% endif %} + {% else %} +

{% trans "Not published yet." %}

+ {% endif %} + {% else %} +

{% trans "MP3 file hasn't been generated yet." %}

{% endif %} - {% else %} -

{% trans "Not published yet." %}

- {% endif %} -{% else %} -

{% trans "Ogg Vorbis file hasn't been generated yet." %}

-{% endif %} - - - - -
- - - - -

{% trans "Update tags" %}

- -Last modified: {{ audiobook.modified }} - -{% multiple_tags_table tags %} - - - -
- {% csrf_token %} - - {{ form.as_table }} - -
-
- - - -
- - - -
- {% csrf_token %} - -
- - +
+
+
+ +
+
+
+

{% trans "Ogg Vorbis file" %}

+
+
+ {% if audiobook.ogg_file %} +

{% trans "Download Ogg Vorbis file." %}

+ {% if audiobook.ogg_published %} +

{% trans "Published:" %} {{ audiobook.ogg_published }}

+ {% if audiobook.ogg_published_tags.tags %} + {% tags_table audiobook.ogg_published_tags.tags %} + {% endif %} + {% else %} +

{% trans "Not published yet." %}

+ {% endif %} + {% else %} +

{% trans "Ogg Vorbis file hasn't been generated yet." %}

+ {% endif %} +
+
+
+ +
+
+
+

Plik źródłowy

+
+
+

Last modified: {{ audiobook.modified }}

+

Plik źródłowy: {{ path }} + (sha1: {{ audiobook.source_sha1 }}). +

+ {% multiple_tags_table tags %} + +
+ {% csrf_token %} + +
+ +
+
+
+ +
+
+
+

{% trans "Update tags" %}

+
+
+ +
+ {% csrf_token %} + {% bootstrap_form form %} + +
+ +
+
+
+
{% endblock %} diff --git a/src/archive/templates/archive/file_new.html b/src/archive/templates/archive/file_new.html index acc161d..9dc17d4 100644 --- a/src/archive/templates/archive/file_new.html +++ b/src/archive/templates/archive/file_new.html @@ -1,23 +1,31 @@ {% extends "archive/base.html" %} -{% load i18n tags %} +{% load i18n tags bootstrap4 %} {% block content %} -
- {% csrf_token %} - -
+
+
+

{{ filename }}

+
+
+
+ {% csrf_token %} + +
+
-{% multiple_tags_table tags %} + {% multiple_tags_table tags %} +
+ +
+ {% csrf_token %} + {% bootstrap_form form %} + +
+
+
-
- {% csrf_token %} - - {{ form.as_table }} - -
-
{% endblock %} diff --git a/src/archive/templates/archive/file_unmanaged.html b/src/archive/templates/archive/file_unmanaged.html old mode 100755 new mode 100644 index 89f79ba..a05d556 --- a/src/archive/templates/archive/file_unmanaged.html +++ b/src/archive/templates/archive/file_unmanaged.html @@ -1,5 +1,6 @@ {% extends "archive/base.html" %} {% load i18n %} +{% load tags %} {% block messages %} {% if err_exists %} @@ -10,22 +11,19 @@ {% block content %} +
+
+

{{ filename }}

+
+
+ {% multiple_tags_table tags %} -
    - {% for t, v in tags.items %} -
  • {{t}} -
      - {% for x in v %} -
    • {{x}}
    • - {% endfor %} -
  • - {% endfor %} -
+
+ {% csrf_token %} + +
+
+
-
- {% csrf_token %} - -
- {% endblock %} diff --git a/src/archive/templates/archive/list.html b/src/archive/templates/archive/list.html index bcd85de..9d53422 100644 --- a/src/archive/templates/archive/list.html +++ b/src/archive/templates/archive/list.html @@ -4,12 +4,20 @@ {% block content %} -
-

{% block file-list-title %}{% endblock %}

-
{% block file-list-info %}{% endblock %}
- {% block file-list-wrapper %} - - {% endblock file-list-wrapper %} +
+
+

{% block file-list-title %}{% endblock %}

+
+
+
+ {% block file-list-info %}{% endblock %}
+ {% block file-list-wrapper %} + + {% block file-list %}{% endblock %} +
+ {% endblock %} +
+
{% endblock %} diff --git a/src/archive/templates/archive/list_new.html b/src/archive/templates/archive/list_new.html index 28019cd..5e804ca 100644 --- a/src/archive/templates/archive/list_new.html +++ b/src/archive/templates/archive/list_new.html @@ -9,14 +9,16 @@ {% block file-list-info %} {% trans "Put source audiobooks in:" %} - {{ path }} + {{ path }} {% endblock %} {% block file-list %} - {% for file in objects %} -
  • - {{ file }} -
  • - {% endfor %} + {% for file in objects %} + + + {{ file }} + + + {% endfor %} {% endblock %} diff --git a/src/archive/templates/archive/list_published.html b/src/archive/templates/archive/list_published.html old mode 100755 new mode 100644 index 5e61ba1..04396f6 --- a/src/archive/templates/archive/list_published.html +++ b/src/archive/templates/archive/list_published.html @@ -12,9 +12,11 @@ {% block file-list %} - {% for file in objects %} -
  • - {{ file }} -
  • - {% endfor %} + {% for file in objects %} + + + {{ file }} + + + {% endfor %} {% endblock %} diff --git a/src/archive/templates/archive/list_publishing.html b/src/archive/templates/archive/list_publishing.html old mode 100755 new mode 100644 index 055f05b..3cccbaa --- a/src/archive/templates/archive/list_publishing.html +++ b/src/archive/templates/archive/list_publishing.html @@ -9,15 +9,20 @@ {% block file-list-wrapper %} - {% for k, objects in status_objects %} -

    {{ k.1 }}

    - - {% endfor %} + {% for k, objects in status_objects %} +

    {{ k.1 }}

    + + {% for file in objects %} + + + + + + {% endfor %} +
    {{ file }} + {% if file.mp3_status == k.0 %}MP3{% endif %} + + {% if file.ogg_status == k.0 %}Ogg{% endif %} +
    + {% endfor %} {% endblock %} diff --git a/src/archive/templates/archive/list_unmanaged.html b/src/archive/templates/archive/list_unmanaged.html old mode 100755 new mode 100644 index df3ccfb..7ca92a1 --- a/src/archive/templates/archive/list_unmanaged.html +++ b/src/archive/templates/archive/list_unmanaged.html @@ -12,8 +12,10 @@ {% block file-list %} {% for file in objects %} -
  • + + {{ file }} -
  • + + {% endfor %} {% endblock %} diff --git a/src/archive/templates/archive/list_unpublished.html b/src/archive/templates/archive/list_unpublished.html old mode 100755 new mode 100644 index b901ef0..d51b66b --- a/src/archive/templates/archive/list_unpublished.html +++ b/src/archive/templates/archive/list_unpublished.html @@ -12,21 +12,29 @@ {% block file-list %} - {% for file in objects %} -
  • - {{ file }} - - {% if file.mp3_published %} - MP3 - {% else %}{% if file.mp3_status %} - MP3 - {% endif %}{% endif %} - - {% if file.ogg_published %} - Ogg - {% else %}{% if file.ogg_status %} - Ogg - {% endif %}{% endif %} -
  • - {% endfor %} + {% for file in objects %} + + + {{ file }} + + + {% if file.mp3_published %} + MP3 + {% else %} + {% if file.mp3_status %} + MP3 + {% endif %} + {% endif %} + + + {% if file.ogg_published %} + Ogg + {% else %} + {% if file.ogg_status %} + Ogg + {% endif %} + {% endif %} + + + {% endfor %} {% endblock %} diff --git a/src/archive/templates/archive/tags/multiple_tags_table.html b/src/archive/templates/archive/tags/multiple_tags_table.html index 4609278..142299e 100755 --- a/src/archive/templates/archive/tags/multiple_tags_table.html +++ b/src/archive/templates/archive/tags/multiple_tags_table.html @@ -1,4 +1,4 @@ -{% if table %}{% endif %} +{% if table %}
    {% endif %} {% for t, v in tags.items %}
    {{ t }} {% for x in v %} diff --git a/src/archive/templates/archive/tags/tags_table.html b/src/archive/templates/archive/tags/tags_table.html index 70b9d48..040c62a 100755 --- a/src/archive/templates/archive/tags/tags_table.html +++ b/src/archive/templates/archive/tags/tags_table.html @@ -1,4 +1,4 @@ -{% if table %}{% endif %} +{% if table %}
    {% endif %} {% for t, v in tags.items %}
    {{ t }} {{ v|linebreaksbr }} diff --git a/src/archive/templates/base.html b/src/archive/templates/base.html old mode 100755 new mode 100644 index 4b69db8..d3db485 --- a/src/archive/templates/base.html +++ b/src/archive/templates/base.html @@ -1,22 +1,27 @@ -{% load i18n static %} +{% load i18n static %} + + + + {% trans "Audiobook repository" %} -
    +
    + + -
    +
    {% block messages %}{% endblock %}
    -
    +
    {% block content %}{% endblock %}
    diff --git a/src/archive/views.py b/src/archive/views.py index 98556ef..55f4f07 100644 --- a/src/archive/views.py +++ b/src/archive/views.py @@ -65,7 +65,7 @@ def file_new(request, filename): d[tag] = None if not request.POST: - form = AudiobookForm(d) + form = AudiobookForm(initial=d) return render(request, "archive/file_new.html", locals()) diff --git a/src/audiobooks/settings.py b/src/audiobooks/settings.py index 714fadb..d87cc00 100644 --- a/src/audiobooks/settings.py +++ b/src/audiobooks/settings.py @@ -131,6 +131,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', + 'bootstrap4', 'apiclient', 'archive', -- 2.20.1