Now handling multi artists in tracks, playqueue and play history views

This commit is contained in:
emeric
2019-03-19 13:38:44 +01:00
parent 3150de4f0c
commit 37e87ccc1c
8 changed files with 94 additions and 45 deletions
+14 -4
View File
@@ -40,16 +40,26 @@ std::unique_ptr<Wt::WTemplate> createEntry(Database::Track::pointer track)
entry->bindString("name", Wt::WString::fromUTF8(track->getName()), Wt::TextFormat::Plain);
auto artists {track->getArtists()};
auto release = track->getRelease();
if (!artists.empty() || release)
entry->setCondition("if-has-artists-or-release", true);
if (!artists.empty())
{
entry->setCondition("if-has-artist", true);
entry->bindWidget("artist-name", LmsApplication::createArtistAnchor(artists.front()));
entry->setCondition("if-has-artists", true);
Wt::WContainerWidget* artistContainer {entry->bindNew<Wt::WContainerWidget>("artists")};
for (const auto& artist : artists)
{
Wt::WTemplate* a {artistContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.PlayHistory.template.entry-artist"))};
a->bindWidget("artist", LmsApplication::createArtistAnchor(artist));
}
}
auto release = track->getRelease();
if (release)
{
entry->setCondition("if-has-release", true);
entry->bindWidget("release-name", LmsApplication::createReleaseAnchor(track->getRelease()));
entry->bindWidget("release", LmsApplication::createReleaseAnchor(track->getRelease()));
}
return entry;
+14 -4
View File
@@ -331,16 +331,26 @@ PlayQueue::addSome()
entry->bindString("name", Wt::WString::fromUTF8(track->getName()), Wt::TextFormat::Plain);
auto artists {track->getArtists()};
auto release = track->getRelease();
if (!artists.empty() || release)
entry->setCondition("if-has-artists-or-release", true);
if (!artists.empty())
{
entry->setCondition("if-has-artist", true);
entry->bindWidget("artist-name", LmsApplication::createArtistAnchor(artists.front()));
entry->setCondition("if-has-artists", true);
Wt::WContainerWidget* artistContainer {entry->bindNew<Wt::WContainerWidget>("artists")};
for (const auto& artist : artists)
{
Wt::WTemplate* a {artistContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.PlayQueue.template.entry-artist"))};
a->bindWidget("artist", LmsApplication::createArtistAnchor(artist));
}
}
auto release = track->getRelease();
if (release)
{
entry->setCondition("if-has-release", true);
entry->bindWidget("release-name", LmsApplication::createReleaseAnchor(track->getRelease()));
entry->bindWidget("release", LmsApplication::createReleaseAnchor(track->getRelease()));
}
Wt::WText* playBtn = entry->bindNew<Wt::WText>("play-btn", Wt::WString::tr("Lms.PlayQueue.template.play-btn"), Wt::TextFormat::XHTML);
+14 -3
View File
@@ -117,16 +117,27 @@ Tracks::addSome()
entry->bindString("name", Wt::WString::fromUTF8(track->getName()), Wt::TextFormat::Plain);
auto artists {track->getArtists()};
auto release {track->getRelease()};
if (!artists.empty() || release)
entry->setCondition("if-has-artists-or-release", true);
if (!artists.empty())
{
entry->setCondition("if-has-artist", true);
entry->bindWidget("artist-name", LmsApplication::createArtistAnchor(artists.front()));
entry->setCondition("if-has-artists", true);
Wt::WContainerWidget* artistContainer {entry->bindNew<Wt::WContainerWidget>("artists")};
for (const auto& artist : artists)
{
Wt::WTemplate* a {artistContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.Explore.Tracks.template.entry-artist"))};
a->bindWidget("artist", LmsApplication::createArtistAnchor(artist));
}
}
if (track->getRelease())
{
entry->setCondition("if-has-release", true);
entry->bindWidget("release-name", LmsApplication::createReleaseAnchor(track->getRelease()));
entry->bindWidget("release", LmsApplication::createReleaseAnchor(track->getRelease()));
}
Wt::WText* playBtn = entry->bindNew<Wt::WText>("play-btn", Wt::WString::tr("Lms.Explore.template.play-btn"), Wt::TextFormat::XHTML);