Use a materialized Extension.latest_version field instead of a dynamic property #152
@ -102,6 +102,12 @@
|
||||
|
||||
/* Lightbox component. */
|
||||
.galleria
|
||||
--galleria-btn-width: 100px
|
||||
--galleria-media-max-width: 100%
|
||||
|
||||
+media-lg
|
||||
--galleria-media-max-width: calc(100% - calc(var(--galleria-btn-width) * 1.5))
|
||||
|
||||
align-items: center
|
||||
display: flex
|
||||
inset: 0 0 0 0
|
||||
@ -110,19 +116,21 @@
|
||||
position: fixed
|
||||
z-index: var(--z-index-galleria)
|
||||
|
||||
img
|
||||
img, video
|
||||
max-height: 100%
|
||||
max-width: 100%
|
||||
max-width: var(--galleria-media-max-width)
|
||||
object-fit: contain
|
||||
|
||||
/* Previous/Next buttons.*/
|
||||
.btn
|
||||
background: transparent
|
||||
border: none
|
||||
color: white
|
||||
cursor: pointer
|
||||
font-size: 5.6rem
|
||||
height: 100vh
|
||||
max-width: 200px
|
||||
max-height: 300px
|
||||
max-width: var(--galleria-btn-width)
|
||||
opacity: .6
|
||||
outline: 0
|
||||
position: absolute
|
||||
@ -137,12 +145,7 @@
|
||||
color: white
|
||||
opacity: 1
|
||||
|
||||
svg
|
||||
opacity: 0
|
||||
transition: all var(--transition-speed) var(--transition-ease-bezier)
|
||||
|
||||
&.btn-close
|
||||
fill: white
|
||||
font-size: 3.2rem
|
||||
height: 20vh
|
||||
max-height: 80px
|
||||
|
@ -1,3 +1,7 @@
|
||||
.dropdown-menu-filter
|
||||
.dropdown-item
|
||||
align-items: center
|
||||
|
||||
.dropdown-filter-sort
|
||||
@extend .box
|
||||
|
||||
@ -18,7 +22,7 @@
|
||||
|
||||
&.is-visible
|
||||
display: grid
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(3, 1fr)
|
||||
|
||||
.dropdown-menu-filter-sort
|
||||
max-height: calc(var(--spacer) * 24.25)
|
||||
|
@ -29,7 +29,7 @@
|
||||
{{ tag.name }}
|
||||
{# TODO: @back-end add tags count dynamic #}
|
||||
{% comment %}
|
||||
<div class="align-items-center bg-secondary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
1
|
||||
</div>
|
||||
{% endcomment %}
|
||||
@ -37,7 +37,7 @@
|
||||
All
|
||||
{# TODO: @back-end add tags count dynamic #}
|
||||
{% comment %}
|
||||
<div class="align-items-center bg-secondary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
1
|
||||
</div>
|
||||
{% endcomment %}
|
||||
@ -52,7 +52,7 @@
|
||||
<a class="dropdown-item {% if not tag.name %}is-active{% endif %}" href="/{{ tag.get_type_display|slugify }}s/">
|
||||
All
|
||||
{% comment %}
|
||||
<div class="align-items-center bg-secondary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
1
|
||||
</div>
|
||||
{% endcomment %}
|
||||
@ -65,7 +65,7 @@
|
||||
{{ list_tag.name }}
|
||||
|
||||
{% comment %}
|
||||
<div class="align-items-center bg-secondary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
|
||||
1
|
||||
</div>
|
||||
{% endcomment %}
|
||||
|
@ -1,10 +1,47 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from common.tests.factories.extensions import create_version
|
||||
from files.models import File
|
||||
|
||||
|
||||
class ApproveExtensionTest(TestCase):
|
||||
fixtures = ['licenses']
|
||||
|
||||
def test_approve_extension(self): # TODO
|
||||
create_version().extension
|
||||
def test_approve_extension(self):
|
||||
first_version = create_version()
|
||||
extension = first_version.extension
|
||||
self.assertFalse(extension.is_listed)
|
||||
extension.approve()
|
||||
self.assertTrue(extension.is_listed)
|
||||
|
||||
# auto approve of new versions
|
||||
new_version = create_version(extension=extension)
|
||||
extension.refresh_from_db()
|
||||
self.assertEqual(new_version, extension.latest_version)
|
||||
self.assertTrue(new_version.is_listed)
|
||||
self.assertTrue(extension.is_listed)
|
||||
|
||||
# TODO stop supporting direct file status updates, introduce methods for Version object
|
||||
# that would replace the signals logic
|
||||
|
||||
# latest_version of approved extension must be listed
|
||||
# check that we rollback latest_version when file is not approved
|
||||
new_version.file.status = File.STATUSES.AWAITING_REVIEW
|
||||
new_version.file.save()
|
||||
self.assertFalse(new_version.is_listed)
|
||||
extension.refresh_from_db()
|
||||
self.assertEqual(first_version, extension.latest_version)
|
||||
self.assertTrue(extension.is_listed)
|
||||
|
||||
# break the first_version, check that nothing is listed anymore
|
||||
first_version.file.status = File.STATUSES.AWAITING_REVIEW
|
||||
first_version.file.save()
|
||||
self.assertFalse(first_version.is_listed)
|
||||
extension.refresh_from_db()
|
||||
self.assertFalse(extension.is_listed)
|
||||
|
||||
# this looks weird, but that's the current definition of latest_version, it's different
|
||||
# for listed and unlisted extensions:
|
||||
# now the extension is not listed, its latest_version doesn't have to be the latest
|
||||
# listed version
|
||||
self.assertEqual(new_version, extension.latest_version)
|
||||
|
Loading…
Reference in New Issue
Block a user