generic-skin 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,95 @@
1
+ Vue.component('directorio-personajes', {
2
+ data() {
3
+ return {
4
+ loading: true,
5
+ busqueda: '',
6
+ personajes: [],
7
+ }
8
+ },
9
+ computed: {
10
+ personajesFiltrados() {
11
+ if (!this.busqueda) {
12
+ return this.personajes;
13
+ }
14
+
15
+ const busquedaLower = this.busqueda.toLowerCase();
16
+
17
+ return this.personajes.filter(personaje =>
18
+ personaje.name.toLowerCase().includes(busquedaLower)
19
+ );
20
+ }
21
+ },
22
+ methods: {
23
+ async obtainCharacters() {
24
+ let activeMembers;
25
+
26
+ try {
27
+ activeMembers = await FNR.cache.useData('members', .25);
28
+ } catch (e) {
29
+ activeMembers = null;
30
+ }
31
+
32
+ if (!activeMembers) {
33
+ activeMembers = await FNR.forum.getMembers();
34
+ FNR.cache.setData('members', activeMembers, .25);
35
+ }
36
+
37
+ const profiles = await Promise.all(
38
+ activeMembers.map(user => FNR.user.getProfile(user.id.replace('/u', ''), .25))
39
+ );
40
+
41
+ this.personajes = profiles;
42
+ this.loading = false;
43
+ }
44
+ },
45
+ created() {
46
+ this.obtainCharacters();
47
+ },
48
+ template: `
49
+ <section class="member-directory">
50
+ <section v-if="!loading" class="generic-element">
51
+ <cabespecial-foro>
52
+ <template slot="title">Directorio de Personajes</template>
53
+ </cabespecial-foro>
54
+ <section id="memberlist-options" class="field-block">
55
+ <ul class="forum-fieldlist no-style">
56
+ <li class="field-element field-nombre">
57
+ <div class="forum-field">
58
+ <div class="field-name">Nombre</div>
59
+ <div class="field-content">
60
+ <input type="text" v-model="busqueda" placeholder="Buscar por nombre de personaje">
61
+ </div>
62
+ </div>
63
+ </li>
64
+ </ul>
65
+ </section>
66
+ <separador-foro />
67
+ <cabecera-foro>
68
+ <template slot="title">Listado</template>
69
+ </cabecera-foro>
70
+ <section class="forum-memberlist">
71
+ <ul class="memberlist-members no-style">
72
+ <li v-for="personaje in personajesFiltrados" :key="personaje.name" class="row">
73
+ <memberitem-foro type="directory">
74
+ <template slot="avatar">{personaje.avatar}</template>
75
+ <template slot="last">{personaje.lastVisit}</template>
76
+ <template slot="name">{personaje.name}</template>
77
+ <template slot="posts">{personaje.messages.public}</template>
78
+ </memberitem-foro>
79
+ </li>
80
+ <li>
81
+ <h6>No hay personajes que coincidan con la búsqueda.</h6>
82
+ </li>
83
+ </ul>
84
+ </section>
85
+ </section>
86
+ <section v-else class="generic-element">
87
+ <cabespecial-foro>
88
+ <template slot="title">Directorio de Personajes</template>
89
+ </cabespecial-foro>
90
+ <separador-foro />
91
+ <cargando-foro text="Cargando utilidad…"></cargando-foro>
92
+ </section>
93
+ </section>
94
+ `
95
+ });
@@ -0,0 +1 @@
1
+ Vue.component("directorio-personajes",{data:()=>({loading:!0,busqueda:"",personajes:[]}),computed:{personajesFiltrados(){if(!this.busqueda)return this.personajes;const e=this.busqueda.toLowerCase();return this.personajes.filter(a=>a.name.toLowerCase().includes(e))}},methods:{async obtainCharacters(){let e;try{e=await FNR.cache.useData("members",.25)}catch(a){e=null}e||(e=await FNR.forum.getMembers(),FNR.cache.setData("members",e,.25));const a=await Promise.all(e.map(e=>FNR.user.getProfile(e.id.replace("/u",""),.25)));this.personajes=a,this.loading=!1}},created(){this.obtainCharacters()},template:'\n <section class="member-directory">\n <section v-if="!loading" class="generic-element">\n <cabespecial-foro>\n <template slot="title">Directorio de Personajes</template>\n </cabespecial-foro>\n <section id="memberlist-options" class="field-block">\n <ul class="forum-fieldlist no-style">\n <li class="field-element field-nombre">\n <div class="forum-field">\n <div class="field-name">Nombre</div>\n <div class="field-content">\n <input type="text" v-model="busqueda" placeholder="Buscar por nombre de personaje">\n </div>\n </div>\n </li>\n </ul>\n </section>\n <separador-foro />\n \t\t<cabecera-foro>\n <template slot="title">Listado</template>\n </cabecera-foro>\n <section class="forum-memberlist">\n <ul class="memberlist-members no-style">\n <li v-for="personaje in personajesFiltrados" :key="personaje.name" class="row">\n <memberitem-foro type="directory">\n <template slot="avatar">{personaje.avatar}</template>\n <template slot="last">{personaje.lastVisit}</template>\n <template slot="name">{personaje.name}</template>\n <template slot="posts">{personaje.messages.public}</template>\n </memberitem-foro>\n </li>\n <li>\n <h6>No hay personajes que coincidan con la búsqueda.</h6>\n </li>\n </ul>\n </section>\n </section>\n <section v-else class="generic-element">\n <cabespecial-foro>\n <template slot="title">Directorio de Personajes</template>\n </cabespecial-foro>\n <separador-foro />\n <cargando-foro text="Cargando utilidad…"></cargando-foro>\n </section>\n </section>\n '});
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "generic-skin",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Generic Forum Skin for Forumotion created by Gaylien.",
5
+ "license": "ISC",
6
+ "author": "Gaylien",
7
+ "type": "commonjs",
5
8
  "main": "readme.md",
6
9
  "scripts": {
7
10
  "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "author": "Gaylien",
10
- "license": "ISC"
11
+ }
11
12
  }