mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Refactor userdatabuttons to follow max-params rule
This commit is contained in:
parent
6544b7c698
commit
29f16d5a04
1 changed files with 16 additions and 5 deletions
|
@ -12,7 +12,10 @@ const userDataMethods = {
|
||||||
markFavorite: markFavorite
|
markFavorite: markFavorite
|
||||||
};
|
};
|
||||||
|
|
||||||
function getUserDataButtonHtml(method, itemId, serverId, buttonCssClass, iconCssClass, icon, tooltip, style) {
|
function getUserDataButtonHtml(method, itemId, serverId, icon, tooltip, style, classes) {
|
||||||
|
let buttonCssClass = classes.buttonCssClass;
|
||||||
|
let iconCssClass = classes.iconCssClass;
|
||||||
|
|
||||||
if (style === 'fab-mini') {
|
if (style === 'fab-mini') {
|
||||||
style = 'fab';
|
style = 'fab';
|
||||||
buttonCssClass = buttonCssClass ? (buttonCssClass + ' mini') : 'mini';
|
buttonCssClass = buttonCssClass ? (buttonCssClass + ' mini') : 'mini';
|
||||||
|
@ -97,6 +100,11 @@ function getIconsHtml(options) {
|
||||||
|
|
||||||
const iconCssClass = options.iconCssClass;
|
const iconCssClass = options.iconCssClass;
|
||||||
|
|
||||||
|
const classes = {
|
||||||
|
buttonCssClass: btnCssClass,
|
||||||
|
iconCssClass: iconCssClass
|
||||||
|
};
|
||||||
|
|
||||||
const serverId = item.ServerId;
|
const serverId = item.ServerId;
|
||||||
|
|
||||||
if (includePlayed !== false) {
|
if (includePlayed !== false) {
|
||||||
|
@ -104,18 +112,21 @@ function getIconsHtml(options) {
|
||||||
|
|
||||||
if (itemHelper.canMarkPlayed(item)) {
|
if (itemHelper.canMarkPlayed(item)) {
|
||||||
if (userData.Played) {
|
if (userData.Played) {
|
||||||
html += getUserDataButtonHtml('markPlayed', itemId, serverId, btnCssClass + ' btnUserDataOn', iconCssClass, 'check', tooltipPlayed, style);
|
const buttonCssClass = classes.buttonCssClass + ' btnUserDataOn';
|
||||||
|
html += getUserDataButtonHtml('markPlayed', itemId, serverId, 'check', tooltipPlayed, style, {buttonCssClass: buttonCssClass, ...classes});
|
||||||
} else {
|
} else {
|
||||||
html += getUserDataButtonHtml('markPlayed', itemId, serverId, btnCssClass, iconCssClass, 'check', tooltipPlayed, style);
|
html += getUserDataButtonHtml('markPlayed', itemId, serverId, 'check', tooltipPlayed, style, classes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tooltipFavorite = globalize.translate('Favorite');
|
const tooltipFavorite = globalize.translate('Favorite');
|
||||||
if (userData.IsFavorite) {
|
if (userData.IsFavorite) {
|
||||||
html += getUserDataButtonHtml('markFavorite', itemId, serverId, btnCssClass + ' btnUserData btnUserDataOn', iconCssClass, 'favorite', tooltipFavorite, style);
|
const buttonCssClass = classes.buttonCssClass + ' btnUserData btnUserDataOn';
|
||||||
|
html += getUserDataButtonHtml('markFavorite', itemId, serverId, 'favorite', tooltipFavorite, style, {buttonCssClass: buttonCssClass, ...classes});
|
||||||
} else {
|
} else {
|
||||||
html += getUserDataButtonHtml('markFavorite', itemId, serverId, btnCssClass + ' btnUserData', iconCssClass, 'favorite', tooltipFavorite, style);
|
classes.buttonCssClass += ' btnUserData';
|
||||||
|
html += getUserDataButtonHtml('markFavorite', itemId, serverId, 'favorite', tooltipFavorite, style, classes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue