[UI] Refactored some code and integrated CSS changes made by G.Debros

This commit is contained in:
emeric
2015-11-21 22:11:16 +01:00
parent 3826377f01
commit fc88cce33e
20 changed files with 369 additions and 176 deletions
+11 -12
View File
@@ -44,6 +44,11 @@ Release::getByMBID(Wt::Dbo::Session& session, const std::string& mbid)
return session.find<Release>().where("mbid = ?").bind(mbid);
}
Release::pointer
Release::getById(Wt::Dbo::Session& session, Release::id_type id)
{
return session.find<Release>().where("id = ?").bind(id);
}
Release::pointer
Release::create(Wt::Dbo::Session& session, const std::string& name, const std::string& MBID)
@@ -51,6 +56,12 @@ Release::create(Wt::Dbo::Session& session, const std::string& name, const std::s
return session.add(new Release(name, MBID));
}
bool
Release::isNone() const
{
return _name == "<None>";
}
Release::pointer
Release::getNone(Wt::Dbo::Session& session)
{
@@ -129,16 +140,4 @@ Release::getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset,
return std::vector<pointer>(res.begin(), res.end());
}
std::vector< Wt::Dbo::ptr<Artist> >
Release::getArtists() const
{
assert(self());
assert(self()->id() != Wt::Dbo::dbo_traits<Release>::invalidId() );
assert(session());
Wt::Dbo::collection< Wt::Dbo::ptr<Artist> > res = session()->query<Wt::Dbo::ptr<Artist> >("SELECT a FROM artist a INNER JOIN release r ON r.id = t.release_id INNER JOIN track t ON t.release_id = r.id").where("r.id = ?").bind(id());
return std::vector< Wt::Dbo::ptr<Artist> > (res.begin(), res.end());
}
} // namespace Database
-2
View File
@@ -65,8 +65,6 @@ class Release : public Wt::Dbo::Dbo<Release>
std::string getMBID() const { return _MBID; }
bool isNone(void) const;
boost::posix_time::time_duration getDuration(void) const;
std::vector<Wt::Dbo::ptr<Artist> > getArtists() const; // Get the artists of this release
std::vector<Wt::Dbo::ptr<Track> > getTracks() const; // Get the tracks of this release
void setMBID(std::string mbid) { _MBID = mbid; }
+7 -1
View File
@@ -58,12 +58,18 @@ class SearchFilter
return SearchFilter(_nameLikeMatch);
}
// Single ID match
// Single Field ID match
static SearchFilter ById(Field field, Wt::Dbo::dbo_default_traits::IdType id)
{
return SearchFilter({{field, {id} }});
}
// Single Field Name match
static SearchFilter ByName(Field field, std::vector<std::string> keywords)
{
return NameLikeMatch({{{field, keywords}}});
}
// The filter is a AND of the following conditions:
// ((Field1.name LIKE STR1-1 OR Field1.name LIKE STR1-2 ...) OR (Field2.name LIKE STR2-1 OR Field2.name LIKE STR2-2 ...) ...