Still converting to bootstrap 5. Converted copyright + some artist stuff
This commit is contained in:
+18
-12
@@ -6,34 +6,40 @@
|
||||
<div class="mb-3">
|
||||
<h3>${name}</h3>
|
||||
${clusters class="mb-2"}
|
||||
${play-btn class="btn btn-outline-primary me-2"}${more-btn class="btn btn-outline-primary"}
|
||||
<div class="d-flex">
|
||||
${play-btn class="btn btn-outline-primary me-2"}
|
||||
<div class="dropdown d-inline-block">
|
||||
${more-btn class="btn btn-outline-primary" data-bs-toggle="dropdown" aria-expanded="false"}
|
||||
<ul class="dropdown-menu" aria-labelledby="${id:more-btn}">
|
||||
<li>${play-shuffled class="btn dropdown-item"}</li>
|
||||
<li>${play-last class="btn dropdown-item"}</li>
|
||||
<li>${star class="btn dropdown-item"}</li>
|
||||
${<if-has-mbid>}
|
||||
<li><a href="${mbid-link}" target="_blank" class="dropdown-item">${tr:Lms.Explore.musicbrainz-artist}</a></li>
|
||||
${</if-has-mbid>}
|
||||
<li>${download class="btn dropdown-item"}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
${<if-has-release>}
|
||||
${releases class="row gy-4"}
|
||||
${releases class="row gy-4 mb-5"}
|
||||
${</if-has-release>}
|
||||
${<if-has-non-release-track>}
|
||||
<div class="Lms-explore-artist-tracks-container">
|
||||
${tracks}
|
||||
</div>
|
||||
${</if-has-non-release-track>}
|
||||
${<if-has-similar-artists>}
|
||||
<div class="row">
|
||||
${<if-has-similar-artists>}
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<h3>${tr:Lms.Explore.Artist.similar-artists}</h3>
|
||||
${similar-artists}
|
||||
</div>
|
||||
</div>
|
||||
${</if-has-similar-artists>}
|
||||
${<if-has-mbid>}
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<h3>${tr:Lms.Explore.links}</h3>
|
||||
${mbid-link class="Lms-btn text-muted"}
|
||||
</div>
|
||||
</div>
|
||||
${</if-has-mbid>}
|
||||
</div>
|
||||
${</if-has-similar-artists>}
|
||||
</message>
|
||||
|
||||
</messages>
|
||||
|
||||
+7
-14
@@ -35,22 +35,15 @@
|
||||
</div>
|
||||
</div>
|
||||
${container class="d-grid gap-3"}
|
||||
${<if-has-copyright>}
|
||||
<div class="pt-1 mt-1 border-top border-dark small text-muted fw-lighter fst-italic">${copyright class="text-reset"}</div>
|
||||
${</if-has-copyright>}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
${<if-has-similar-releases>}
|
||||
<div class="col-12">
|
||||
<h3>${tr:Lms.Explore.Release.similar-releases}</h3>
|
||||
${similar-releases class="row gy-4"}
|
||||
</div>
|
||||
${</if-has-similar-releases>}
|
||||
${<if-has-copyright>}
|
||||
<div class="col-12 col-md-4">
|
||||
<h3>${tr:Lms.Explore.Release.copyright}</h3>
|
||||
${copyright class="text-muted"}
|
||||
</div>
|
||||
${</if-has-copyright>}
|
||||
</div>
|
||||
${<if-has-similar-releases>}
|
||||
<h3>${tr:Lms.Explore.Release.similar-releases}</h3>
|
||||
${similar-releases class="row gy-4"}
|
||||
${</if-has-similar-releases>}
|
||||
</message>
|
||||
|
||||
<message id="Lms.Explore.Release.template.entry-release-artist">
|
||||
|
||||
@@ -19,12 +19,7 @@
|
||||
|
||||
#include "ArtistView.hpp"
|
||||
|
||||
#include <Wt/WAnchor.h>
|
||||
#include <Wt/WImage.h>
|
||||
#include <Wt/WPopupMenu.h>
|
||||
#include <Wt/WPushButton.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "services/database/Artist.hpp"
|
||||
#include "services/database/Cluster.hpp"
|
||||
@@ -52,10 +47,11 @@ using namespace Database;
|
||||
namespace UserInterface {
|
||||
|
||||
Artist::Artist(Filters* filters)
|
||||
: Wt::WTemplate {Wt::WString::tr("Lms.Explore.Artist.template")}
|
||||
: Template {Wt::WString::tr("Lms.Explore.Artist.template")}
|
||||
, _filters {filters}
|
||||
{
|
||||
addFunction("tr", &Wt::WTemplate::Functions::tr);
|
||||
addFunction("id", &Wt::WTemplate::Functions::id);
|
||||
|
||||
LmsApp->internalPathChanged().connect(this, [this]
|
||||
{
|
||||
@@ -140,44 +136,43 @@ Artist::refreshView()
|
||||
}
|
||||
|
||||
bindString("name", Wt::WString::fromUTF8(artist->getName()), Wt::TextFormat::Plain);
|
||||
{
|
||||
Wt::WPushButton* playBtn {bindNew<Wt::WPushButton>("play-btn", Wt::WString::tr("Lms.Explore.template.play-btn"), Wt::TextFormat::XHTML)};
|
||||
playBtn->clicked().connect([=]
|
||||
|
||||
bindNew<Wt::WPushButton>("more-btn", Wt::WString::tr("Lms.Explore.template.more-btn"), Wt::TextFormat::XHTML);
|
||||
bindNew<Wt::WPushButton>("play-btn", Wt::WString::tr("Lms.Explore.template.play-btn"), Wt::TextFormat::XHTML)
|
||||
->clicked().connect([=]
|
||||
{
|
||||
artistsAction.emit(PlayQueueAction::Play, {_artistId});
|
||||
});
|
||||
}
|
||||
|
||||
bindNew<Wt::WPushButton>("play-shuffled", Wt::WString::tr("Lms.Explore.play-shuffled"), Wt::TextFormat::Plain)
|
||||
->clicked().connect([=]
|
||||
{
|
||||
artistsAction.emit(PlayQueueAction::PlayShuffled, {_artistId});
|
||||
});
|
||||
bindNew<Wt::WPushButton>("play-last", Wt::WString::tr("Lms.Explore.play-last"), Wt::TextFormat::Plain)
|
||||
->clicked().connect([=]
|
||||
{
|
||||
artistsAction.emit(PlayQueueAction::PlayLast, {_artistId});
|
||||
});
|
||||
bindNew<Wt::WPushButton>("download", Wt::WString::tr("Lms.Explore.download"))
|
||||
->setLink(Wt::WLink {std::make_unique<DownloadArtistResource>(*artistId)});
|
||||
|
||||
{
|
||||
Wt::WPushButton* moreBtn {bindNew<Wt::WPushButton>("more-btn", Wt::WString::tr("Lms.Explore.template.more-btn"), Wt::TextFormat::XHTML)};
|
||||
moreBtn->clicked().connect([=]
|
||||
auto isStarred {[=] { return Service<Scrobbling::IScrobblingService>::get()->isStarred(LmsApp->getUserId(), *artistId); }};
|
||||
|
||||
Wt::WPushButton* starBtn {bindNew<Wt::WPushButton>("star", Wt::WString::tr(isStarred() ? "Lms.Explore.unstar" : "Lms.Explore.star"))};
|
||||
starBtn->clicked().connect([=]
|
||||
{
|
||||
Wt::WPopupMenu* popup {LmsApp->createPopupMenu()};
|
||||
|
||||
popup->addItem(Wt::WString::tr("Lms.Explore.play-shuffled"))
|
||||
->triggered().connect(this, [=]
|
||||
{
|
||||
artistsAction.emit(PlayQueueAction::PlayShuffled, {_artistId});
|
||||
});
|
||||
popup->addItem(Wt::WString::tr("Lms.Explore.play-last"))
|
||||
->triggered().connect(this, [=]
|
||||
{
|
||||
artistsAction.emit(PlayQueueAction::PlayLast, {_artistId});
|
||||
});
|
||||
|
||||
const bool isStarred {Service<Scrobbling::IScrobblingService>::get()->isStarred(LmsApp->getUserId(), _artistId)};
|
||||
popup->addItem(Wt::WString::tr(isStarred ? "Lms.Explore.unstar" : "Lms.Explore.star"))
|
||||
->triggered().connect(this, [=]
|
||||
{
|
||||
if (isStarred)
|
||||
Service<Scrobbling::IScrobblingService>::get()->unstar(LmsApp->getUserId(), _artistId);
|
||||
else
|
||||
Service<Scrobbling::IScrobblingService>::get()->star(LmsApp->getUserId(), _artistId);
|
||||
});
|
||||
popup->addItem(Wt::WString::tr("Lms.Explore.download"))
|
||||
->setLink(Wt::WLink {std::make_unique<DownloadArtistResource>(*artistId)});
|
||||
|
||||
popup->exec(moreBtn);
|
||||
if (isStarred())
|
||||
{
|
||||
Service<Scrobbling::IScrobblingService>::get()->unstar(LmsApp->getUserId(), *artistId);
|
||||
starBtn->setText(Wt::WString::tr("Lms.Explore.star"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Service<Scrobbling::IScrobblingService>::get()->star(LmsApp->getUserId(), *artistId);
|
||||
starBtn->setText(Wt::WString::tr("Lms.Explore.unstar"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -240,11 +235,7 @@ Artist::refreshLinks(const Database::Artist::pointer& artist)
|
||||
if (mbid)
|
||||
{
|
||||
setCondition("if-has-mbid", true);
|
||||
|
||||
Wt::WLink link {"https://musicbrainz.org/artist/" + std::string {mbid->getAsString()}};
|
||||
link.setTarget(Wt::LinkTarget::NewWindow);
|
||||
|
||||
bindNew<Wt::WAnchor>("mbid-link", link, Wt::WString::tr("Lms.Explore.musicbrainz-artist"));
|
||||
bindString("mbid-link", std::string {"https://musicbrainz.org/artist/"} + std::string {mbid->getAsString()});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <Wt/WSignal.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "services/database/Object.hpp"
|
||||
#include "common/Template.hpp"
|
||||
|
||||
#include "PlayQueueAction.hpp"
|
||||
|
||||
namespace Database
|
||||
@@ -40,7 +36,7 @@ namespace UserInterface
|
||||
class Filters;
|
||||
class InfiniteScrollingContainer;
|
||||
|
||||
class Artist : public Wt::WTemplate
|
||||
class Artist : public Template
|
||||
{
|
||||
public:
|
||||
Artist(Filters* filters);
|
||||
|
||||
@@ -20,11 +20,8 @@
|
||||
#include "ReleaseView.hpp"
|
||||
|
||||
#include <Wt/WAnchor.h>
|
||||
#include <Wt/WApplication.h>
|
||||
#include <Wt/WImage.h>
|
||||
#include <Wt/WPushButton.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "services/database/Cluster.hpp"
|
||||
#include "services/database/Release.hpp"
|
||||
@@ -184,18 +181,18 @@ Release::refreshView()
|
||||
{
|
||||
auto isStarred {[=] { return Service<Scrobbling::IScrobblingService>::get()->isStarred(LmsApp->getUserId(), *releaseId); }};
|
||||
|
||||
Wt::WPushButton* star {bindNew<Wt::WPushButton>("star", Wt::WString::tr(isStarred() ? "Lms.Explore.unstar" : "Lms.Explore.star"))};
|
||||
star->clicked().connect([=]
|
||||
Wt::WPushButton* starBtn {bindNew<Wt::WPushButton>("star", Wt::WString::tr(isStarred() ? "Lms.Explore.unstar" : "Lms.Explore.star"))};
|
||||
starBtn->clicked().connect([=]
|
||||
{
|
||||
if (isStarred())
|
||||
{
|
||||
Service<Scrobbling::IScrobblingService>::get()->unstar(LmsApp->getUserId(), *releaseId);
|
||||
star->setText(Wt::WString::tr("Lms.Explore.star"));
|
||||
starBtn->setText(Wt::WString::tr("Lms.Explore.star"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Service<Scrobbling::IScrobblingService>::get()->star(LmsApp->getUserId(), *releaseId);
|
||||
star->setText(Wt::WString::tr("Lms.Explore.unstar"));
|
||||
starBtn->setText(Wt::WString::tr("Lms.Explore.unstar"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user