mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 00:56:21 +00:00
feat: recordar el estado del details
This commit is contained in:
parent
3ba23a8b8c
commit
cbba822f31
3 changed files with 27 additions and 8 deletions
17
app/javascript/controllers/details_controller.js
Normal file
17
app/javascript/controllers/details_controller.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { Controller } from "stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [];
|
||||
|
||||
connect() {
|
||||
const state = window.sessionStorage.getItem(this.element.id);
|
||||
|
||||
if (state === "open") {
|
||||
this.element.setAttribute("open", true);
|
||||
}
|
||||
}
|
||||
|
||||
store(event = undefined) {
|
||||
window.sessionStorage.setItem(this.element.id, event.newState);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,11 @@
|
|||
-# Detail Cola de Moderación
|
||||
-#
|
||||
Detail Cola de Moderación
|
||||
|
||||
%details.details.py-2
|
||||
@param :id [String] El ID opcional sirve para mantener el historial de
|
||||
cuál estaba abierto y recuperarlo al cargar la página
|
||||
@param :summary [String] El resumen
|
||||
|
||||
%details.details.py-2{ id: local_assigns[:id], data: { controller: 'details', action: 'toggle->details#store' } }
|
||||
%summary
|
||||
.row
|
||||
.col-11.pr-2
|
||||
|
|
|
@ -3,14 +3,11 @@
|
|||
%h1= t('.title')
|
||||
.row
|
||||
.col
|
||||
- summary = t('.instances')
|
||||
= render 'layouts/details', summary: summary do
|
||||
= render 'layouts/details', id: 'summary', summary: t('.instances') do
|
||||
= render 'moderation_queue/instances', site: @site, instance_moderations: @instance_moderations, fediblock_states: @site.fediblock_states
|
||||
%hr
|
||||
- summary = t('.accounts')
|
||||
= render 'layouts/details', summary: summary do
|
||||
= render 'layouts/details', id: 'accounts', summary: t('.accounts') do
|
||||
= render 'moderation_queue/accounts', site: @site, post: @post, actor_moderations: @actor_moderations
|
||||
%hr
|
||||
- summary = t('.comments')
|
||||
= render 'layouts/details', summary: summary do
|
||||
= render 'layouts/details', id: 'comments', summary: t('.comments') do
|
||||
= render 'moderation_queue/comments', site: @site, post: @post, moderation_queue: @moderation_queue
|
||||
|
|
Loading…
Reference in a new issue