Displaying all release artists instead of just 'Various Artists' in the release view, ref #154

This commit is contained in:
emeric
2021-05-10 14:57:31 +02:00
parent 6e86fe2f62
commit a110b6737d
2 changed files with 16 additions and 12 deletions
+6 -2
View File
@@ -14,7 +14,7 @@
<div class="col-md-8">
<div class="Lms-header">
<h3><div class="Lms-releasename text-primary">${name}</div></h3>
${<if-has-artist>}<h4>${artist class="Lms-btn Lms-artistname text-muted"}</h4>${</if-has-artist>}
${<if-has-release-artists>}${artists}${</if-has-release-artists>}
<div class="text-muted"><small>${<if-has-year>}${year}${</if-has-year>}${<if-has-orig-year>} (${orig-year})${</if-has-orig-year>}</small></div>
${clusters}
${play-btn class="Lms-explore-btn Lms-btn"}${more-btn class="Lms-explore-btn Lms-btn"}
@@ -52,7 +52,11 @@
</div>
</message>
<message id="Lms.Explore.Release.template.disc-entry">
<message id="Lms.Explore.Release.template.entry-release-artist">
<h4>${artist class="Lms-btn Lms-artistname text-muted"}</h4>
</message>
<message id="Lms.Explore.Release.template.entry-disc">
<h4>${disc-title}</h4>
${tracks}
</message>
+10 -10
View File
@@ -114,15 +114,16 @@ Release::refreshView()
if (artists.empty())
artists = release->getArtists();
if (artists.size() > 1)
if (!artists.empty())
{
setCondition("if-has-artist", true);
bindNew<Wt::WText>("artist", Wt::WString::tr("Lms.Explore.various-artists"));
}
else if (artists.size() == 1)
{
setCondition("if-has-artist", true);
bindWidget("artist", LmsApplication::createArtistAnchor(artists.front()));
setCondition("if-has-release-artists", true);
Wt::WContainerWidget* artistsContainer {bindNew<Wt::WContainerWidget>("artists")};
for (const auto& artist : artists)
{
Wt::WTemplate* artistTemplate {artistsContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.Explore.Release.template.entry-release-artist"))};
artistTemplate->bindWidget("artist", LmsApplication::createArtistAnchor(artist));
}
}
}
@@ -183,8 +184,7 @@ Release::refreshView()
return it->second;
}
Wt::WTemplate* disc {rootContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.Explore.Release.template.disc-entry"))};
disc->addFunction("tr", &Wt::WTemplate::Functions::tr);
Wt::WTemplate* disc {rootContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.Explore.Release.template.entry-disc"))};
if (discSubtitle.empty())
disc->bindNew<Wt::WText>("disc-title", Wt::WString::tr("Lms.Explore.Release.disc").arg(discNumber));