[FIX] Deuxième vague de fixes pour la mise à jour de mars (#619)

This commit is contained in:
Julien Constant 2023-04-06 16:09:29 +02:00 committed by GitHub
parent e638bc04ed
commit fa6527b24f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 231 additions and 172 deletions

View File

@ -1,6 +1,15 @@
$hovered-text-color: #c2c2c2;
$text-color: white;
$background-color: #354a5f;
$background-color-hovered: #283747;
$red-text-color: #eb2f06;
$hovered-red-text-color: #ff4d4d;
.header { .header {
box-sizing: border-box; box-sizing: border-box;
background-color: #354a5f; background-color: $background-color;
box-shadow: 3px 3px 3px 0 #dfdfdf; box-shadow: 3px 3px 3px 0 #dfdfdf;
border-radius: 0; border-radius: 0;
width: 100%; width: 100%;
@ -24,11 +33,11 @@
gap: 10px; gap: 10px;
>a { >a {
color: #fff; color: $text-color;
} }
&:hover>a { &:hover>a {
color: #1a78b3; color: $hovered-text-color;
} }
@media (max-width: 607px) { @media (max-width: 607px) {
@ -51,7 +60,7 @@
} }
&-text { &-text {
color: white; color: $text-color;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
@ -89,16 +98,16 @@
border-radius: 0; border-radius: 0;
margin: 0; margin: 0;
box-sizing: border-box; box-sizing: border-box;
background-color: #354a5f; background-color: $background-color;
width: 45px; width: 45px;
height: 25px; height: 25px;
padding: 0; padding: 0;
color: white; color: $text-color;
font-weight: normal; font-weight: normal;
line-height: 1.3em; line-height: 1.3em;
&:hover { &:hover {
background-color: #283747; background-color: $background-color-hovered;
} }
} }
} }
@ -126,13 +135,13 @@
align-items: center; align-items: center;
text-transform: uppercase; text-transform: uppercase;
text-decoration: none; text-decoration: none;
color: white; color: $text-color;
margin: 0; margin: 0;
font-size: .9em; font-size: .9em;
width: 120px; width: 120px;
&:hover { &:hover {
background-color: #283747; background-color: $background-color-hovered;
} }
} }
} }
@ -198,30 +207,34 @@
> a { > a {
display: block; display: block;
width: 40px; min-width: 40px;
height: 40px; height: 40px;
border-radius: 50%; border-radius: 50%;
background-position: center center; background-position: center center;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #354a5f; background-color: $background-color;
} }
>.options { >.options {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 2px; gap: 5px;
>.username { >.username {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
gap: 5px; gap: 5px;
@media (max-width: 500px) {
justify-content: flex-start;
}
>a { >a {
color: white; color: $text-color;
&:hover { &:hover {
color: #1a78b3; color: $hovered-text-color;
} }
} }
} }
@ -230,7 +243,7 @@
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
gap: 5px; gap: 15px;
@media (max-width: 1200px) { @media (max-width: 1200px) {
justify-content: flex-start; justify-content: flex-start;
@ -238,17 +251,17 @@
>a { >a {
text-align: right; text-align: right;
color: white; color: $text-color;
&:hover { &:hover {
color: #1a78b3; color: $hovered-text-color;
} }
&:last-child { &:last-child {
color: #eb2f06; color: $red-text-color;
&:hover { &:hover {
color: #cc2804; color: $hovered-red-text-color;
} }
} }
} }
@ -265,16 +278,16 @@
position: relative; position: relative;
>a { >a {
color: white; color: $text-color;
position: relative; position: relative;
font-size: 25px; font-size: 25px;
&:hover { &:hover {
color: #1a78b3; color: $hovered-text-color;
} }
>span { >span {
color: white; color: $text-color;
font-size: 14px; font-size: 14px;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -282,7 +295,7 @@
width: 10px; width: 10px;
height: 10px; height: 10px;
padding: 5px; padding: 5px;
background-color: #eb2f06; background-color: $red-text-color;
border-radius: 50%; border-radius: 50%;
position: absolute; position: absolute;
top: -50%; top: -50%;
@ -388,9 +401,13 @@
border-radius: 5px; border-radius: 5px;
font-size: .9em; font-size: .9em;
margin: 0; margin: 0;
background-color: #283747; background-color: $background-color-hovered;
padding: 0 10px; padding: 0 10px;
color: white; color: $text-color;
&::placeholder {
color: $hovered-text-color;
}
} }
} }
} }
@ -418,10 +435,10 @@
>li>a { >li>a {
display: flex; display: flex;
color: white; color: $text-color;
&:hover { &:hover {
color: #1a78b3; color: $hovered-text-color;
} }
>span { >span {

View File

@ -1,13 +1,9 @@
nav.navbar { nav.navbar {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
background-color: hsl(203, 75%, 40%); background-color: hsl(203, 75%, 40%);
margin: 1em; margin: 1em;
color: white; color: white;
border-radius: 0.6em; border-radius: 0.6em;
min-height: 40px;
@media (max-width: 500px) { @media (max-width: 500px) {
position: relative; position: relative;
@ -17,92 +13,124 @@ nav.navbar {
margin: .2em; margin: .2em;
} }
> .menu, > .expand-button {
> .link { background-color: transparent;
box-sizing: border-box; display: none;
width: 130px;
height: 52px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
@media (max-width: 500px) {
width: 100%;
height: auto;
justify-content: flex-start;
&:first-child {
border-radius: .6em .6em 0 0;
}
&:last-child {
border-radius: 0 0 .6em .6em;
> .content {
box-shadow: 3px 3px 3px 0 #dfdfdf;
}
}
}
}
> .menu > .head,
> .link {
color: white;
padding: 10px 20px;
box-sizing: border-box;
@media (max-width: 500px) {
padding: 10px;
}
}
.link:hover,
.menu:hover {
background-color: rgba(0, 0, 0, .2);
}
> .menu:hover > .content,
> .menu > .head:hover + .content,
> .menu > .content:hover {
display: flex;
}
> .menu {
display: flex;
position: relative; position: relative;
padding: 10px;
cursor: pointer;
width: 40px;
height: 40px;
justify-content: center;
align-items: center;
margin: 0;
> .content { > i {
z-index: 10; font-size: 1.5em;
display: none; color: white;
position: absolute; }
top: 100%;
background-color: white; @media (max-width: 500px) {
margin: 0; display: flex;
list-style-type: none; }
}
> .content {
@media (min-width: 500px) {display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
display: flex !important;
}
> .menu,
> .link {
box-sizing: border-box;
width: 130px; width: 130px;
box-shadow: 3px 3px 3px 0 #dfdfdf; height: 52px;
flex-direction: column; display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
@media (max-width: 500px) { @media (max-width: 500px) {
position: absolute;
flex-direction: row;
flex-wrap: wrap;
width: 100%; width: 100%;
box-shadow: inset 3px 3px 3px 0 #dfdfdf; height: auto;
} justify-content: flex-start;
> li > a { &:first-child {
display: flex; border-radius: .6em .6em 0 0;
padding: 15px 20px;
@media (max-width: 500px) {
padding: 10px;
} }
&:hover { &:last-child {
color: hsl(203, 75%, 40%); border-radius: 0 0 .6em .6em;
background-color: rgba(0, 0, 0, .05);
> .content {
box-shadow: 3px 3px 3px 0 #dfdfdf;
}
}
}
}
> .menu > .head,
> .link {
color: white;
padding: 10px 20px;
box-sizing: border-box;
@media (max-width: 500px) {
padding: 10px;
}
}
.link:hover,
.menu:hover {
background-color: rgba(0, 0, 0, .2);
}
> .menu:hover > .content,
> .menu > .head:hover + .content,
> .menu > .content:hover {
display: flex;
}
> .menu {
display: flex;
position: relative;
> .content {
z-index: 10;
display: none;
position: absolute;
top: 100%;
background-color: white;
margin: 0;
list-style-type: none;
width: 130px;
box-shadow: 3px 3px 3px 0 #dfdfdf;
flex-direction: column;
@media (max-width: 500px) {
position: absolute;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
box-shadow: inset 3px 3px 3px 0 #dfdfdf;
}
> li > a {
display: flex;
padding: 15px 20px;
@media (max-width: 500px) {
padding: 10px;
}
&:hover {
color: hsl(203, 75%, 40%);
background-color: rgba(0, 0, 0, .05);
}
} }
} }
} }

View File

@ -160,6 +160,7 @@ main {
> .photo, > .photo,
> .album { > .album {
box-sizing: border-box; box-sizing: border-box;
background-color: #333333;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
@ -167,6 +168,10 @@ main {
width: calc(16 / 9 * 128px); width: calc(16 / 9 * 128px);
height: 128px; height: 128px;
&.vertical {
background-size: contain;
}
margin: 0; margin: 0;
padding: 0; padding: 0;
box-shadow: none; box-shadow: none;

View File

@ -70,7 +70,7 @@
> #next { > #next {
width: calc(50% - 5px); width: calc(50% - 5px);
aspect-ratio: 16/9; aspect-ratio: 16/9;
background: #aaa; background: #333333;
> a { > a {
display: flex; display: flex;
@ -241,6 +241,7 @@
> .infos { > .infos {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 50%;
> div > div { > div > div {
display: flex; display: flex;
@ -260,7 +261,7 @@
> .tools { > .tools {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 50%;
> div { > div {
display: flex; display: flex;

View File

@ -16,7 +16,6 @@
{# Thile file is quite heavy (around 250kb), so declaring it in a block allows easy removal #} {# Thile file is quite heavy (around 250kb), so declaring it in a block allows easy removal #}
<link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}"> <link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
{% endblock %} {% endblock %}
<link rel="preload" as="style" href="{{ static('core/font-awesome/css/font-awesome.min.css') }}" onload="this.onload=null;this.rel='stylesheet'"> <link rel="preload" as="style" href="{{ static('core/font-awesome/css/font-awesome.min.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ static('core/font-awesome/css/font-awesome.min.css') }}"></noscript> <noscript><link rel="stylesheet" href="{{ static('core/font-awesome/css/font-awesome.min.css') }}"></noscript>
<script defer href="{{ static('core/font-awesome/js/fontawesone.min.js') }}"></script> <script defer href="{{ static('core/font-awesome/js/fontawesone.min.js') }}"></script>
@ -196,52 +195,55 @@
{% block nav %} {% block nav %}
{% if not popup %} {% if not popup %}
<nav class="navbar"> <nav class="navbar">
<a class="link" href="{{ url('core:index') }}">{% trans %}Main{% endtrans %}</a> <button class="expand-button" onclick="showMenu()"><i class="fa fa-bars"></i></button>
<div class="menu"> <div id="navbar-content" class="content" style="display: none;">
<span class="head">{% trans %}Associations & Clubs{% endtrans %}</span> <a class="link" href="{{ url('core:index') }}">{% trans %}Main{% endtrans %}</a>
<ul class="content"> <div class="menu">
<li><a href="{{ url('core:page', page_name='ae') }}">{% trans %}AE{% endtrans %}</a></li> <span class="head">{% trans %}Associations & Clubs{% endtrans %}</span>
<li><a href="{{ url('core:page', page_name='clubs') }}">{% trans %}AE's clubs{% endtrans %}</a></li> <ul class="content">
<li><a href="{{ url('core:page', page_name='bdf') }}">{% trans %}BdF{% endtrans %}</a></li> <li><a href="{{ url('core:page', page_name='ae') }}">{% trans %}AE{% endtrans %}</a></li>
<li><a href="{{ url('core:page', page_name='bds') }}">{% trans %}BDS{% endtrans %}</a></li> <li><a href="{{ url('core:page', page_name='clubs') }}">{% trans %}AE's clubs{% endtrans %}</a></li>
<li><a href="{{ url('core:page', page_name='cetu') }}">{% trans %}CETU{% endtrans %}</a></li> <li><a href="{{ url('core:page', page_name='bdf') }}">{% trans %}BdF{% endtrans %}</a></li>
<li><a href="{{ url('core:page', page_name='clubs/doceo') }}">{% trans %}Doceo{% endtrans %}</a></li> <li><a href="{{ url('core:page', page_name='bds') }}">{% trans %}BDS{% endtrans %}</a></li>
<li><a href="{{ url('core:page', page_name='positions') }}">{% trans %}Positions{% endtrans %}</a></li> <li><a href="{{ url('core:page', page_name='cetu') }}">{% trans %}CETU{% endtrans %}</a></li>
</ul> <li><a href="{{ url('core:page', page_name='clubs/doceo') }}">{% trans %}Doceo{% endtrans %}</a></li>
</div> <li><a href="{{ url('core:page', page_name='positions') }}">{% trans %}Positions{% endtrans %}</a></li>
<div class="menu"> </ul>
<span class="head">{% trans %}Events{% endtrans %}</span> </div>
<ul class="content"> <div class="menu">
<li><a href="{{ url('election:list') }}">{% trans %}Elections{% endtrans %}</a></li> <span class="head">{% trans %}Events{% endtrans %}</span>
<li><a href="{{ url('core:page', page_name='ga') }}">{% trans %}Big event{% endtrans %}</a></li> <ul class="content">
</ul> <li><a href="{{ url('election:list') }}">{% trans %}Elections{% endtrans %}</a></li>
</div> <li><a href="{{ url('core:page', page_name='ga') }}">{% trans %}Big event{% endtrans %}</a></li>
<a class="link" href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a> </ul>
<a class="link" href="{{ url('sas:main') }}">{% trans %}Gallery{% endtrans %}</a> </div>
<a class="link" href="{{ url('eboutic:main') }}">{% trans %}Eboutic{% endtrans %}</a> <a class="link" href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
<div class="menu"> <a class="link" href="{{ url('sas:main') }}">{% trans %}Gallery{% endtrans %}</a>
<span class="head">{% trans %}Services{% endtrans %}</span> <a class="link" href="{{ url('eboutic:main') }}">{% trans %}Eboutic{% endtrans %}</a>
<ul class="content"> <div class="menu">
<li><a href="{{ url('matmat:search_clear') }}">{% trans %}Matmatronch{% endtrans %}</a></li> <span class="head">{% trans %}Services{% endtrans %}</span>
<li><a href="/launderette">{% trans %}Launderette{% endtrans %}</a></li> <ul class="content">
<li><a href="{{ url('core:file_list') }}">{% trans %}Files{% endtrans %}</a></li> <li><a href="{{ url('matmat:search_clear') }}">{% trans %}Matmatronch{% endtrans %}</a></li>
<li><a href="{{ url('pedagogy:guide') }}">{% trans %}Pedagogy{% endtrans %}</a></li> <li><a href="/launderette">{% trans %}Launderette{% endtrans %}</a></li>
</ul> <li><a href="{{ url('core:file_list') }}">{% trans %}Files{% endtrans %}</a></li>
</div> <li><a href="{{ url('pedagogy:guide') }}">{% trans %}Pedagogy{% endtrans %}</a></li>
<div class="menu"> </ul>
<span class="head">{% trans %}My Benefits{% endtrans %}</span> </div>
<ul class="content"> <div class="menu">
<li><a href="{{ url('core:page', page_name='partenaires')}}">{% trans %}Sponsors{% endtrans %}</a></li> <span class="head">{% trans %}My Benefits{% endtrans %}</span>
<li><a href="{{ url('core:page', page_name='avantages') }}">{% trans %}Subscriber benefits{% endtrans %}</a></li> <ul class="content">
</ul> <li><a href="{{ url('core:page', page_name='partenaires')}}">{% trans %}Sponsors{% endtrans %}</a></li>
</div> <li><a href="{{ url('core:page', page_name='avantages') }}">{% trans %}Subscriber benefits{% endtrans %}</a></li>
<div class="menu"> </ul>
<span class="head">{% trans %}Help{% endtrans %}</span> </div>
<ul class="content"> <div class="menu">
<li><a href="{{ url('core:page', page_name='FAQ') }}">{% trans %}FAQ{% endtrans %}</a></li> <span class="head">{% trans %}Help{% endtrans %}</span>
<li><a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a></li> <ul class="content">
<li><a href="{{ url('core:page', page_name='Index') }}">{% trans %}Wiki{% endtrans %}</a></li> <li><a href="{{ url('core:page', page_name='FAQ') }}">{% trans %}FAQ{% endtrans %}</a></li>
</ul> <li><a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a></li>
<li><a href="{{ url('core:page', page_name='Index') }}">{% trans %}Wiki{% endtrans %}</a></li>
</ul>
</div>
</div> </div>
</nav> </nav>
{% endif %} {% endif %}
@ -308,6 +310,13 @@
<script src="{{ static('ajax_select/js/ajax_select.js') }}"></script> <script src="{{ static('ajax_select/js/ajax_select.js') }}"></script>
<script src="{{ url('javascript-catalog') }}"></script> <script src="{{ url('javascript-catalog') }}"></script>
<script> <script>
function showMenu() {
let navbar = document.getElementById("navbar-content");
const current = navbar.style.getPropertyValue("display");
navbar.style.setProperty("display", current == "none" ? "block" : "none");
}
</script>
<script>
$('.select_date').datepicker({ $('.select_date').datepicker({
changeMonth: true, changeMonth: true,
changeYear: true, changeYear: true,

View File

@ -63,7 +63,12 @@ class Picture(SithFile):
return (w / h) < 1 return (w / h) < 1
def can_be_edited_by(self, user): def can_be_edited_by(self, user):
return user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) perm = cache.get("%d_can_edit_pictures" % (user.id), None)
if perm is None:
perm = user.is_root or user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID)
cache.set("%d_can_edit_pictures" % (user.id), perm, timeout=4)
return perm
def can_be_viewed_by(self, user): def can_be_viewed_by(self, user):
# SAS pictures are visible to old subscribers # SAS pictures are visible to old subscribers
@ -72,19 +77,13 @@ class Picture(SithFile):
return False return False
perm = cache.get("%d_can_view_pictures" % (user.id), False) perm = cache.get("%d_can_view_pictures" % (user.id), False)
if not perm:
perm = user.was_subscribed
# use cache only when user is in SAS Admins or when picture is moderated
if perm and (self.is_moderated or self.can_be_edited_by(user)):
return perm
perm = (
self.is_in_sas
and (self.is_moderated or self.can_be_edited_by(user))
and user.was_subscribed
)
cache.set("%d_can_view_pictures" % (user.id), perm, timeout=4) cache.set("%d_can_view_pictures" % (user.id), perm, timeout=4)
return (perm and self.is_moderated and self.is_in_sas) or self.can_be_edited_by(
return perm user
)
def get_download_url(self): def get_download_url(self):
return reverse("sas:download", kwargs={"picture_id": self.id}) return reverse("sas:download", kwargs={"picture_id": self.id})

View File

@ -88,7 +88,7 @@
{% if p.can_be_viewed_by(user) %} {% if p.can_be_viewed_by(user) %}
<a href="{{ url('sas:picture', picture_id=p.id) }}#pict"> <a href="{{ url('sas:picture', picture_id=p.id) }}#pict">
<div <div
class="photo" class="photo {% if p.is_vertical %}vertical{% endif %}"
style="background-image: url('{{ p.get_download_thumb_url() }}')" style="background-image: url('{{ p.get_download_thumb_url() }}')"
> >
{% if not p.is_moderated %} {% if not p.is_moderated %}

View File

@ -38,7 +38,7 @@
<h3>{{ picture.get_display_name() }}</h3> <h3>{{ picture.get_display_name() }}</h3>
<h4>{{ picture.parent.children.filter(id__lte=picture.id).count() }} / {{ picture.parent.children.count() }}</h4> <h4>{{ picture.parent.children.filter(id__lte=picture.id).count() }} / {{ picture.parent.children.count() }}</h4>
</div> </div>
<br>
{% if not picture.is_moderated %} {% if not picture.is_moderated %}
{% set next = picture.get_next() %} {% set next = picture.get_next() %}