generic-skin 3.7.8 → 3.7.9
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.
- package/apps/vueChrono.js +26 -26
- package/apps/vueChrono.min.js +1 -1
- package/apps/vueDefault.js +24 -24
- package/apps/vueDefault.min.js +2 -2
- package/apps/vueMulti.js +24 -24
- package/apps/vueMulti.min.js +1 -1
- package/apps/vueRela.js +28 -28
- package/apps/vueRela.min.js +1 -1
- package/config/vueComponents.js +80 -80
- package/config/vueComponents.min.js +2 -2
- package/extensions/vueRouter.js +1 -1
- package/general.js +6 -6
- package/general.min.js +1 -1
- package/options/noManagers.js +15 -15
- package/options/noManagers.min.js +1 -1
- package/package.json +1 -1
- package/pages/ucp.js +14 -14
- package/pages/ucp.min.js +1 -1
package/apps/vueRela.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Vue.component('modal-relaciones', {
|
|
2
|
-
props: ['
|
|
2
|
+
props: ['element', 'type'],
|
|
3
3
|
data() {
|
|
4
4
|
return {
|
|
5
5
|
state: {
|
|
@@ -11,15 +11,15 @@ Vue.component('modal-relaciones', {
|
|
|
11
11
|
people: []
|
|
12
12
|
},
|
|
13
13
|
content: {
|
|
14
|
-
edit: JSON.parse(JSON.stringify(this.
|
|
15
|
-
current: this.
|
|
14
|
+
edit: JSON.parse(JSON.stringify(this.element)),
|
|
15
|
+
current: this.element
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
computed: {
|
|
20
20
|
modalTitle() {
|
|
21
|
-
if (this.
|
|
22
|
-
else if (this.
|
|
21
|
+
if (this.type === 'new') return 'Nueva entrada';
|
|
22
|
+
else if (this.type === 'edit') return 'Editar entrada';
|
|
23
23
|
},
|
|
24
24
|
oneCheck() {
|
|
25
25
|
let final = '';
|
|
@@ -101,7 +101,7 @@ Vue.component('modal-relaciones', {
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
template: `
|
|
104
|
-
<modal-foro :
|
|
104
|
+
<modal-foro :title="modalTitle" @modal-close="modalClose()">
|
|
105
105
|
<template v-if="content.edit.type">
|
|
106
106
|
<template slot="content">
|
|
107
107
|
<aviso-foro v-show="oneCheck.length">
|
|
@@ -109,7 +109,7 @@ Vue.component('modal-relaciones', {
|
|
|
109
109
|
</aviso-foro>
|
|
110
110
|
<ul class="forum-fieldlist no-style">
|
|
111
111
|
<li>
|
|
112
|
-
<campo-foro
|
|
112
|
+
<campo-foro name="Nombre">
|
|
113
113
|
<div class="character-selector">
|
|
114
114
|
<input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del personaje." disabled />
|
|
115
115
|
<a class="character-custom" @click="updateData()" :title="'Actualizar avatar de «' + content.current.name + '»'">
|
|
@@ -122,7 +122,7 @@ Vue.component('modal-relaciones', {
|
|
|
122
122
|
<h4 class="mt-5">Descripción</h4>
|
|
123
123
|
<ul class="forum-fieldlist no-style">
|
|
124
124
|
<li class="has-no-label">
|
|
125
|
-
<campo-foro
|
|
125
|
+
<campo-foro name="Descripción">
|
|
126
126
|
<textarea v-model="content.edit.desc" placeholder="Escribe la descripción del personaje."></textarea>
|
|
127
127
|
</campo-foro>
|
|
128
128
|
</li>
|
|
@@ -141,7 +141,7 @@ Vue.component('modal-relaciones', {
|
|
|
141
141
|
</aviso-foro>
|
|
142
142
|
<ul class="forum-fieldlist no-style">
|
|
143
143
|
<li>
|
|
144
|
-
<campo-foro
|
|
144
|
+
<campo-foro name="Nombre">
|
|
145
145
|
<div class="character-selector">
|
|
146
146
|
<input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del personaje." />
|
|
147
147
|
<ul class="no-style selector-list" v-if="sortedCharacters.length > 0">
|
|
@@ -151,17 +151,17 @@ Vue.component('modal-relaciones', {
|
|
|
151
151
|
</campo-foro>
|
|
152
152
|
</li>
|
|
153
153
|
<li>
|
|
154
|
-
<campo-foro
|
|
154
|
+
<campo-foro name="Imagen">
|
|
155
155
|
<input type="text" v-model="content.edit.img" placeholder="Escribe el enlace a la imagen del personaje." />
|
|
156
156
|
</campo-foro>
|
|
157
157
|
</li>
|
|
158
158
|
<li>
|
|
159
|
-
<campo-foro
|
|
159
|
+
<campo-foro name="Perfil">
|
|
160
160
|
<input type="text" v-model="content.edit.url" placeholder="Escribe el enlace al perfil del personaje." />
|
|
161
161
|
</campo-foro>
|
|
162
162
|
</li>
|
|
163
163
|
<li>
|
|
164
|
-
<campo-foro
|
|
164
|
+
<campo-foro name="Facción">
|
|
165
165
|
<div class="select-container">
|
|
166
166
|
<select v-model="content.edit.color">
|
|
167
167
|
<option value="-1" hidden>Selecciona la facción del personaje.</option>
|
|
@@ -179,7 +179,7 @@ Vue.component('modal-relaciones', {
|
|
|
179
179
|
<h4 class="mt-5">Descripción</h4>
|
|
180
180
|
<ul class="forum-fieldlist no-style">
|
|
181
181
|
<li class="has-no-label">
|
|
182
|
-
<campo-foro
|
|
182
|
+
<campo-foro name="Descripción">
|
|
183
183
|
<textarea v-model="content.edit.desc" placeholder="Escribe la descripción del personaje."></textarea>
|
|
184
184
|
</campo-foro>
|
|
185
185
|
</li>
|
|
@@ -326,11 +326,11 @@ Vue.component('gestor-relaciones', {
|
|
|
326
326
|
</div>
|
|
327
327
|
<separador-foro />
|
|
328
328
|
<template v-if="state.page === 0">
|
|
329
|
-
<cargando-foro
|
|
329
|
+
<cargando-foro text="Cargando utilidad…"></cargando-foro>
|
|
330
330
|
</template>
|
|
331
331
|
<template v-else-if="state.page === 1">
|
|
332
|
-
<modal-relaciones v-if="modal.status" :
|
|
333
|
-
<mando-foro
|
|
332
|
+
<modal-relaciones v-if="modal.status" :type="modal.type" :element="entry"></modal-relaciones>
|
|
333
|
+
<mando-foro id="upper-controls" app="true">
|
|
334
334
|
<template slot="pagination" v-if="paginationContent.pages.length > 1">
|
|
335
335
|
<a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" @click="state.pagination -= 1">
|
|
336
336
|
<i class="fas fa-chevron-left"></i>
|
|
@@ -345,10 +345,10 @@ Vue.component('gestor-relaciones', {
|
|
|
345
345
|
</template>
|
|
346
346
|
<template slot="controls">
|
|
347
347
|
<li @click="addEntry($event)">
|
|
348
|
-
<boton-foro
|
|
348
|
+
<boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>
|
|
349
349
|
</li>
|
|
350
350
|
<li v-if="finalCheck" @click="save($event)">
|
|
351
|
-
<boton-foro
|
|
351
|
+
<boton-foro url="#" name="Guardar" icon="fas fa-save" type="no-name"></boton-foro>
|
|
352
352
|
</li>
|
|
353
353
|
</template>
|
|
354
354
|
</mando-foro>
|
|
@@ -359,10 +359,10 @@ Vue.component('gestor-relaciones', {
|
|
|
359
359
|
</li>
|
|
360
360
|
</template>
|
|
361
361
|
<template v-else v-for="character in paginationContent.content">
|
|
362
|
-
<elemento-relaciones :
|
|
362
|
+
<elemento-relaciones :element="character" type="manager" :id="character.position" />
|
|
363
363
|
</template>
|
|
364
364
|
</ul>
|
|
365
|
-
<mando-foro
|
|
365
|
+
<mando-foro id="lower-controls" app="true">
|
|
366
366
|
<template slot="pagination" v-if="paginationContent.pages.length > 1">
|
|
367
367
|
<a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" @click="state.pagination -= 1">
|
|
368
368
|
<i class="fas fa-chevron-left"></i>
|
|
@@ -377,27 +377,27 @@ Vue.component('gestor-relaciones', {
|
|
|
377
377
|
</template>
|
|
378
378
|
<template slot="controls">
|
|
379
379
|
<li @click="addEntry($event)">
|
|
380
|
-
<boton-foro
|
|
380
|
+
<boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>
|
|
381
381
|
</li>
|
|
382
382
|
<li v-if="finalCheck" @click="save($event)">
|
|
383
|
-
<boton-foro
|
|
383
|
+
<boton-foro url="#" name="Guardar" icon="fas fa-save" type="no-name"></boton-foro>
|
|
384
384
|
</li>
|
|
385
385
|
</template>
|
|
386
386
|
</mando-foro>
|
|
387
387
|
</template>
|
|
388
388
|
<template v-else-if="state.page === 2">
|
|
389
|
-
<cargando-foro
|
|
389
|
+
<cargando-foro text="Actualizando información…"></cargando-foro>
|
|
390
390
|
</template>
|
|
391
391
|
</section>
|
|
392
392
|
`
|
|
393
393
|
});
|
|
394
394
|
|
|
395
395
|
Vue.component('elemento-relaciones', {
|
|
396
|
-
props: ['
|
|
396
|
+
props: ['element', 'type', 'id'],
|
|
397
397
|
data() {
|
|
398
398
|
return {
|
|
399
399
|
profileName: forumConfig.profileOptions.profileName || 'perfil',
|
|
400
|
-
content: this.
|
|
400
|
+
content: this.element
|
|
401
401
|
}
|
|
402
402
|
},
|
|
403
403
|
computed: {
|
|
@@ -409,7 +409,7 @@ Vue.component('elemento-relaciones', {
|
|
|
409
409
|
deleteElement() {
|
|
410
410
|
this.$parent.content.edit.splice(this.$parent.content.edit.map((item) => {
|
|
411
411
|
return item.position;
|
|
412
|
-
}).indexOf(this.
|
|
412
|
+
}).indexOf(this.id), 1);
|
|
413
413
|
|
|
414
414
|
if (this.$parent.paginationContent.content.length === 0 && this.$parent.state.pagination !== 0) {
|
|
415
415
|
this.$parent.state.pagination -= 1;
|
|
@@ -425,7 +425,7 @@ Vue.component('elemento-relaciones', {
|
|
|
425
425
|
},
|
|
426
426
|
template: `
|
|
427
427
|
<li :class="realClass">
|
|
428
|
-
<template v-if="
|
|
428
|
+
<template v-if="type === 'manager'">
|
|
429
429
|
<a class="rela-element rela-manager">
|
|
430
430
|
<div class="rela-image" :style="'background-image: url(' + content.img + ')'"></div>
|
|
431
431
|
<div class="rela-content">
|
|
@@ -437,7 +437,7 @@ Vue.component('elemento-relaciones', {
|
|
|
437
437
|
</div>
|
|
438
438
|
</a>
|
|
439
439
|
</template>
|
|
440
|
-
<template v-else-if="
|
|
440
|
+
<template v-else-if="type === 'profile'">
|
|
441
441
|
<template v-if="content.type">
|
|
442
442
|
<a class="rela-element" :href="content.url" target="_blank" :title="'Ir al ' + profileName + ' de «' + content.name + '»'">
|
|
443
443
|
<div class="rela-image" :style="'background-image: url(' + content.img + ')'"></div>
|
package/apps/vueRela.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Vue.component("modal-relaciones",{props:["dataElement","dataType"],data(){return{state:{modal:!1},info:{users:this.$parent.users,user:"",people:[]},content:{edit:JSON.parse(JSON.stringify(this.dataElement)),current:this.dataElement}}},computed:{modalTitle(){return"new"===this.dataType?"Nueva entrada":"edit"===this.dataType?"Editar entrada":void 0},oneCheck(){let e="";return Object.keys(this.content.edit).length?(this.content.edit.name.length<3&&(e+="<li>Escribe el nombre del personaje.</li>"),-1===this.content.edit.color&&(e+="<li>Selecciona una facción para el personaje.</li>"),-1===this.content.edit.url.indexOf("/u")&&(e+="<li>Escribe el enlace al perfil del personaje.</li>"),this.content.edit.img.match(/(jpg|jpeg|png)$/i)||(e+="<li>Escribe el enlace a la imagen del personaje (debe ser de 190x190).</li>"),this.content.edit.desc.length<151&&(e+="<li>Escribe una descripción lo suficientemente larga (150 carácteres al menos).</li>"),e):e},finalCheck(){return JSON.stringify(this.content.current)!==JSON.stringify(this.content.edit)},sortedCharacters(){return Object.keys(this.content.edit).length?this.info.users.filter(e=>-1===this.info.people.indexOf(e.user)).filter(e=>e.user.toLowerCase().indexOf(this.content.edit.name.toLowerCase())>-1):this.$parent.users.map(e=>e.user)}},methods:{modalClose(){this.$parent.modal.type="new",this.$parent.modal.status=!1,this.$parent.setEntry()},addCharacter:function(e){this.content.edit.type=!0,this.content.edit.name=e.user,this.content.edit.img=e.img,this.content.edit.color=e.color,this.content.edit.url=e.id},updateData(){const e=JSON.parse(JSON.stringify(this.info.users)).filter(e=>e.user===this.content.current.name)[0];this.content.edit.img=e.img},pushElement(){"edit"===this.$parent.modal.type&&this.$parent.content.edit.splice(this.$parent.content.edit.map(e=>e.position).indexOf(this.content.current.position),1);let e=this.content.edit;"new"===this.$parent.modal.type&&(e.position=this.$parent.content.edit.length),this.$parent.content.edit.push(e),this.modalClose()}},template:'\n <modal-foro :data-title="modalTitle" @modal-close="modalClose()">\n <template v-if="content.edit.type">\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Nombre">\n <div class="character-selector">\n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del personaje." disabled />\n <a class="character-custom" @click="updateData()" :title="\'Actualizar avatar de «\' + content.current.name + \'»\'">\n <i class="fas fa-redo-alt"></i>\n </a>\n </div>\n </campo-foro>\n </li>\n </ul>\n <h4 class="mt-5">Descripción</h4>\n <ul class="forum-fieldlist no-style">\n <li class="has-no-label">\n <campo-foro data-name="Descripción">\n <textarea v-model="content.edit.desc" placeholder="Escribe la descripción del personaje."></textarea>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls" v-if="!oneCheck.length && finalCheck">\n <controles-modal>\n <button class="button1 btn-main" @click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </template>\n <template v-else>\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Nombre">\n <div class="character-selector"> \n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del personaje." />\n <ul class="no-style selector-list" v-if="sortedCharacters.length > 0">\n <li v-for="(character, index) in sortedCharacters" @click="addCharacter(character)" :title="\'Seleccionar \' + character.user">{{ character.user }}<i class="fas fa-plus"></i></li>\n </ul>\n </div>\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Imagen">\n <input type="text" v-model="content.edit.img" placeholder="Escribe el enlace a la imagen del personaje." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Perfil">\n <input type="text" v-model="content.edit.url" placeholder="Escribe el enlace al perfil del personaje." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Facción">\n <div class="select-container">\n <select v-model="content.edit.color">\n <option value="-1" hidden>Selecciona la facción del personaje.</option>\n <option value="azul">Imperio Galáctico</option>\n <option value="rojo">Remanente Purista</option>\n <option value="naranja">Autoridad del Sector Corporativo</option>\n <option value="verde">Cártel</option>\n <option value="turquesa">Nueva Rebelión</option>\n <option value="amarillo">Neutral</option>\n </select>\n </div>\n </campo-foro>\n </li>\n </ul>\n <h4 class="mt-5">Descripción</h4>\n <ul class="forum-fieldlist no-style">\n <li class="has-no-label">\n <campo-foro data-name="Descripción">\n <textarea v-model="content.edit.desc" placeholder="Escribe la descripción del personaje."></textarea>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls" v-if="!oneCheck.length && finalCheck">\n <controles-modal>\n <button class="button1 btn-main" @click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </template>\n </modal-foro>\n '}),Vue.component("gestor-relaciones",{data:()=>({render:0,modal:{type:"new",status:!1},users:[],state:{page:0,pagination:0},entry:{},content:{edit:[],current:[]}}),computed:{sortedContent(){return JSON.parse(JSON.stringify(this.content.edit)).sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)},paginationContent(){const e=parseInt(forumConfig.skinOptions.paginationDefault/2)+1,t=Math.floor((this.sortedContent.length-1)/e)+1;let n=[];for(let e=0;e<t;e++)n.push(e);return this.forceRerender(),{pages:n,content:this.sortedContent.slice(this.state.pagination*e,(this.state.pagination+1)*e)}},finalCheck(){return JSON.stringify(this.content.current)!==JSON.stringify(this.content.edit)}},methods:{forceRerender(){this.render+=1},setEntry(){this.entry={type:!1,color:-1,url:"",img:"",name:"",desc:""}},addEntry:function(e){e.preventDefault(),this.modal.status=!0},save:function(e){e.preventDefault(),this.state.page=2;const t=this.sortedContent.map(e=>(void 0!==e.position&&delete e.position,e));FNR.user.profile.setData([{name:forumConfig.profileUser.relaField,type:"textarea",value:JSON.stringify(t).replace(/"/g,"`")}]).then(e=>{e?(FNR.html.genNotification("Atención","Información actualizada sin inconvenientes.","fas fa-check"),setTimeout(()=>{window.location.reload()},2e3)):FNR.html.genNotification("Atención","Hubo un problema al actualizar. Dale otro intento.","fas fa-exclamation")})}},created(){FNR.user.profile.getData([{name:forumConfig.profileUser.relaField,type:"textarea"}]).then(e=>{const t=FNR.utility.genArray(e[0].value).map((e,t)=>{let n=e;return n.position=t,n});this.content.edit=t,this.content.current=JSON.parse(JSON.stringify(t)),FNR.forum.getMembers().then(e=>{this.setEntry(),this.users=e,this.state.page=1})})},template:'\n <section id="forum-relationships" class="wiki-content is-dramatic">\n <div class="is-content">\n <h2>Relaciones</h2>\n <hr />\n <p>En esta página podrás editar las relaciones de tu personaje.</p>\n <p>Ante cualquier duda o problema, contacta con la administración.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro data-text="Cargando utilidad…"></cargando-foro>\n </template>\n <template v-else-if="state.page === 1">\n <modal-relaciones v-if="modal.status" :data-type="modal.type" :data-element="entry"></modal-relaciones>\n <mando-foro data-id="upper-controls" data-app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" @click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else @click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" @click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <ul id="forum-rplist" :class="\'no-style\' + (!paginationContent.content.length ? \' no-results\': \'\')" :key="render">\n <template v-if="!paginationContent.content.length">\n <li class="is-not-topic is-not-lastpost">\n <h6>No hay entradas en tus relaciones</h6>\n </li>\n </template>\n <template v-else v-for="character in paginationContent.content">\n <elemento-relaciones :data-element="character" data-type="manager" :data-id="character.position" />\n </template>\n </ul>\n <mando-foro data-id="lower-controls" data-app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" @click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else @click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" @click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n </template>\n <template v-else-if="state.page === 2">\n <cargando-foro data-text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n '}),Vue.component("elemento-relaciones",{props:["dataElement","dataType","dataId"],data(){return{profileName:forumConfig.profileOptions.profileName||"perfil",content:this.dataElement}},computed:{realClass(){return"rela-list usergroup-"+this.content.color}},methods:{deleteElement(){this.$parent.content.edit.splice(this.$parent.content.edit.map(e=>e.position).indexOf(this.dataId),1),0===this.$parent.paginationContent.content.length&&0!==this.$parent.state.pagination&&(this.$parent.state.pagination-=1),this.$parent.forceRerender()},editElement(){this.$parent.modal.type="edit",this.$parent.entry=this.content,this.$parent.modal.status=!0}},template:'\n <li :class="realClass">\n <template v-if="dataType === \'manager\'">\n <a class="rela-element rela-manager">\n <div class="rela-image" :style="\'background-image: url(\' + content.img + \')\'"></div>\n <div class="rela-content">\n <div class="rela-title">\n <h4>{{ content.name }}</h4>\n <div class="rp-controls"><span @click="editElement()" title="Editar entrada">Editar</span> / <span @click="deleteElement()" title="Eliminar entrada">Eliminar</span></div>\n </div>\n <div class="small-text is-content" :inner-html.prop="content.desc | turn-br"></div>\n </div>\n </a>\n </template>\n <template v-else-if="dataType === \'profile\'">\n <template v-if="content.type">\n <a class="rela-element" :href="content.url" target="_blank" :title="\'Ir al \' + profileName + \' de «\' + content.name + \'»\'">\n <div class="rela-image" :style="\'background-image: url(\' + content.img + \')\'"></div>\n <div class="rela-content">\n <div class="rela-title">\n <h4>{{ content.name }}</h4>\n </div>\n <div class="small-text is-content" :inner-html.prop="content.desc | turn-br"></div>\n </div>\n </a>\n </template>\n <template v-else>\n <a class="rela-element">\n <div class="rela-image" :style="\'background-image: url(\' + content.img + \')\'"></div>\n <div class="rela-content">\n <div class="rela-title">\n <h4>{{ content.name }}</h4>\n </div>\n <div class="small-text is-content" :inner-html.prop="content.desc | turn-br"></div>\n </div>\n </a>\n </template>\n </template>\n </li>\n '});
|
|
1
|
+
Vue.component("modal-relaciones",{props:["element","type"],data(){return{state:{modal:!1},info:{users:this.$parent.users,user:"",people:[]},content:{edit:JSON.parse(JSON.stringify(this.element)),current:this.element}}},computed:{modalTitle(){return"new"===this.type?"Nueva entrada":"edit"===this.type?"Editar entrada":void 0},oneCheck(){let e="";return Object.keys(this.content.edit).length?(this.content.edit.name.length<3&&(e+="<li>Escribe el nombre del personaje.</li>"),-1===this.content.edit.color&&(e+="<li>Selecciona una facción para el personaje.</li>"),-1===this.content.edit.url.indexOf("/u")&&(e+="<li>Escribe el enlace al perfil del personaje.</li>"),this.content.edit.img.match(/(jpg|jpeg|png)$/i)||(e+="<li>Escribe el enlace a la imagen del personaje (debe ser de 190x190).</li>"),this.content.edit.desc.length<151&&(e+="<li>Escribe una descripción lo suficientemente larga (150 carácteres al menos).</li>"),e):e},finalCheck(){return JSON.stringify(this.content.current)!==JSON.stringify(this.content.edit)},sortedCharacters(){return Object.keys(this.content.edit).length?this.info.users.filter(e=>-1===this.info.people.indexOf(e.user)).filter(e=>e.user.toLowerCase().indexOf(this.content.edit.name.toLowerCase())>-1):this.$parent.users.map(e=>e.user)}},methods:{modalClose(){this.$parent.modal.type="new",this.$parent.modal.status=!1,this.$parent.setEntry()},addCharacter(e){this.content.edit.type=!0,this.content.edit.name=e.user,this.content.edit.img=e.img,this.content.edit.color=e.color,this.content.edit.url=e.id},updateData(){const e=JSON.parse(JSON.stringify(this.info.users)).filter(e=>e.user===this.content.current.name)[0];this.content.edit.img=e.img},pushElement(){"edit"===this.$parent.modal.type&&this.$parent.content.edit.splice(this.$parent.content.edit.map(e=>e.position).indexOf(this.content.current.position),1);let e=this.content.edit;"new"===this.$parent.modal.type&&(e.position=this.$parent.content.edit.length),this.$parent.content.edit.push(e),this.modalClose()}},template:'\n <modal-foro :title="modalTitle" @modal-close="modalClose()">\n <template v-if="content.edit.type">\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro name="Nombre">\n <div class="character-selector">\n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del personaje." disabled />\n <a class="character-custom" @click="updateData()" :title="\'Actualizar avatar de «\' + content.current.name + \'»\'">\n <i class="fas fa-redo-alt"></i>\n </a>\n </div>\n </campo-foro>\n </li>\n </ul>\n <h4 class="mt-5">Descripción</h4>\n <ul class="forum-fieldlist no-style">\n <li class="has-no-label">\n <campo-foro name="Descripción">\n <textarea v-model="content.edit.desc" placeholder="Escribe la descripción del personaje."></textarea>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls" v-if="!oneCheck.length && finalCheck">\n <controles-modal>\n <button class="button1 btn-main" @click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </template>\n <template v-else>\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro name="Nombre">\n <div class="character-selector"> \n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del personaje." />\n <ul class="no-style selector-list" v-if="sortedCharacters.length > 0">\n <li v-for="(character, index) in sortedCharacters" @click="addCharacter(character)" :title="\'Seleccionar \' + character.user">{{ character.user }}<i class="fas fa-plus"></i></li>\n </ul>\n </div>\n </campo-foro>\n </li>\n <li>\n <campo-foro name="Imagen">\n <input type="text" v-model="content.edit.img" placeholder="Escribe el enlace a la imagen del personaje." />\n </campo-foro>\n </li>\n <li>\n <campo-foro name="Perfil">\n <input type="text" v-model="content.edit.url" placeholder="Escribe el enlace al perfil del personaje." />\n </campo-foro>\n </li>\n <li>\n <campo-foro name="Facción">\n <div class="select-container">\n <select v-model="content.edit.color">\n <option value="-1" hidden>Selecciona la facción del personaje.</option>\n <option value="azul">Imperio Galáctico</option>\n <option value="rojo">Remanente Purista</option>\n <option value="naranja">Autoridad del Sector Corporativo</option>\n <option value="verde">Cártel</option>\n <option value="turquesa">Nueva Rebelión</option>\n <option value="amarillo">Neutral</option>\n </select>\n </div>\n </campo-foro>\n </li>\n </ul>\n <h4 class="mt-5">Descripción</h4>\n <ul class="forum-fieldlist no-style">\n <li class="has-no-label">\n <campo-foro name="Descripción">\n <textarea v-model="content.edit.desc" placeholder="Escribe la descripción del personaje."></textarea>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls" v-if="!oneCheck.length && finalCheck">\n <controles-modal>\n <button class="button1 btn-main" @click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </template>\n </modal-foro>\n '}),Vue.component("gestor-relaciones",{data:()=>({render:0,modal:{type:"new",status:!1},users:[],state:{page:0,pagination:0},entry:{},content:{edit:[],current:[]}}),computed:{sortedContent(){return JSON.parse(JSON.stringify(this.content.edit)).sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)},paginationContent(){const e=parseInt(forumConfig.skinOptions.paginationDefault/2)+1,t=Math.floor((this.sortedContent.length-1)/e)+1;let n=[];for(let e=0;e<t;e++)n.push(e);return this.forceRerender(),{pages:n,content:this.sortedContent.slice(this.state.pagination*e,(this.state.pagination+1)*e)}},finalCheck(){return JSON.stringify(this.content.current)!==JSON.stringify(this.content.edit)}},methods:{forceRerender(){this.render+=1},setEntry(){this.entry={type:!1,color:-1,url:"",img:"",name:"",desc:""}},addEntry(e){e.preventDefault(),this.modal.status=!0},save(e){e.preventDefault(),this.state.page=2;const t=this.sortedContent.map(e=>(void 0!==e.position&&delete e.position,e));FNR.user.profile.setData([{name:forumConfig.profileUser.relaField,type:"textarea",value:JSON.stringify(t).replace(/"/g,"`")}]).then(e=>{e?(FNR.html.genNotification("Atención","Información actualizada sin inconvenientes.","fas fa-check"),setTimeout(()=>{window.location.reload()},2e3)):FNR.html.genNotification("Atención","Hubo un problema al actualizar. Dale otro intento.","fas fa-exclamation")})}},created(){FNR.user.profile.getData([{name:forumConfig.profileUser.relaField,type:"textarea"}]).then(e=>{const t=FNR.utility.genArray(e[0].value).map((e,t)=>{let n=e;return n.position=t,n});this.content.edit=t,this.content.current=JSON.parse(JSON.stringify(t)),FNR.forum.getMembers().then(e=>{this.setEntry(),this.users=e,this.state.page=1})})},template:'\n <section id="forum-relationships" class="wiki-content is-dramatic">\n <div class="is-content">\n <h2>Relaciones</h2>\n <hr />\n <p>En esta página podrás editar las relaciones de tu personaje.</p>\n <p>Ante cualquier duda o problema, contacta con la administración.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro text="Cargando utilidad…"></cargando-foro>\n </template>\n <template v-else-if="state.page === 1">\n <modal-relaciones v-if="modal.status" :type="modal.type" :element="entry"></modal-relaciones>\n <mando-foro id="upper-controls" app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" @click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else @click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" @click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro url="#" name="Guardar" icon="fas fa-save" type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <ul id="forum-rplist" :class="\'no-style\' + (!paginationContent.content.length ? \' no-results\': \'\')" :key="render">\n <template v-if="!paginationContent.content.length">\n <li class="is-not-topic is-not-lastpost">\n <h6>No hay entradas en tus relaciones</h6>\n </li>\n </template>\n <template v-else v-for="character in paginationContent.content">\n <elemento-relaciones :element="character" type="manager" :id="character.position" />\n </template>\n </ul>\n <mando-foro id="lower-controls" app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" @click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else @click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" @click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro url="#" name="Guardar" icon="fas fa-save" type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n </template>\n <template v-else-if="state.page === 2">\n <cargando-foro text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n '}),Vue.component("elemento-relaciones",{props:["element","type","id"],data(){return{profileName:forumConfig.profileOptions.profileName||"perfil",content:this.element}},computed:{realClass(){return"rela-list usergroup-"+this.content.color}},methods:{deleteElement(){this.$parent.content.edit.splice(this.$parent.content.edit.map(e=>e.position).indexOf(this.id),1),0===this.$parent.paginationContent.content.length&&0!==this.$parent.state.pagination&&(this.$parent.state.pagination-=1),this.$parent.forceRerender()},editElement(){this.$parent.modal.type="edit",this.$parent.entry=this.content,this.$parent.modal.status=!0}},template:'\n <li :class="realClass">\n <template v-if="type === \'manager\'">\n <a class="rela-element rela-manager">\n <div class="rela-image" :style="\'background-image: url(\' + content.img + \')\'"></div>\n <div class="rela-content">\n <div class="rela-title">\n <h4>{{ content.name }}</h4>\n <div class="rp-controls"><span @click="editElement()" title="Editar entrada">Editar</span> / <span @click="deleteElement()" title="Eliminar entrada">Eliminar</span></div>\n </div>\n <div class="small-text is-content" :inner-html.prop="content.desc | turn-br"></div>\n </div>\n </a>\n </template>\n <template v-else-if="type === \'profile\'">\n <template v-if="content.type">\n <a class="rela-element" :href="content.url" target="_blank" :title="\'Ir al \' + profileName + \' de «\' + content.name + \'»\'">\n <div class="rela-image" :style="\'background-image: url(\' + content.img + \')\'"></div>\n <div class="rela-content">\n <div class="rela-title">\n <h4>{{ content.name }}</h4>\n </div>\n <div class="small-text is-content" :inner-html.prop="content.desc | turn-br"></div>\n </div>\n </a>\n </template>\n <template v-else>\n <a class="rela-element">\n <div class="rela-image" :style="\'background-image: url(\' + content.img + \')\'"></div>\n <div class="rela-content">\n <div class="rela-title">\n <h4>{{ content.name }}</h4>\n </div>\n <div class="small-text is-content" :inner-html.prop="content.desc | turn-br"></div>\n </div>\n </a>\n </template>\n </template>\n </li>\n '});
|