Merge pull request #896 from ae-utbm/relpace-select2

Replace selec2 with tom-select
This commit is contained in:
Bartuccio Antoine 2024-10-18 00:24:09 +02:00 committed by GitHub
commit b9cbba2309
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 924 additions and 867 deletions

View File

@ -28,6 +28,7 @@ input[type="file"] {
font-size: 1.2em; font-size: 1.2em;
border-radius: 5px; border-radius: 5px;
color: black; color: black;
&:hover { &:hover {
background: hsl(0, 0%, 83%); background: hsl(0, 0%, 83%);
} }
@ -63,6 +64,7 @@ textarea[type="text"],
border-radius: 5px; border-radius: 5px;
max-width: 95%; max-width: 95%;
} }
textarea { textarea {
border: none; border: none;
text-decoration: none; text-decoration: none;
@ -72,6 +74,7 @@ textarea {
border-radius: 5px; border-radius: 5px;
font-family: sans-serif; font-family: sans-serif;
} }
select { select {
border: none; border: none;
text-decoration: none; text-decoration: none;
@ -85,9 +88,11 @@ select {
a:not(.button) { a:not(.button) {
text-decoration: none; text-decoration: none;
color: $primary-dark-color; color: $primary-dark-color;
&:hover { &:hover {
color: $primary-light-color; color: $primary-light-color;
} }
&:active { &:active {
color: $primary-color; color: $primary-color;
} }
@ -116,7 +121,9 @@ a:not(.button) {
} }
@keyframes rotate { @keyframes rotate {
100% { transform: rotate(360deg); } 100% {
transform: rotate(360deg);
}
} }
.ib { .ib {
@ -143,11 +150,13 @@ a:not(.button) {
.collapse-header-icon { .collapse-header-icon {
transition: all ease-in-out 150ms; transition: all ease-in-out 150ms;
&.reverse { &.reverse {
transform: rotate(180deg); transform: rotate(180deg);
} }
} }
} }
.collapse-body { .collapse-body {
padding: 10px; padding: 10px;
} }
@ -202,9 +211,11 @@ a:not(.button) {
font-size: 0.9em; font-size: 0.9em;
margin: 0.2em; margin: 0.2em;
border-radius: 0.6em; border-radius: 0.6em;
.markdown { .markdown {
margin: 0.5em; margin: 0.5em;
} }
&:before { &:before {
font-family: FontAwesome; font-family: FontAwesome;
font-size: 4em; font-size: 4em;
@ -212,15 +223,19 @@ a:not(.button) {
margin: 0.2em; margin: 0.2em;
} }
} }
#info_box { #info_box {
background: $primary-neutral-light-color; background: $primary-neutral-light-color;
&:before { &:before {
content: "\f05a"; content: "\f05a";
color: hsl(210, 100%, 56%); color: hsl(210, 100%, 56%);
} }
} }
#alert_box { #alert_box {
background: $second-color; background: $second-color;
&:before { &:before {
content: "\f06a"; content: "\f06a";
color: $white-color; color: $white-color;
@ -240,7 +255,8 @@ a:not(.button) {
#page { #page {
width: 90%; width: 90%;
margin: 20px auto 0; margin: 20px auto 0;
/*---------------------------------NAV---------------------------------*/
/*---------------------------------NAV---------------------------------*/
.btn { .btn {
font-size: 15px; font-size: 15px;
font-weight: normal; font-weight: normal;
@ -252,9 +268,11 @@ a:not(.button) {
&.btn-blue { &.btn-blue {
background-color: $deepblue; background-color: $deepblue;
&:not(:disabled):hover { &:not(:disabled):hover {
background-color: darken($deepblue, 10%); background-color: darken($deepblue, 10%);
} }
&:disabled { &:disabled {
background-color: rgba(70, 90, 126, 0.4); background-color: rgba(70, 90, 126, 0.4);
} }
@ -262,9 +280,11 @@ a:not(.button) {
&.btn-grey { &.btn-grey {
background-color: grey; background-color: grey;
&:not(:disabled):hover { &:not(:disabled):hover {
background-color: darken(gray, 15%); background-color: darken(gray, 15%);
} }
&:disabled { &:disabled {
background-color: lighten(gray, 15%); background-color: lighten(gray, 15%);
} }
@ -273,9 +293,11 @@ a:not(.button) {
&.btn-red { &.btn-red {
background-color: #fc8181; background-color: #fc8181;
color: black; color: black;
&:not(:disabled):hover { &:not(:disabled):hover {
background-color: darken(#fc8181, 15%); background-color: darken(#fc8181, 15%);
} }
&:disabled { &:disabled {
background-color: lighten(#fc8181, 15%); background-color: lighten(#fc8181, 15%);
color: grey; color: grey;
@ -287,12 +309,13 @@ a:not(.button) {
} }
} }
/*--------------------------------CONTENT------------------------------*/ /*--------------------------------CONTENT------------------------------*/
#quick_notif { #quick_notif {
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
list-style-type: none; list-style-type: none;
background: $second-color; background: $second-color;
li { li {
padding: 10px; padding: 10px;
} }
@ -350,6 +373,7 @@ a:not(.button) {
.tool_bar { .tool_bar {
overflow: auto; overflow: auto;
padding: 4px; padding: 4px;
.tools { .tools {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -358,6 +382,7 @@ a:not(.button) {
padding: 5px; padding: 5px;
border-radius: 6px; border-radius: 6px;
text-align: center; text-align: center;
a { a {
padding: 7px; padding: 7px;
display: inline-block; display: inline-block;
@ -367,11 +392,13 @@ a:not(.button) {
flex: 1; flex: 1;
flex-wrap: nowrap; flex-wrap: nowrap;
white-space: nowrap; white-space: nowrap;
&.selected_tab { &.selected_tab {
background: $primary-color; background: $primary-color;
color: $white-color; color: $white-color;
border-radius: 6px; border-radius: 6px;
} }
&:hover { &:hover {
background: $primary-color; background: $primary-color;
color: $white-color; color: $white-color;
@ -381,7 +408,7 @@ a:not(.button) {
} }
} }
/*---------------------------------NEWS--------------------------------*/ /*---------------------------------NEWS--------------------------------*/
#news { #news {
display: flex; display: flex;
@ -394,17 +421,21 @@ a:not(.button) {
margin: 0; margin: 0;
vertical-align: top; vertical-align: top;
} }
#news_admin { #news_admin {
margin-bottom: 1em; margin-bottom: 1em;
} }
#right_column { #right_column {
flex: 20%; flex: 20%;
float: right; float: right;
margin: 0.2em; margin: 0.2em;
} }
#left_column { #left_column {
flex: 79%; flex: 79%;
margin: 0.2em; margin: 0.2em;
h3 { h3 {
background: $second-color; background: $second-color;
box-shadow: $shadow-color 1px 1px 1px; box-shadow: $shadow-color 1px 1px 1px;
@ -412,19 +443,22 @@ a:not(.button) {
margin: 0 0 0.5em 0; margin: 0 0 0.5em 0;
text-transform: uppercase; text-transform: uppercase;
font-size: 1.1em; font-size: 1.1em;
&:not(:first-of-type) { &:not(:first-of-type) {
margin: 2em 0 1em 0; margin: 2em 0 1em 0;
} }
} }
} }
@media screen and (max-width: $small-devices) { @media screen and (max-width: $small-devices) {
#left_column, #left_column,
#right_column { #right_column {
flex: 100%; flex: 100%;
} }
} }
/* AGENDA/BIRTHDAYS */ /* AGENDA/BIRTHDAYS */
#agenda, #agenda,
#birthdays { #birthdays {
display: block; display: block;
@ -432,6 +466,7 @@ a:not(.button) {
background: white; background: white;
font-size: 70%; font-size: 70%;
margin-bottom: 1em; margin-bottom: 1em;
#agenda_title, #agenda_title,
#birthdays_title { #birthdays_title {
margin: 0; margin: 0;
@ -444,39 +479,48 @@ a:not(.button) {
text-transform: uppercase; text-transform: uppercase;
background: $second-color; background: $second-color;
} }
#agenda_content { #agenda_content {
overflow: auto; overflow: auto;
box-shadow: $shadow-color 1px 1px 1px; box-shadow: $shadow-color 1px 1px 1px;
height: 20em; height: 20em;
} }
#agenda_content, #agenda_content,
#birthdays_content { #birthdays_content {
.agenda_item { .agenda_item {
padding: 0.5em; padding: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
&:nth-of-type(even) { &:nth-of-type(even) {
background: $secondary-neutral-light-color; background: $secondary-neutral-light-color;
} }
.agenda_time { .agenda_time {
font-size: 90%; font-size: 90%;
color: grey; color: grey;
} }
.agenda_item_content { .agenda_item_content {
p { p {
margin-top: 0.2em; margin-top: 0.2em;
} }
} }
} }
ul.birthdays_year { ul.birthdays_year {
margin: 0; margin: 0;
list-style-type: none; list-style-type: none;
font-weight: bold; font-weight: bold;
> li {
>li {
padding: 0.5em; padding: 0.5em;
&:nth-child(even) { &:nth-child(even) {
background: $secondary-neutral-light-color; background: $secondary-neutral-light-color;
} }
} }
ul { ul {
margin: 0; margin: 0;
margin-left: 1em; margin-left: 1em;
@ -487,13 +531,15 @@ a:not(.button) {
} }
} }
} }
/* END AGENDA/BIRTHDAYS */
/* EVENTS TODAY AND NEXT FEW DAYS */ /* END AGENDA/BIRTHDAYS */
/* EVENTS TODAY AND NEXT FEW DAYS */
.news_events_group { .news_events_group {
box-shadow: $shadow-color 1px 1px 1px; box-shadow: $shadow-color 1px 1px 1px;
margin-left: 1em; margin-left: 1em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
.news_events_group_date { .news_events_group_date {
display: table-cell; display: table-cell;
padding: 0.6em; padding: 0.6em;
@ -509,33 +555,42 @@ a:not(.button) {
div { div {
margin: 0 auto; margin: 0 auto;
.day { .day {
font-size: 1.5em; font-size: 1.5em;
} }
} }
} }
.news_events_group_items { .news_events_group_items {
display: table-cell; display: table-cell;
width: 100%; width: 100%;
.news_event:nth-of-type(odd) { .news_event:nth-of-type(odd) {
background: white; background: white;
} }
.news_event:nth-of-type(even) { .news_event:nth-of-type(even) {
background: $primary-neutral-light-color; background: $primary-neutral-light-color;
} }
.news_event { .news_event {
display: block; display: block;
padding: 0.4em; padding: 0.4em;
&:not(:last-child) { &:not(:last-child) {
border-bottom: 1px solid grey; border-bottom: 1px solid grey;
} }
div { div {
margin: 0.2em; margin: 0.2em;
} }
h4 { h4 {
margin-top: 1em; margin-top: 1em;
text-transform: uppercase; text-transform: uppercase;
} }
.club_logo { .club_logo {
float: left; float: left;
min-width: 7em; min-width: 7em;
@ -543,6 +598,7 @@ a:not(.button) {
margin: 0; margin: 0;
margin-right: 1em; margin-right: 1em;
margin-top: 0.8em; margin-top: 0.8em;
img { img {
max-height: 6em; max-height: 6em;
max-width: 8em; max-width: 8em;
@ -550,16 +606,21 @@ a:not(.button) {
margin: 0 auto; margin: 0 auto;
} }
} }
.news_date { .news_date {
font-size: 100%; font-size: 100%;
} }
.news_content { .news_content {
clear: left; clear: left;
.button_bar { .button_bar {
text-align: right; text-align: right;
.fb { .fb {
color: $faceblue; color: $faceblue;
} }
.twitter { .twitter {
color: $twitblue; color: $twitblue;
} }
@ -568,26 +629,30 @@ a:not(.button) {
} }
} }
} }
/* END EVENTS TODAY AND NEXT FEW DAYS */
/* COMING SOON */ /* END EVENTS TODAY AND NEXT FEW DAYS */
/* COMING SOON */
.news_coming_soon { .news_coming_soon {
display: list-item; display: list-item;
list-style-type: square; list-style-type: square;
list-style-position: inside; list-style-position: inside;
margin-left: 1em; margin-left: 1em;
padding-left: 0; padding-left: 0;
a { a {
font-weight: bold; font-weight: bold;
text-transform: uppercase; text-transform: uppercase;
} }
.news_date { .news_date {
font-size: 0.9em; font-size: 0.9em;
} }
} }
/* END COMING SOON */
/* NOTICES */ /* END COMING SOON */
/* NOTICES */
.news_notice { .news_notice {
margin: 0 0 1em 1em; margin: 0 0 1em 1em;
padding: 0.4em; padding: 0.4em;
@ -595,16 +660,19 @@ a:not(.button) {
background: $secondary-neutral-light-color; background: $secondary-neutral-light-color;
box-shadow: $shadow-color 0 0 2px; box-shadow: $shadow-color 0 0 2px;
border-radius: 18px 5px 18px 5px; border-radius: 18px 5px 18px 5px;
h4 { h4 {
margin: 0; margin: 0;
} }
.news_content { .news_content {
margin-left: 1em; margin-left: 1em;
} }
} }
/* END NOTICES */
/* CALLS */ /* END NOTICES */
/* CALLS */
.news_call { .news_call {
margin: 0 0 1em 1em; margin: 0 0 1em 1em;
padding: 0.4em; padding: 0.4em;
@ -612,21 +680,26 @@ a:not(.button) {
background: $secondary-neutral-light-color; background: $secondary-neutral-light-color;
border: 1px solid grey; border: 1px solid grey;
box-shadow: $shadow-color 1px 1px 1px; box-shadow: $shadow-color 1px 1px 1px;
h4 { h4 {
margin: 0; margin: 0;
} }
.news_date { .news_date {
font-size: 0.9em; font-size: 0.9em;
} }
.news_content { .news_content {
margin-left: 1em; margin-left: 1em;
} }
} }
/* END CALLS */
/* END CALLS */
.news_empty { .news_empty {
margin-left: 1em; margin-left: 1em;
} }
.news_date { .news_date {
color: grey; color: grey;
} }
@ -640,8 +713,8 @@ a:not(.button) {
} }
.select2 { .tomselected {
margin: 10px 0!important; margin: 10px 0 !important;
max-width: 100%; max-width: 100%;
min-width: 100%; min-width: 100%;
@ -657,7 +730,9 @@ a:not(.button) {
color: black; color: black;
} }
} }
.select2-results {
.ts-dropdown {
.select-item { .select-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -673,16 +748,39 @@ a:not(.button) {
} }
} }
.ts-control {
.item {
.fa-times {
margin-left: 5px;
margin-right: 5px;
}
cursor: pointer;
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 4px;
display: inline-block;
margin-left: 5px;
margin-top: 5px;
margin-bottom: 5px;
padding-right: 10px;
}
}
#news_details { #news_details {
display: inline-block; display: inline-block;
margin-top: 20px; margin-top: 20px;
padding: 0.4em; padding: 0.4em;
width: 80%; width: 80%;
background: $white-color; background: $white-color;
h4 { h4 {
margin-top: 1em; margin-top: 1em;
text-transform: uppercase; text-transform: uppercase;
} }
.club_logo { .club_logo {
display: inline-block; display: inline-block;
text-align: center; text-align: center;
@ -690,6 +788,7 @@ a:not(.button) {
float: left; float: left;
min-width: 15em; min-width: 15em;
margin: 0; margin: 0;
img { img {
max-height: 15em; max-height: 15em;
max-width: 12em; max-width: 12em;
@ -698,6 +797,7 @@ a:not(.button) {
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.share_button { .share_button {
border: none; border: none;
color: white; color: white;
@ -709,6 +809,7 @@ a:not(.button) {
float: right; float: right;
display: block; display: block;
margin-left: 0.3em; margin-left: 0.3em;
&:hover { &:hover {
color: lightgrey; color: lightgrey;
} }
@ -740,26 +841,32 @@ a:not(.button) {
#poster_edit, #poster_edit,
#screen_edit { #screen_edit {
position: relative; position: relative;
#title { #title {
position: relative; position: relative;
padding: 10px; padding: 10px;
margin: 10px; margin: 10px;
border-bottom: 2px solid black; border-bottom: 2px solid black;
h3 { h3 {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
#links { #links {
position: absolute; position: absolute;
display: flex; display: flex;
bottom: 5px; bottom: 5px;
&.left { &.left {
left: 0; left: 0;
} }
&.right { &.right {
right: 0; right: 0;
} }
.link { .link {
padding: 5px; padding: 5px;
padding-left: 20px; padding-left: 20px;
@ -768,27 +875,32 @@ a:not(.button) {
border-radius: 20px; border-radius: 20px;
background-color: hsl(40, 100%, 50%); background-color: hsl(40, 100%, 50%);
color: black; color: black;
&:hover { &:hover {
color: black; color: black;
background-color: hsl(40, 58%, 50%); background-color: hsl(40, 58%, 50%);
} }
&.delete { &.delete {
background-color: hsl(0, 100%, 40%); background-color: hsl(0, 100%, 40%);
} }
} }
} }
} }
#posters, #posters,
#screens { #screens {
position: relative; position: relative;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
#no-posters, #no-posters,
#no-screens { #no-screens {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.poster, .poster,
.screen { .screen {
min-width: 10%; min-width: 10%;
@ -800,26 +912,31 @@ a:not(.button) {
border-radius: 4px; border-radius: 4px;
padding: 10px; padding: 10px;
background-color: lightgrey; background-color: lightgrey;
* { * {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.name { .name {
padding-bottom: 5px; padding-bottom: 5px;
margin-bottom: 5px; margin-bottom: 5px;
border-bottom: 1px solid whitesmoke; border-bottom: 1px solid whitesmoke;
} }
.image { .image {
flex-grow: 1; flex-grow: 1;
position: relative; position: relative;
padding-bottom: 5px; padding-bottom: 5px;
margin-bottom: 5px; margin-bottom: 5px;
border-bottom: 1px solid whitesmoke; border-bottom: 1px solid whitesmoke;
img { img {
max-height: 20vw; max-height: 20vw;
max-width: 100%; max-width: 100%;
} }
&:hover { &:hover {
&::before { &::before {
position: absolute; position: absolute;
@ -838,10 +955,12 @@ a:not(.button) {
} }
} }
} }
.dates { .dates {
padding-bottom: 5px; padding-bottom: 5px;
margin-bottom: 5px; margin-bottom: 5px;
border-bottom: 1px solid whitesmoke; border-bottom: 1px solid whitesmoke;
* { * {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -850,15 +969,18 @@ a:not(.button) {
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;
} }
.begin, .begin,
.end { .end {
width: 48%; width: 48%;
} }
.begin { .begin {
border-right: 1px solid whitesmoke; border-right: 1px solid whitesmoke;
padding-right: 2%; padding-right: 2%;
} }
} }
.edit, .edit,
.moderate, .moderate,
.slideshow { .slideshow {
@ -866,15 +988,18 @@ a:not(.button) {
border-radius: 20px; border-radius: 20px;
background-color: hsl(40, 100%, 50%); background-color: hsl(40, 100%, 50%);
color: black; color: black;
&:hover { &:hover {
color: black; color: black;
background-color: hsl(40, 58%, 50%); background-color: hsl(40, 58%, 50%);
} }
&:nth-child(2n) { &:nth-child(2n) {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
} }
} }
.tooltip { .tooltip {
visibility: hidden; visibility: hidden;
width: 120px; width: 120px;
@ -885,23 +1010,28 @@ a:not(.button) {
border-radius: 6px; border-radius: 6px;
position: absolute; position: absolute;
z-index: 10; z-index: 10;
ul { ul {
margin-left: 0; margin-left: 0;
display: inline-block; display: inline-block;
li { li {
display: list-item; display: list-item;
list-style-type: none; list-style-type: none;
} }
} }
} }
&.not_moderated { &.not_moderated {
border: 1px solid red; border: 1px solid red;
} }
&:hover .tooltip { &:hover .tooltip {
visibility: visible; visibility: visible;
} }
} }
} }
#view { #view {
position: fixed; position: fixed;
width: 100vw; width: 100vw;
@ -915,9 +1045,11 @@ a:not(.button) {
visibility: hidden; visibility: hidden;
background-color: rgba(10, 10, 10, 0.9); background-color: rgba(10, 10, 10, 0.9);
overflow: hidden; overflow: hidden;
&.active { &.active {
visibility: visible; visibility: visible;
} }
#placeholder { #placeholder {
width: 80vw; width: 80vw;
height: 80vh; height: 80vh;
@ -926,6 +1058,7 @@ a:not(.button) {
align-items: center; align-items: center;
top: 0; top: 0;
left: 0; left: 0;
img { img {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
@ -940,14 +1073,17 @@ a:not(.button) {
tbody { tbody {
.neg-amount { .neg-amount {
color: red; color: red;
&:before { &:before {
font-family: FontAwesome; font-family: FontAwesome;
font-size: 1em; font-size: 1em;
content: "\f063"; content: "\f063";
} }
} }
.pos-amount { .pos-amount {
color: green; color: green;
&:before { &:before {
font-family: FontAwesome; font-family: FontAwesome;
font-size: 1em; font-size: 1em;
@ -1014,6 +1150,7 @@ dt {
.edit-bar { .edit-bar {
display: block; display: block;
margin: 4px; margin: 4px;
a { a {
display: inline-block; display: inline-block;
margin: 4px; margin: 4px;
@ -1053,7 +1190,8 @@ th {
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
padding: 5px 10px; padding: 5px 10px;
> ul {
>ul {
margin-top: 0; margin-top: 0;
} }
} }
@ -1064,7 +1202,8 @@ td {
vertical-align: top; vertical-align: top;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
> ul {
>ul {
margin-top: 0; margin-top: 0;
} }
} }
@ -1080,15 +1219,17 @@ thead {
color: white; color: white;
} }
tbody > tr { tbody>tr {
&:nth-child(even):not(.highlight) { &:nth-child(even):not(.highlight) {
background: $primary-neutral-light-color; background: $primary-neutral-light-color;
} }
&.clickable:hover { &.clickable:hover {
cursor: pointer; cursor: pointer;
background: $secondary-neutral-light-color; background: $secondary-neutral-light-color;
width: 100%; width: 100%;
} }
&.highlight { &.highlight {
color: $primary-dark-color; color: $primary-dark-color;
font-style: italic; font-style: italic;
@ -1148,9 +1289,11 @@ u,
margin: 0.2em; margin: 0.2em;
height: 100%; height: 100%;
background: $secondary-neutral-light-color; background: $secondary-neutral-light-color;
img { img {
max-width: 70%; max-width: 70%;
} }
input { input {
background: white; background: white;
} }
@ -1162,10 +1305,12 @@ u,
.user_mini_profile { .user_mini_profile {
height: 100%; height: 100%;
width: 100%; width: 100%;
img { img {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
} }
.user_mini_profile_infos { .user_mini_profile_infos {
padding: 0.2em; padding: 0.2em;
height: 20%; height: 20%;
@ -1173,16 +1318,20 @@ u,
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: space-around; justify-content: space-around;
font-size: 0.9em; font-size: 0.9em;
div { div {
max-height: 100%; max-height: 100%;
} }
.user_mini_profile_infos_text { .user_mini_profile_infos_text {
text-align: center; text-align: center;
.user_mini_profile_nick { .user_mini_profile_nick {
font-style: italic; font-style: italic;
} }
} }
} }
.user_mini_profile_picture { .user_mini_profile_picture {
height: 80%; height: 80%;
display: flex; display: flex;
@ -1194,14 +1343,17 @@ u,
.mini_profile_link { .mini_profile_link {
display: block; display: block;
text-decoration: none; text-decoration: none;
span { span {
display: inline-block; display: inline-block;
width: 50px; width: 50px;
vertical-align: middle; vertical-align: middle;
} }
em { em {
vertical-align: middle; vertical-align: middle;
} }
img { img {
max-width: 40px; max-width: 40px;
max-height: 60px; max-height: 60px;
@ -1223,6 +1375,7 @@ u,
border: solid 1px red; border: solid 1px red;
text-align: center; text-align: center;
} }
img { img {
width: 500px; width: 500px;
} }
@ -1232,6 +1385,7 @@ u,
.matmat_results { .matmat_results {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.matmat_user { .matmat_user {
flex-basis: 14em; flex-basis: 14em;
align-self: flex-start; align-self: flex-start;
@ -1240,10 +1394,12 @@ u,
overflow: hidden; overflow: hidden;
border: 1px solid black; border: 1px solid black;
box-shadow: $shadow-color 1px 1px 1px; box-shadow: $shadow-color 1px 1px 1px;
&:hover { &:hover {
box-shadow: 1px 1px 5px $second-color; box-shadow: 1px 1px 5px $second-color;
} }
} }
.matmat_user a { .matmat_user a {
color: $primary-neutral-dark-color; color: $primary-neutral-dark-color;
height: 100%; height: 100%;
@ -1283,6 +1439,7 @@ footer {
font-size: 90%; font-size: 90%;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
div { div {
margin: 0.6em 0; margin: 0.6em 0;
color: $white-color; color: $white-color;
@ -1292,18 +1449,20 @@ footer {
align-items: center; align-items: center;
background-color: $primary-neutral-dark-color; background-color: $primary-neutral-dark-color;
box-shadow: $shadow-color 0 0 15px; box-shadow: $shadow-color 0 0 15px;
a { a {
padding: 0.8em; padding: 0.8em;
flex: 1; flex: 1;
font-weight: bold; font-weight: bold;
color: $white-color !important; color: $white-color !important;
&:hover { &:hover {
color: $primary-dark-color; color: $primary-dark-color;
} }
} }
} }
> .version { >.version {
margin-top: 3px; margin-top: 3px;
color: rgba(0, 0, 0, 0.3); color: rgba(0, 0, 0, 0.3);
} }
@ -1335,6 +1494,7 @@ label {
* { * {
text-align: center; text-align: center;
} }
img { img {
width: 100px; width: 100px;
} }
@ -1351,19 +1511,23 @@ label {
padding: 2px; padding: 2px;
display: inline-block; display: inline-block;
font-size: 0.8em; font-size: 0.8em;
span { span {
width: 70px; width: 70px;
float: right; float: right;
} }
img { img {
max-width: 50px; max-width: 50px;
max-height: 50px; max-height: 50px;
float: left; float: left;
} }
strong { strong {
font-weight: bold; font-weight: bold;
font-size: 1.2em; font-size: 1.2em;
} }
button { button {
vertical-align: middle; vertical-align: middle;
} }
@ -1380,6 +1544,7 @@ a.ui-button:active,
background: $primary-color; background: $primary-color;
border-color: $primary-color; border-color: $primary-color;
} }
.ui-corner-all, .ui-corner-all,
.ui-corner-bottom, .ui-corner-bottom,
.ui-corner-right, .ui-corner-right,
@ -1391,10 +1556,11 @@ a.ui-button:active,
#club_detail { #club_detail {
.club_logo { .club_logo {
float: right; float: right;
img { img {
display: block; display: block;
max-height: 10em; max-height: 10em;
max-width: 10em; max-width: 10em;
} }
} }
} }

View File

@ -0,0 +1,93 @@
import "tom-select/dist/css/tom-select.css";
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components";
import TomSelect from "tom-select";
import type { TomItem, TomLoadCallback, TomOption } from "tom-select/dist/types/types";
import type { escape_html } from "tom-select/dist/types/utils";
import { type UserProfileSchema, userSearchUsers } from "#openapi";
@registerComponent("ajax-select")
export class AjaxSelect extends inheritHtmlElement("select") {
public widget: TomSelect;
public filter?: <T>(items: T[]) => T[];
constructor() {
super();
window.addEventListener("DOMContentLoaded", () => {
this.loadTomSelect();
});
}
loadTomSelect() {
const minCharNumberForSearch = 2;
let maxItems = 1;
if (this.node.multiple) {
maxItems = Number.parseInt(this.node.dataset.max) ?? null;
}
this.widget = new TomSelect(this.node, {
hideSelected: true,
diacritics: true,
duplicates: false,
maxItems: maxItems,
loadThrottle: Number.parseInt(this.node.dataset.delay) ?? null,
valueField: "id",
labelField: "display_name",
searchField: ["display_name", "nick_name", "first_name", "last_name"],
placeholder: this.node.dataset.placeholder ?? "",
shouldLoad: (query: string) => {
return query.length >= minCharNumberForSearch; // Avoid launching search with less than 2 characters
},
load: (query: string, callback: TomLoadCallback) => {
userSearchUsers({
query: {
search: query,
},
}).then((response) => {
if (response.data) {
if (this.filter) {
callback(this.filter(response.data.results), []);
} else {
callback(response.data.results, []);
}
return;
}
callback([], []);
});
},
render: {
option: (item: UserProfileSchema, sanitize: typeof escape_html) => {
return `<div class="select-item">
<img
src="${sanitize(item.profile_pict)}"
alt="${sanitize(item.display_name)}"
onerror="this.src = '/static/core/img/unknown.jpg'"
/>
<span class="select-item-text">${sanitize(item.display_name)}</span>
</div>`;
},
item: (item: UserProfileSchema, sanitize: typeof escape_html) => {
return `<span><i class="fa fa-times"></i>${sanitize(item.display_name)}</span>`;
},
// biome-ignore lint/style/useNamingConvention: that's how it's defined
not_loading: (data: TomOption, _sanitize: typeof escape_html) => {
return `<div class="no-results">${interpolate(gettext("You need to type %(number)s more characters"), { number: minCharNumberForSearch - data.input.length }, true)}</div>`;
},
// biome-ignore lint/style/useNamingConvention: that's how it's defined
no_results: (_data: TomOption, _sanitize: typeof escape_html) => {
return `<div class="no-results">${gettext("No results found")}</div>`;
},
},
});
// Allow removing selected items by clicking on them
this.widget.on("item_select", (item: TomItem) => {
this.widget.removeItem(item);
});
// Remove typed text once an item has been selected
this.widget.on("item_add", () => {
this.widget.setTextboxValue("");
});
}
}

View File

@ -1,6 +1,7 @@
// biome-ignore lint/correctness/noUndeclaredDependencies: shipped by easymde // biome-ignore lint/correctness/noUndeclaredDependencies: shipped by easymde
import "codemirror/lib/codemirror.css"; import "codemirror/lib/codemirror.css";
import "easymde/src/css/easymde.css"; import "easymde/src/css/easymde.css";
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components";
// biome-ignore lint/correctness/noUndeclaredDependencies: Imported by EasyMDE // biome-ignore lint/correctness/noUndeclaredDependencies: Imported by EasyMDE
import type CodeMirror from "codemirror"; import type CodeMirror from "codemirror";
// biome-ignore lint/style/useNamingConvention: This is how they called their namespace // biome-ignore lint/style/useNamingConvention: This is how they called their namespace
@ -158,26 +159,22 @@ const loadEasyMde = (textarea: HTMLTextAreaElement) => {
const submits: HTMLInputElement[] = Array.from( const submits: HTMLInputElement[] = Array.from(
textarea.closest("form").querySelectorAll('input[type="submit"]'), textarea.closest("form").querySelectorAll('input[type="submit"]'),
); );
const parentDiv = textarea.parentElement; const parentDiv = textarea.parentElement.parentElement;
let submitPressed = false;
function checkMarkdownInput(_event: Event) { function checkMarkdownInput(event: Event) {
// an attribute is null if it does not exist, else a string // an attribute is null if it does not exist, else a string
const required = this.getAttribute("required") != null; const required = textarea.getAttribute("required") != null;
const length = this.value.trim().length; const length = textarea.value.trim().length;
if (required && length === 0) { if (required && length === 0) {
parentDiv.style.boxShadow = "red 0px 0px 1.5px 1px"; parentDiv.style.boxShadow = "red 0px 0px 1.5px 1px";
event.preventDefault();
} else { } else {
parentDiv.style.boxShadow = ""; parentDiv.style.boxShadow = "";
} }
} }
function onSubmitClick(e: Event) { function onSubmitClick(e: Event) {
if (!submitPressed) {
this.codemirror.on("change", checkMarkdownInput);
}
submitPressed = true;
checkMarkdownInput(e); checkMarkdownInput(e);
} }
@ -186,11 +183,10 @@ const loadEasyMde = (textarea: HTMLTextAreaElement) => {
} }
}; };
class MarkdownInput extends HTMLTextAreaElement { @registerComponent("markdown-input")
class MarkdownInput extends inheritHtmlElement("textarea") {
constructor() { constructor() {
super(); super();
window.addEventListener("DOMContentLoaded", () => loadEasyMde(this)); window.addEventListener("DOMContentLoaded", () => loadEasyMde(this.node));
} }
} }
window.customElements.define("markdown-input", MarkdownInput, { extends: "textarea" });

View File

@ -13,9 +13,6 @@ require("jquery-ui/ui/widgets/tabs.js");
require("jquery-ui/themes/base/all.css"); require("jquery-ui/themes/base/all.css");
// We ship select2 here, otherwise it will duplicate jquery everywhere we load it
import "select2";
/** /**
* Simple wrapper to solve shorten not being able on legacy pages * Simple wrapper to solve shorten not being able on legacy pages
* @param {string} selector to be passed to jQuery * @param {string} selector to be passed to jQuery

View File

@ -3,6 +3,7 @@ import type { Alpine as AlpineType } from "alpinejs";
declare global { declare global {
const Alpine: AlpineType; const Alpine: AlpineType;
const gettext: (text: string) => string; const gettext: (text: string) => string;
const interpolate: <T>(fmt: string, args: string[] | T, isNamed?: boolean) => string;
} }
/** /**

View File

@ -1,286 +0,0 @@
/**
* Builders to use Select2 in our templates.
*
* This comes with two flavours : local data or remote data.
*
* # Local data source
*
* To use local data source, you must define an array
* in your JS code, having the fields `id` and `text`.
*
* ```js
* const data = [
* {id: 1, text: "foo"},
* {id: 2, text: "bar"},
* ];
* document.addEventListener("DOMContentLoaded", () => sithSelect2({
* element: document.getElementById("select2-input"),
* dataSource: localDataSource(data)
* }));
* ```
*
* You can also define a callback that return ids to exclude :
*
* ```js
* const data = [
* {id: 1, text: "foo"},
* {id: 2, text: "bar"},
* {id: 3, text: "to exclude"},
* ];
* document.addEventListener("DOMContentLoaded", () => sithSelect2({
* element: document.getElementById("select2-input"),
* dataSource: localDataSource(data, {
* excluded: () => data.filter((i) => i.text === "to exclude").map((i) => parseInt(i))
* })
* }));
* ```
*
* # Remote data source
*
* Select2 with remote data sources are similar to those with local
* data, but with some more parameters, like `resultConverter`,
* which takes a callback that must return a `Select2Object`.
*
* ```js
* import { makeUrl } from "#core:utils/api";
* import {userSearchUsers } from "#openapi"
* document.addEventListener("DOMContentLoaded", () => sithSelect2({
* element: document.getElementById("select2-input"),
* dataSource: remoteDataSource(await makeUrl(userSearchUsers), {
* excluded: () => [1, 2], // exclude users 1 and 2 from the search
* resultConverter: (user: AjaxResponse) => {id: user.id, text: (user.firstName as UserType)}
* })
* }));
* ```
*
* # Overrides
*
* Dealing with a select2 may be complex.
* That's why, when defining a select,
* you may add an override parameter,
* in which you can declare any parameter defined in the
* Select2 documentation.
*
* ```js
* import { makeUrl } from "#core:utils/api";
* import {userSearchUsers } from "#openapi"
* document.addEventListener("DOMContentLoaded", () => sithSelect2({
* element: document.getElementById("select2-input"),
* dataSource: remoteDataSource(await makeUrl(userSearchUsers), {
* resultConverter: (user: AjaxResponse) => {id: user.id, text: (user.firstName as UserType)}
* overrides: {
* delay: 500
* }
* })
* }));
* ```
*
* # Caveats with exclude
*
* With local data source, select2 evaluates the data only once.
* Thus, modify the exclude after the initialisation is a no-op.
*
* With remote data source, the exclude list will be evaluated
* after each api response.
* It makes it possible to bind the data returned by the callback
* to some reactive data, thus making the exclude list dynamic.
*
* # Images
*
* Sometimes, you would like to display an image besides
* the text on the select items.
* In this case, fill the `pictureGetter` option :
*
* ```js
* import { makeUrl } from "#core:utils/api";
* import {userSearchUsers } from "#openapi"
* document.addEventListener("DOMContentLoaded", () => sithSelect2({
* element: document.getElementById("select2-input"),
* dataSource: remoteDataSource(await makeUrl(userSearchUsers), {
* resultConverter: (user: AjaxResponse) => {id: user.id, text: (user.firstName as UserType)}
* })
* pictureGetter: (user) => user.profilePict,
* }));
* ```
*
* # Binding with alpine
*
* You can declare your select2 component in an Alpine data.
*
* ```html
* <body>
* <div x-data="select2_test">
* <select x-ref="search" x-ref="select"></select>
* <p x-text="currentSelection.id"></p>
* <p x-text="currentSelection.text"></p>
* </div>
* </body>
*
* <script>
* document.addEventListener("alpine:init", () => {
* Alpine.data("select2_test", () => ({
* selector: undefined,
* currentSelect: {id: "", text: ""},
*
* init() {
* this.selector = sithSelect2({
* element: $(this.$refs.select),
* dataSource: localDataSource(
* [{id: 1, text: "foo"}, {id: 2, text: "bar"}]
* ),
* });
* this.selector.on("select2:select", (event) => {
* // select2 => Alpine signals here
* this.currentSelect = this.selector.select2("data")
* });
* this.$watch("currentSelected" (value) => {
* // Alpine => select2 signals here
* });
* },
* }));
* })
* </script>
*/
import type {
AjaxOptions,
DataFormat,
GroupedDataFormat,
LoadingData,
Options,
} from "select2";
import "select2/dist/css/select2.css";
export interface Select2Object {
id: number;
text: string;
}
// biome-ignore lint/suspicious/noExplicitAny: You have to do it at some point
export type RemoteResult = any;
export type AjaxResponse = AjaxOptions<DataFormat | GroupedDataFormat, RemoteResult>;
interface DataSource {
ajax?: AjaxResponse | undefined;
data?: RemoteResult | DataFormat[] | GroupedDataFormat[] | undefined;
}
interface Select2Options {
element: Element;
/** the data source, built with `localDataSource` or `remoteDataSource` */
dataSource: DataSource;
excluded?: number[];
/** A callback to get the picture field from the API response */
pictureGetter?: (element: LoadingData | DataFormat | GroupedDataFormat) => string;
/** Any other select2 parameter to apply on the config */
overrides?: Options;
}
/**
* Create a new select2 with sith presets
*/
export function sithSelect2(options: Select2Options) {
const elem = $(options.element as HTMLInputElement);
return elem.select2({
theme: elem[0].multiple ? "classic" : "default",
minimumInputLength: 2,
templateResult: selectItemBuilder(options.pictureGetter),
...options.dataSource,
...(options.overrides ?? {}),
});
}
interface LocalSourceOptions {
excluded: () => number[];
}
/**
* Build a data source for a Select2 from a local array
*/
export function localDataSource(
source: Select2Object[] /** Array containing the data */,
options: LocalSourceOptions,
): DataSource {
if (options.excluded) {
const ids = options.excluded();
return { data: source.filter((i) => !ids.includes(i.id)) };
}
return { data: source };
}
interface RemoteSourceOptions {
/** A callback to the ids to exclude from the search */
excluded?: () => number[];
/** A converter for a value coming from the remote api */
resultConverter?: ((obj: RemoteResult) => DataFormat | GroupedDataFormat) | undefined;
/** Any other select2 parameter to apply on the config */
overrides?: AjaxOptions;
}
/**
* Build a data source for a Select2 from a remote url
*/
export function remoteDataSource(
source: string /** url of the endpoint */,
options: RemoteSourceOptions,
): DataSource {
$.ajaxSetup({
traditional: true,
});
const params: AjaxOptions = {
url: source,
dataType: "json",
cache: true,
delay: 250,
data: function (params) {
return {
search: params.term,
exclude: [
...(this.val() || []).map((i: string) => Number.parseInt(i)),
...(options.excluded ? options.excluded() : []),
],
};
},
};
if (options.resultConverter) {
params.processResults = (data) => ({
results: data.results.map(options.resultConverter),
});
}
if (options.overrides) {
Object.assign(params, options.overrides);
}
return { ajax: params };
}
export function itemFormatter(user: { loading: boolean; text: string }) {
if (user.loading) {
return user.text;
}
}
/**
* Build a function to display the results
*/
export function selectItemBuilder(pictureGetter?: (item: RemoteResult) => string) {
return (item: RemoteResult) => {
const picture = typeof pictureGetter === "function" ? pictureGetter(item) : null;
const wrapper = document.createElement("div");
wrapper.classList.add("select-item");
if (picture) {
const img = document.createElement("img");
img.src = picture;
img.alt = encodeURI(item.text);
img.onerror = () => {
img.src = "/static/core/img/unknown.jpg";
};
wrapper.appendChild(img);
}
const textSpan = document.createElement("span");
textSpan.classList.add("select-item-text");
textSpan.appendChild(document.createTextNode(item.text));
wrapper.appendChild(textSpan);
return $(wrapper);
};
}

View File

@ -0,0 +1,50 @@
/**
* Class decorator to register components easily
* It's a wrapper around window.customElements.define
* What's nice about it is that you don't separate the component registration
* and the class definition
**/
export function registerComponent(name: string, options?: ElementDefinitionOptions) {
return (component: CustomElementConstructor) => {
window.customElements.define(name, component, options);
};
}
/**
* Safari doesn't support inheriting from HTML tags on web components
* The technique is to:
* create a new web component
* create the desired type inside
* pass all attributes to the child component
* store is at as `node` inside the parent
*
* Since we can't use the generic type to instantiate the node, we create a generator function
*
* ```js
* class MyClass extends inheritHtmlElement("select") {
* // do whatever
* }
* ```
**/
export function inheritHtmlElement<K extends keyof HTMLElementTagNameMap>(tagName: K) {
return class Inherited extends HTMLElement {
protected node: HTMLElementTagNameMap[K];
constructor() {
super();
this.node = document.createElement(tagName);
const attributes: Attr[] = []; // We need to make a copy to delete while iterating
for (const attr of this.attributes) {
if (attr.name in this.node) {
attributes.push(attr);
}
}
for (const attr of attributes) {
this.removeAttributeNode(attr);
this.node.setAttributeNode(attr);
}
this.appendChild(this.node);
}
};
}

View File

@ -5,6 +5,7 @@
<title>{% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %} - Association des Étudiants UTBM</title> <title>{% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %} - Association des Étudiants UTBM</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="{{ static('core/img/favicon.ico') }}"> <link rel="shortcut icon" href="{{ static('core/img/favicon.ico') }}">
<link rel="stylesheet" href="{{ static('user/user_stats.scss') }}">
<link rel="stylesheet" href="{{ static('core/base.css') }}"> <link rel="stylesheet" href="{{ static('core/base.css') }}">
<link rel="stylesheet" href="{{ static('ajax_select/css/ajax_select.css') }}"> <link rel="stylesheet" href="{{ static('ajax_select/css/ajax_select.css') }}">
<link rel="stylesheet" href="{{ static('core/style.scss') }}"> <link rel="stylesheet" href="{{ static('core/style.scss') }}">

View File

@ -1,5 +1,5 @@
<div> <div>
<textarea is="markdown-input" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea> <markdown-input name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</markdown-input>
{# The easymde script can be included twice, it's safe in the code #} {# The easymde script can be included twice, it's safe in the code #}
<script src="{{ statics.js }}" defer> </script> <script src="{{ statics.js }}" defer> </script>

View File

@ -24,6 +24,12 @@ Si le mot apparaît dans le template Jinja :
{% trans %}Hello{% endtrans %} {% trans %}Hello{% endtrans %}
``` ```
Si on est dans un fichier javascript ou typescript :
```js
gettext("Hello");
```
## Générer le fichier django.po ## Générer le fichier django.po
La traduction se fait en trois étapes. La traduction se fait en trois étapes.
@ -32,7 +38,7 @@ l'éditer et enfin le compiler au format binaire pour qu'il soit lu par le serve
```bash ```bash
./manage.py makemessages --locale=fr -e py,jinja --ignore=node_modules # Pour le backend ./manage.py makemessages --locale=fr -e py,jinja --ignore=node_modules # Pour le backend
./manage.py makemessages --locale=fr -d djangojs --ignore=node_modules # Pour le frontend ./manage.py makemessages --locale=fr -d djangojs -e js,ts --ignore=node_modules # Pour le frontend
``` ```
## Éditer le fichier django.po ## Éditer le fichier django.po

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-09 11:50+0200\n" "POT-Creation-Date: 2024-10-16 02:19+0200\n"
"PO-Revision-Date: 2024-09-17 11:54+0200\n" "PO-Revision-Date: 2024-09-17 11:54+0200\n"
"Last-Translator: Sli <antoine@bartuccio.fr>\n" "Last-Translator: Sli <antoine@bartuccio.fr>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
@ -22,87 +22,95 @@ msgstr ""
msgid "captured.%s" msgid "captured.%s"
msgstr "capture.%s" msgstr "capture.%s"
#: core/static/webpack/easymde-index.js:32 #: core/static/webpack/ajax-select-index.ts:73
msgid "You need to type %(number)s more characters"
msgstr "Vous devez taper %(number)s caractères de plus"
#: core/static/webpack/ajax-select-index.ts:76
msgid "No results found"
msgstr "Aucun résultat trouvé"
#: core/static/webpack/easymde-index.ts:31
msgid "Heading" msgid "Heading"
msgstr "Titre" msgstr "Titre"
#: core/static/webpack/easymde-index.js:38 #: core/static/webpack/easymde-index.ts:37
msgid "Italic" msgid "Italic"
msgstr "Italique" msgstr "Italique"
#: core/static/webpack/easymde-index.js:44 #: core/static/webpack/easymde-index.ts:43
msgid "Bold" msgid "Bold"
msgstr "Gras" msgstr "Gras"
#: core/static/webpack/easymde-index.js:50 #: core/static/webpack/easymde-index.ts:49
msgid "Strikethrough" msgid "Strikethrough"
msgstr "Barré" msgstr "Barré"
#: core/static/webpack/easymde-index.js:59 #: core/static/webpack/easymde-index.ts:58
msgid "Underline" msgid "Underline"
msgstr "Souligné" msgstr "Souligné"
#: core/static/webpack/easymde-index.js:68 #: core/static/webpack/easymde-index.ts:67
msgid "Superscript" msgid "Superscript"
msgstr "Exposant" msgstr "Exposant"
#: core/static/webpack/easymde-index.js:77 #: core/static/webpack/easymde-index.ts:76
msgid "Subscript" msgid "Subscript"
msgstr "Indice" msgstr "Indice"
#: core/static/webpack/easymde-index.js:83 #: core/static/webpack/easymde-index.ts:82
msgid "Code" msgid "Code"
msgstr "Code" msgstr "Code"
#: core/static/webpack/easymde-index.js:90 #: core/static/webpack/easymde-index.ts:89
msgid "Quote" msgid "Quote"
msgstr "Citation" msgstr "Citation"
#: core/static/webpack/easymde-index.js:96 #: core/static/webpack/easymde-index.ts:95
msgid "Unordered list" msgid "Unordered list"
msgstr "Liste non ordonnée" msgstr "Liste non ordonnée"
#: core/static/webpack/easymde-index.js:102 #: core/static/webpack/easymde-index.ts:101
msgid "Ordered list" msgid "Ordered list"
msgstr "Liste ordonnée" msgstr "Liste ordonnée"
#: core/static/webpack/easymde-index.js:109 #: core/static/webpack/easymde-index.ts:108
msgid "Insert link" msgid "Insert link"
msgstr "Insérer lien" msgstr "Insérer lien"
#: core/static/webpack/easymde-index.js:115 #: core/static/webpack/easymde-index.ts:114
msgid "Insert image" msgid "Insert image"
msgstr "Insérer image" msgstr "Insérer image"
#: core/static/webpack/easymde-index.js:121 #: core/static/webpack/easymde-index.ts:120
msgid "Insert table" msgid "Insert table"
msgstr "Insérer tableau" msgstr "Insérer tableau"
#: core/static/webpack/easymde-index.js:128 #: core/static/webpack/easymde-index.ts:127
msgid "Clean block" msgid "Clean block"
msgstr "Nettoyer bloc" msgstr "Nettoyer bloc"
#: core/static/webpack/easymde-index.js:135 #: core/static/webpack/easymde-index.ts:134
msgid "Toggle preview" msgid "Toggle preview"
msgstr "Activer la prévisualisation" msgstr "Activer la prévisualisation"
#: core/static/webpack/easymde-index.js:141 #: core/static/webpack/easymde-index.ts:140
msgid "Toggle side by side" msgid "Toggle side by side"
msgstr "Activer la vue côte à côte" msgstr "Activer la vue côte à côte"
#: core/static/webpack/easymde-index.js:147 #: core/static/webpack/easymde-index.ts:146
msgid "Toggle fullscreen" msgid "Toggle fullscreen"
msgstr "Activer le plein écran" msgstr "Activer le plein écran"
#: core/static/webpack/easymde-index.js:154 #: core/static/webpack/easymde-index.ts:153
msgid "Markdown guide" msgid "Markdown guide"
msgstr "Guide markdown" msgstr "Guide markdown"
#: core/static/webpack/user/family-graph-index.js:222 #: core/static/webpack/user/family-graph-index.js:233
msgid "family_tree.%(extension)s" msgid "family_tree.%(extension)s"
msgstr "arbre_genealogique.%(extension)s" msgstr "arbre_genealogique.%(extension)s"
#: core/static/webpack/user/pictures-index.js:67 #: core/static/webpack/user/pictures-index.js:76
msgid "pictures.%(extension)s" msgid "pictures.%(extension)s"
msgstr "photos.%(extension)s" msgstr "photos.%(extension)s"
@ -110,10 +118,10 @@ msgstr "photos.%(extension)s"
msgid "Incorrect value" msgid "Incorrect value"
msgstr "Valeur incorrecte" msgstr "Valeur incorrecte"
#: sas/static/sas/js/viewer.js:205 #: sas/static/webpack/sas/viewer-index.ts:271
msgid "Couldn't moderate picture" msgid "Couldn't moderate picture"
msgstr "Il n'a pas été possible de modérer l'image" msgstr "Il n'a pas été possible de modérer l'image"
#: sas/static/sas/js/viewer.js:217 #: sas/static/webpack/sas/viewer-index.ts:284
msgid "Couldn't delete picture" msgid "Couldn't delete picture"
msgstr "Il n'a pas été possible de supprimer l'image" msgstr "Il n'a pas été possible de supprimer l'image"

48
package-lock.json generated
View File

@ -26,9 +26,9 @@
"jquery-ui": "^1.14.0", "jquery-ui": "^1.14.0",
"jquery.shorten": "^1.0.0", "jquery.shorten": "^1.0.0",
"native-file-system-adapter": "^3.0.1", "native-file-system-adapter": "^3.0.1",
"select2": "^4.1.0-rc.0",
"three": "^0.169.0", "three": "^0.169.0",
"three-spritetext": "^1.9.0" "three-spritetext": "^1.9.0",
"tom-select": "^2.3.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
@ -37,7 +37,6 @@
"@hey-api/openapi-ts": "^0.53.8", "@hey-api/openapi-ts": "^0.53.8",
"@types/alpinejs": "^3.13.10", "@types/alpinejs": "^3.13.10",
"@types/jquery": "^3.5.31", "@types/jquery": "^3.5.31",
"@types/select2": "^4.0.63",
"babel-loader": "^9.2.1", "babel-loader": "^9.2.1",
"css-loader": "^7.1.2", "css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0", "css-minimizer-webpack-plugin": "^7.0.0",
@ -2175,6 +2174,19 @@
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
"integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw=="
}, },
"node_modules/@orchidjs/sifter": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@orchidjs/sifter/-/sifter-1.0.3.tgz",
"integrity": "sha512-zCZbwKegHytfsPm8Amcfh7v/4vHqTAaOu6xFswBYcn8nznBOuseu6COB2ON7ez0tFV0mKL0nRNnCiZZA+lU9/g==",
"dependencies": {
"@orchidjs/unicode-variants": "^1.0.4"
}
},
"node_modules/@orchidjs/unicode-variants": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@orchidjs/unicode-variants/-/unicode-variants-1.0.4.tgz",
"integrity": "sha512-NvVBRnZNE+dugiXERFsET1JlKZfM5lJDEpSMilKW4bToYJ7pxf0Zne78xyXB2ny2c2aHfJ6WLnz1AaTNHAmQeQ=="
},
"node_modules/@pkgjs/parseargs": { "node_modules/@pkgjs/parseargs": {
"version": "0.11.0", "version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
@ -2384,15 +2396,6 @@
"undici-types": "~6.19.2" "undici-types": "~6.19.2"
} }
}, },
"node_modules/@types/select2": {
"version": "4.0.63",
"resolved": "https://registry.npmjs.org/@types/select2/-/select2-4.0.63.tgz",
"integrity": "sha512-/DXUfPSj3iVTGlRYRYPCFKKSogAGP/j+Z0fIMXbBiBtmmZj0WH7vnfNuckafq9C43KnqPPQW2TI/Rj/vTSGnQQ==",
"dev": true,
"dependencies": {
"@types/jquery": "*"
}
},
"node_modules/@types/sizzle": { "node_modules/@types/sizzle": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz",
@ -6132,11 +6135,6 @@
"url": "https://opencollective.com/webpack" "url": "https://opencollective.com/webpack"
} }
}, },
"node_modules/select2": {
"version": "4.1.0-rc.0",
"resolved": "https://registry.npmjs.org/select2/-/select2-4.1.0-rc.0.tgz",
"integrity": "sha512-Hr9TdhyHCZUtwznEH2CBf7967mEM0idtJ5nMtjvk3Up5tPukOLXbHUNmh10oRfeNIhj+3GD3niu+g6sVK+gK0A=="
},
"node_modules/semver": { "node_modules/semver": {
"version": "7.6.3", "version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
@ -6614,6 +6612,22 @@
"node": ">=8.0" "node": ">=8.0"
} }
}, },
"node_modules/tom-select": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/tom-select/-/tom-select-2.3.1.tgz",
"integrity": "sha512-QS4vnOcB6StNGqX4sGboGXL2fkhBF2gIBB+8Hwv30FZXYPn0CyYO8kkdATRvwfCTThxiR4WcXwKJZ3cOmtI9eg==",
"dependencies": {
"@orchidjs/sifter": "^1.0.3",
"@orchidjs/unicode-variants": "^1.0.4"
},
"engines": {
"node": "*"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/tom-select"
}
},
"node_modules/totalist": { "node_modules/totalist": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz",

View File

@ -27,7 +27,6 @@
"@hey-api/openapi-ts": "^0.53.8", "@hey-api/openapi-ts": "^0.53.8",
"@types/alpinejs": "^3.13.10", "@types/alpinejs": "^3.13.10",
"@types/jquery": "^3.5.31", "@types/jquery": "^3.5.31",
"@types/select2": "^4.0.63",
"babel-loader": "^9.2.1", "babel-loader": "^9.2.1",
"css-loader": "^7.1.2", "css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0", "css-minimizer-webpack-plugin": "^7.0.0",
@ -59,8 +58,8 @@
"jquery-ui": "^1.14.0", "jquery-ui": "^1.14.0",
"jquery.shorten": "^1.0.0", "jquery.shorten": "^1.0.0",
"native-file-system-adapter": "^3.0.1", "native-file-system-adapter": "^3.0.1",
"select2": "^4.1.0-rc.0",
"three": "^0.169.0", "three": "^0.169.0",
"three-spritetext": "^1.9.0" "three-spritetext": "^1.9.0",
"tom-select": "^2.3.1"
} }
} }

View File

@ -29,7 +29,7 @@
width: 100%; width: 100%;
} }
> .photo { >.photo {
box-sizing: border-box; box-sizing: border-box;
height: 500px; height: 500px;
display: flex; display: flex;
@ -42,7 +42,7 @@
height: auto; height: auto;
} }
> img { >img {
height: 100%; height: 100%;
max-width: 100%; max-width: 100%;
object-fit: contain; object-fit: contain;
@ -57,7 +57,7 @@
width: 100%; width: 100%;
} }
> .navigation { >.navigation {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 10px; gap: 10px;
@ -66,8 +66,8 @@
width: 100%; width: 100%;
} }
> #prev, >#prev,
> #next { >#next {
width: calc(50% - 5px); width: calc(50% - 5px);
aspect-ratio: 16/9; aspect-ratio: 16/9;
background: #333333; background: #333333;
@ -80,6 +80,7 @@
object-fit: cover; object-fit: cover;
opacity: 70%; opacity: 70%;
} }
.overlay { .overlay {
position: absolute; position: absolute;
top: 50%; top: 50%;
@ -89,7 +90,7 @@
font-size: 40px; font-size: 40px;
} }
> div { >div {
display: flex; display: flex;
position: relative; position: relative;
width: 100%; width: 100%;
@ -98,12 +99,12 @@
} }
} }
> .tags { >.tags {
@media (min-width: 1001px) { @media (min-width: 1001px) {
margin-right: 5px; margin-right: 5px;
} }
> ul { >ul {
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
display: flex; display: flex;
@ -118,7 +119,7 @@
margin-right: 5px; margin-right: 5px;
} }
> li { >li {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -135,7 +136,7 @@
max-width: calc(50% - 5px); max-width: calc(50% - 5px);
} }
> a { >a {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -155,7 +156,7 @@
background-color: #aaa; background-color: #aaa;
} }
> span { >span {
width: 100%; width: 100%;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@ -167,14 +168,14 @@
margin-left: 10px; margin-left: 10px;
} }
> img { >img {
width: 25px; width: 25px;
max-height: 25px; max-height: 25px;
object-fit: contain; object-fit: contain;
border-radius: 50%; border-radius: 50%;
} }
> .profile-pic { >.profile-pic {
background-position: center center; background-position: center center;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -187,23 +188,24 @@
} }
} }
> form { >form {
> p { >p {
box-sizing: border-box; box-sizing: border-box;
} }
> .results_on_deck > div { >.results_on_deck>div {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
word-break: break-word; word-break: break-word;
> span { >span {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
} }
} }
input { input {
min-width: 100%; min-width: 100%;
max-width: 100%; max-width: 100%;
@ -226,17 +228,17 @@
flex-direction: column; flex-direction: column;
} }
> .infos { >.infos {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 50%; width: 50%;
> div > div { >div>div {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
> *:first-child { >*:first-child {
min-width: 150px; min-width: 150px;
@media (max-width: 1000px) { @media (max-width: 1000px) {
@ -246,18 +248,18 @@
} }
} }
> .tools { >.tools {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 50%; width: 50%;
> div { >div {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
> div { >div {
> a.button { >a.button {
box-sizing: border-box; box-sizing: border-box;
background-color: #f2f2f2; background-color: #f2f2f2;
display: flex; display: flex;
@ -274,7 +276,7 @@
} }
} }
> a.text.danger { >a.text.danger {
color: red; color: red;
&:hover { &:hover {
@ -289,4 +291,4 @@
} }
} }
} }
} }

View File

@ -1,12 +1,7 @@
import { makeUrl, paginated } from "#core:utils/api"; import { paginated } from "#core:utils/api";
import { exportToHtml } from "#core:utils/globals"; import { exportToHtml } from "#core:utils/globals";
import { History } from "#core:utils/history"; import { History } from "#core:utils/history";
import { import type TomSelect from "tom-select";
type AjaxResponse,
type RemoteResult,
remoteDataSource,
sithSelect2,
} from "#core:utils/select2";
import { import {
type IdentifiedUserSchema, type IdentifiedUserSchema,
type PictureSchema, type PictureSchema,
@ -20,7 +15,6 @@ import {
picturesFetchPictures, picturesFetchPictures,
picturesIdentifyUsers, picturesIdentifyUsers,
picturesModeratePicture, picturesModeratePicture,
userSearchUsers,
usersidentifiedDeleteRelation, usersidentifiedDeleteRelation,
} from "#openapi"; } from "#openapi";
@ -182,20 +176,21 @@ exportToHtml("loadViewer", (config: ViewerConfig) => {
query: { album_id: config.albumId }, query: { album_id: config.albumId },
} as PicturesFetchPicturesData) } as PicturesFetchPicturesData)
).map(PictureWithIdentifications.fromPicture); ).map(PictureWithIdentifications.fromPicture);
this.selector = sithSelect2({ this.selector = this.$refs.search;
element: this.$refs.search, this.selector.filter = (users: UserProfileSchema[]) => {
dataSource: remoteDataSource(await makeUrl(userSearchUsers), { const resp: UserProfileSchema[] = [];
excluded: () => [ const ids = [
...(this.currentPicture.identifications || []).map( ...(this.currentPicture.identifications || []).map(
(i: IdentifiedUserSchema) => i.user.id, (i: IdentifiedUserSchema) => i.user.id,
), ),
], ];
resultConverter: (obj: AjaxResponse) => { for (const user of users) {
return { ...obj, text: (obj as UserProfileSchema).display_name }; if (!ids.includes(user.id)) {
}, resp.push(user);
}), }
pictureGetter: (user: RemoteResult) => user.profile_pict, }
}); return resp;
};
this.currentPicture = this.pictures.find( this.currentPicture = this.pictures.find(
(i: PictureSchema) => i.id === config.firstPictureId, (i: PictureSchema) => i.id === config.firstPictureId,
); );
@ -302,16 +297,20 @@ exportToHtml("loadViewer", (config: ViewerConfig) => {
* Send the identification request and update the list of identified users. * Send the identification request and update the list of identified users.
*/ */
async submitIdentification(): Promise<void> { async submitIdentification(): Promise<void> {
const widget: TomSelect = this.selector.widget;
await picturesIdentifyUsers({ await picturesIdentifyUsers({
path: { path: {
// biome-ignore lint/style/useNamingConvention: api is in snake_case // biome-ignore lint/style/useNamingConvention: api is in snake_case
picture_id: this.currentPicture.id, picture_id: this.currentPicture.id,
}, },
body: this.selector.val().map((i: string) => Number.parseInt(i)), body: widget.items.map((i: string) => Number.parseInt(i)),
}); });
// refresh the identified users list // refresh the identified users list
await this.currentPicture.loadIdentifications({ forceReload: true }); await this.currentPicture.loadIdentifications({ forceReload: true });
this.selector.empty().trigger("change");
// Clear selection and cache of retrieved user so they can be filtered again
widget.clear(false);
widget.clearOptions();
}, },
/** /**

View File

@ -1,11 +1,12 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{%- block additional_css -%} {%- block additional_css -%}
<link rel="stylesheet" href="{{ static('webpack/ajax-select-index.css') }}">
<link rel="stylesheet" href="{{ static('sas/css/picture.scss') }}"> <link rel="stylesheet" href="{{ static('sas/css/picture.scss') }}">
<link rel="stylesheet" href="{{ static('webpack/sas/viewer-index.css') }}">
{%- endblock -%} {%- endblock -%}
{%- block additional_js -%} {%- block additional_js -%}
<script defer src="{{ static('webpack/ajax-select-index.ts') }}"></script>
<script defer src="{{ static("webpack/sas/viewer-index.ts") }}"></script> <script defer src="{{ static("webpack/sas/viewer-index.ts") }}"></script>
{%- endblock -%} {%- endblock -%}
@ -156,7 +157,12 @@
<h5>{% trans %}People{% endtrans %}</h5> <h5>{% trans %}People{% endtrans %}</h5>
{% if user.was_subscribed %} {% if user.was_subscribed %}
<form @submit.prevent="submitIdentification" x-show="!!selector"> <form @submit.prevent="submitIdentification" x-show="!!selector">
<select x-ref="search" multiple="multiple"></select> <ajax-select
x-ref="search"
multiple
data-delay="300"
data-placeholder="{%- trans -%}Identify users on pictures{%- endtrans -%}"
></ajax-select>
<input type="submit" value="{% trans %}Go{% endtrans %}"/> <input type="submit" value="{% trans %}Go{% endtrans %}"/>
</form> </form>
{% endif %} {% endif %}

View File

@ -7,6 +7,7 @@
"target": "es6", "target": "es6",
"allowJs": true, "allowJs": true,
"moduleResolution": "node", "moduleResolution": "node",
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
"types": ["jquery", "alpinejs"], "types": ["jquery", "alpinejs"],