Files
Unify/application/demo/list/item/news.list.item.js
2025-12-25 11:16:59 +01:00

123 lines
1.7 KiB
JavaScript

import news from '../../news.js';
import body from './news.list.item.body.js';
import title from './news.list.item.title.js';
import price from './news.list.item.price.js';
import actions from './news.list.item.actions.js';
import groups from '/user/group/user.group.permission.js';
import gridViewRow from '/elements/gridView/gridView.body.row.js';
export default class newsListItem extends news, gridViewRow {
body = new body();
title = new title();
price = new price();
actions = new actions();
cursor = "pointer";
background;
#ifdef MACOS
fontSize = 14;
#endif
hoverBackgroundColor = "#363333"
#ifdef DARK
//mouseHoverColor = "#363333";
#endif
#ifdef LIGHT
//mouseHoverColor = "rgb(255 255 255 / 95%)";
#endif
async click() {
this.stateMachine.composeState( this.id, this.value );
await this.loadPage( this.id );
}
state async loadPage( id ) {
var rightSide = this.parents("newsPages");
var boundBox = this.defaultElement.getBoundingClientRect();
var width = boundBox.width;
#ifdef ANDROID
rightSide.newsItemPage.translateX = -width;
#elif
rightSide.newsItemPage.transform = "translateX(-600px)";
rightSide.newsPage.transform = "translateX(-600px)";
#endif
var newsPage = rightSide.newsPage;
newsPage.id = this.id;
await newsPage.sync();
newsPage.createComment.create();
//newsPage.updateFrostglass();
//newsPage.show();
}
mouseover() {
//this.background = this.mouseHoverColor;
}
mouseleave() {
//this.background = "none";
}
enableDELETE() {
this.actions.show();
}
disableDELETE() {
this.actions.hide();
}
permission() {
this.allow( groups.admin, "DELETE" );
}
}