Skip to content
Snippets Groups Projects
Commit b7d42203 authored by Benoît Besnard's avatar Benoît Besnard
Browse files

Ajout tri par nom ou date

parent bb746ebc
No related branches found
No related tags found
1 merge request!5Ajout d'une page de prévisions de sorties
...@@ -3,10 +3,52 @@ ...@@ -3,10 +3,52 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead v-if="displayHead"> <thead v-if="displayHead">
<tr> <tr>
<th scope="col">UID</th> <th scope="col" @click="sort('uid')">
<th scope="col" class="d-none d-xl-table-cell" v-if="displayPubkey"> UID
<div class="d-inline-block position-absolute ml-2">
<div
class="up"
:class="{
sorted: currentSortDir == 'desc' && currentSort == 'uid',
invisible: currentSortDir == 'asc' && currentSort == 'uid'
}">
</div>
<div
class="down"
:class="{
sorted: currentSortDir == 'asc' && currentSort == 'uid',
invisible: currentSortDir == 'desc' && currentSort == 'uid'
}">
</div>
</div>
</th>
<th scope="col" class="d-none d-xl-table-cell" v-if="displayPubkey && !displayOnlyDate">
{{ $t("cle.publique.title") }} {{ $t("cle.publique.title") }}
</th> </th>
<th scope="col" class="d-none d-xl-table-cell"
@click="sort('limit_date')" v-if="displayOnlyDate">
{{ $t("limitDate") }}
<div class="d-inline-block position-absolute ml-2">
<div
class="up"
:class="{
sorted: currentSortDir == 'desc' && currentSort == 'limit_date',
invisible: currentSortDir == 'asc' && currentSort == 'limit_date'
}">
</div>
<div
class="down"
:class="{
sorted: currentSortDir == 'asc' && currentSort == 'limit_date',
invisible: currentSortDir == 'desc' && currentSort == 'limit_date'
}">
</div>
</div>
</th>
<th scope="col" class="d-none d-sm-table-cell" v-if="displayDate"> <th scope="col" class="d-none d-sm-table-cell" v-if="displayDate">
{{ $t("membre.datelimpertestatut") }} {{ $t("membre.datelimpertestatut") }}
</th> </th>
...@@ -14,7 +56,7 @@ ...@@ -14,7 +56,7 @@
</thead> </thead>
<tbody> <tbody>
<tr <tr
v-for="member in members" v-for="member in membersSorted"
:key="member.uid" :key="member.uid"
@click="redirect(member.hash)"> @click="redirect(member.hash)">
<th scope="row"> <th scope="row">
...@@ -47,6 +89,12 @@ ...@@ -47,6 +89,12 @@
<script> <script>
export default { export default {
data() {
return {
currentSort: "uid",
currentSortDir: "asc"
}
},
props: { props: {
members: { members: {
type: Array, type: Array,
...@@ -91,7 +139,64 @@ export default { ...@@ -91,7 +139,64 @@ export default {
"'>" + "'>" +
this.$d(new Date(date * 1000), "long") + this.$d(new Date(date * 1000), "long") +
"</span>" "</span>"
},
sort(s) {
if (s === this.currentSort) {
this.currentSortDir = this.currentSortDir === "asc" ? "desc" : "asc"
}
this.currentSort = s
}
},
computed: {
membersSorted() {
return this.members
.slice()
.sort((a, b) => {
let modifier = this.currentSortDir === "desc" ? -1 : 1
if (this.currentSort == "limit_date") {
if(this.adhesion) {
if (a["limitDate"] < b["limitDate"]) return -1 * modifier
if (a["limitDate"] > b["limitDate"]) return 1 * modifier
} else {
if (a["received_certifications"]["limit"] < b["received_certifications"]["limit"]) return -1 * modifier
if (a["received_certifications"]["limit"] > b["received_certifications"]["limit"]) return 1 * modifier
}
} else {
if (a["uid"].toLowerCase() < b["uid"].toLowerCase())
return -1 * modifier
if (a["uid"].toLowerCase() > b["uid"].toLowerCase())
return 1 * modifier
}
return 0
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped>
thead th {
position: relative;
cursor: pointer;
background: var(--background-color-secondary);
&:last-child {
padding-right: 1.5rem;
text-align: right;
}
}
.up,
.down {
line-height: 10px;
font-size: 1.1rem;
transform: scale(1.5, 1);
opacity: 0.3;
}
.sorted {
opacity: 1;
}
</style>
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
"inout": "Entries and exits of the web of trust for the last 2 days", "inout": "Entries and exits of the web of trust for the last 2 days",
"inpreparation": "In preparation", "inpreparation": "In preparation",
"lexique": "Lexicon", "lexique": "Lexicon",
"limitDate": "Deadline",
"membre": { "membre": {
"calculant": { "calculant": {
"desc": "Member using his private key to forge blocks thanks to Duniter installed on a node accessible on the Internet network", "desc": "Member using his private key to forge blocks thanks to Duniter installed on a node accessible on the Internet network",
...@@ -153,6 +154,7 @@ ...@@ -153,6 +154,7 @@
"parmembre": "Forecasts by members", "parmembre": "Forecasts by members",
"title": "Forecasts" "title": "Forecasts"
}, },
"pubkey": "Public key",
"recherche": { "recherche": {
"desc": "Enter the start of a nickname or public key", "desc": "Enter the start of a nickname or public key",
"title": "Your search" "title": "Your search"
...@@ -185,6 +187,7 @@ ...@@ -185,6 +187,7 @@
"title": "Relative Theory of Money (RTM)" "title": "Relative Theory of Money (RTM)"
}, },
"type": "Type", "type": "Type",
"uid": "Unique identifier",
"valeur": "Value", "valeur": "Value",
"wot": { "wot": {
"desc": "Set of the individuals recognized as such by their peers including the links that bind them together through certifications", "desc": "Set of the individuals recognized as such by their peers including the links that bind them together through certifications",
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
"inout": "Entradas y salidas de la red de confianza en los últimos 2 días", "inout": "Entradas y salidas de la red de confianza en los últimos 2 días",
"inpreparation": "En preparación", "inpreparation": "En preparación",
"lexique": "Léxico", "lexique": "Léxico",
"limitDate": "Fecha límite",
"membre": { "membre": {
"calculant": { "calculant": {
"desc": "Miembro usando su clave privada para falsificar bloques gracias a Duniter instalado en un nodo accesible en la red de Internet", "desc": "Miembro usando su clave privada para falsificar bloques gracias a Duniter instalado en un nodo accesible en la red de Internet",
...@@ -153,6 +154,7 @@ ...@@ -153,6 +154,7 @@
"parmembre": "Previsiones por miembros", "parmembre": "Previsiones por miembros",
"title": "Pronósticos" "title": "Pronósticos"
}, },
"pubkey": "Llave pública",
"recherche": { "recherche": {
"desc": "Introduce el comienzo de un pseudónimo o llave pública", "desc": "Introduce el comienzo de un pseudónimo o llave pública",
"title": "Buscar" "title": "Buscar"
...@@ -185,6 +187,7 @@ ...@@ -185,6 +187,7 @@
"title": "Teoría relativa del dinero (TRD)" "title": "Teoría relativa del dinero (TRD)"
}, },
"type": "Tipo", "type": "Tipo",
"uid": "Identificador único",
"valeur": "Valor", "valeur": "Valor",
"wot": { "wot": {
"desc": "Conjunto de las personas reconocidas como tales por sus pares incluyendo los vínculos que las unen a través de certificaciones", "desc": "Conjunto de las personas reconocidas como tales por sus pares incluyendo los vínculos que las unen a través de certificaciones",
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
"inout": "Entrées et sorties de la toile de confiance des 2 derniers jours", "inout": "Entrées et sorties de la toile de confiance des 2 derniers jours",
"inpreparation": "En préparation", "inpreparation": "En préparation",
"lexique": "Lexique", "lexique": "Lexique",
"limitDate": "Date limite",
"membre": { "membre": {
"calculant": { "calculant": {
"desc": "Membre utilisant sa clé privée pour forger des blocs grâce à Duniter installé sur un noeud accessible sur le réseau Internet", "desc": "Membre utilisant sa clé privée pour forger des blocs grâce à Duniter installé sur un noeud accessible sur le réseau Internet",
...@@ -153,6 +154,7 @@ ...@@ -153,6 +154,7 @@
"parmembre": "Prévisions par membres", "parmembre": "Prévisions par membres",
"title": "Prévisions" "title": "Prévisions"
}, },
"pubkey": "Clef publique",
"recherche": { "recherche": {
"desc": "Saisissez le début d'un pseudo ou d'une clé publique", "desc": "Saisissez le début d'un pseudo ou d'une clé publique",
"title": "Votre recherche" "title": "Votre recherche"
...@@ -185,6 +187,7 @@ ...@@ -185,6 +187,7 @@
"title": "Théorie Relative de la Monnaie (TRM)" "title": "Théorie Relative de la Monnaie (TRM)"
}, },
"type": "Type", "type": "Type",
"uid": "Identifiant unique",
"valeur": "Valeur", "valeur": "Valeur",
"wot": { "wot": {
"desc": "Ensemble des membres et des certifications qui les relient entre eux", "desc": "Ensemble des membres et des certifications qui les relient entre eux",
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
<MemberList <MemberList
:members="wwResult['membership']" :members="wwResult['membership']"
:displayPubkey="false" :displayPubkey="false"
:displayHead="false"
:displayOnlyDate="true" :displayOnlyDate="true"
:displayDate="false" /> :displayDate="false" />
</div> </div>
...@@ -22,7 +21,6 @@ ...@@ -22,7 +21,6 @@
<MemberList <MemberList
:members="wwResult['outOfCerts']" :members="wwResult['outOfCerts']"
:displayPubkey="false" :displayPubkey="false"
:displayHead="false"
:displayOnlyDate="true" :displayOnlyDate="true"
:displayDate="false" :displayDate="false"
:adhesion="false" /> :adhesion="false" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment