Skip to content

Commit

Permalink
Merge pull request #1220 from VocaDB/feat/1208-fix-song-tooltips
Browse files Browse the repository at this point in the history
Feat/1208 fix song tooltips
  • Loading branch information
ycanardeau authored Sep 15, 2022
2 parents 2e1e064 + 14b7d57 commit c8ecc03
Show file tree
Hide file tree
Showing 69 changed files with 1,736 additions and 1,132 deletions.
34 changes: 0 additions & 34 deletions Docs/API/VocaDBTooltips.js

This file was deleted.

1 change: 0 additions & 1 deletion Docs/API/VocaDBTooltips.js.map

This file was deleted.

45 changes: 0 additions & 45 deletions Docs/API/VocaDBTooltips.ts

This file was deleted.

18 changes: 0 additions & 18 deletions VocaDbWeb/Controllers/AlbumController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,6 @@ public ActionResult FindDuplicate(string term1, string term2, string term3)
return LowercaseJson(contracts);
}

public ActionResult PopupContent(int id = InvalidId)
{
if (id == InvalidId)
return NotFound();

var album = Service.GetAlbum(id);
return PartialView("AlbumPopupContent", album);
}

public ActionResult PopupWithCoverContent(int id = InvalidId)
{
if (id == InvalidId)
return NotFound();

var album = Service.GetAlbum(id);
return PartialView("AlbumWithCoverPopupContent", album);
}

//
// GET: /Album/Details/5

Expand Down
33 changes: 1 addition & 32 deletions VocaDbWeb/Controllers/Api/EntryApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,36 +101,5 @@ public PartialFindResult<EntryForApiContract> GetList(
/// <returns>List of entry names.</returns>
[HttpGet("names")]
public string[] GetNames(string query = "", NameMatchMode nameMatchMode = NameMatchMode.Auto, int maxResults = 10) => _otherService.FindNames(SearchTextQuery.Create(query, nameMatchMode), maxResults);

[ApiExplorerSettings(IgnoreApi = true)]
[HttpGet("tooltip")]
public async Task<ActionResult<string>> GetToolTip(string url)
{
if (string.IsNullOrWhiteSpace(url))
return BadRequest("URL must be specified");

var entryId = _entryUrlParser.Parse(url, allowRelative: true);

if (entryId.IsEmpty)
return BadRequest("Invalid URL");

var data = string.Empty;
var id = entryId.Id;

switch (entryId.EntryType)
{
case EntryType.Album:
data = await _viewRenderService.RenderToStringAsync("AlbumWithCoverPopupContent", _albumService.GetAlbum(id));
break;
case EntryType.Artist:
data = await _viewRenderService.RenderToStringAsync("ArtistPopupContent", _artistService.GetArtist(id));
break;
case EntryType.Song:
data = await _viewRenderService.RenderToStringAsync("SongPopupContent", _songQueries.GetSong(id));
break;
}

return data;
}
}
}
}
9 changes: 0 additions & 9 deletions VocaDbWeb/Controllers/ArtistController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,6 @@ public ActionResult PictureThumb(int id = InvalidId)
return Picture(artist);
}

public ActionResult PopupContent(int id = InvalidId)
{
if (id == InvalidId)
return NoId();

var artist = Service.GetArtist(id);
return PartialView("ArtistPopupContent", artist);
}

[Authorize]
public ActionResult Create()
{
Expand Down
12 changes: 0 additions & 12 deletions VocaDbWeb/Controllers/EventController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,6 @@ public ActionResult ManageTagUsages(int id)
return View(releaseEvent);
}

[ResponseCache(Location = ResponseCacheLocation.Any, Duration = 3600, VaryByQueryKeys = new[] { "*" })]
public ActionResult PopupContent(
int id = InvalidId,
string culture = InterfaceLanguage.DefaultCultureCode)
{
if (id == InvalidId)
return NotFound();

var releaseEvent = _queries.Load(id, ReleaseEventOptionalFields.AdditionalNames | ReleaseEventOptionalFields.MainPicture | ReleaseEventOptionalFields.Series);
return PartialView("_EventPopupContent", releaseEvent);
}

[Authorize]
public ActionResult RemoveTagUsage(long id)
{
Expand Down
38 changes: 0 additions & 38 deletions VocaDbWeb/Controllers/ExtController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,44 +104,6 @@ public ActionResult EmbedSong(int songId = InvalidId, int pvId = InvalidId, int?
return PartialView(viewModel);
}

public async Task<ActionResult> EntryToolTip(string url, string callback)
{
if (string.IsNullOrWhiteSpace(url))
return HttpStatusCodeResult(HttpStatusCode.BadRequest, "URL must be specified");

var entryId = _entryUrlParser.Parse(url, allowRelative: true);

if (entryId.IsEmpty)
{
return HttpStatusCodeResult(HttpStatusCode.BadRequest, "Invalid URL");
}

var data = string.Empty;
var id = entryId.Id;

switch (entryId.EntryType)
{
case EntryType.Album:
data = await RenderPartialViewToStringAsync("AlbumWithCoverPopupContent", _albumService.GetAlbum(id));
break;
case EntryType.Artist:
data = await RenderPartialViewToStringAsync("ArtistPopupContent", _artistService.GetArtist(id));
break;
case EntryType.ReleaseEvent:
data = await RenderPartialViewToStringAsync("_EventPopupContent", _eventQueries.GetOne(id, ContentLanguagePreference.Default, ReleaseEventOptionalFields.AdditionalNames | ReleaseEventOptionalFields.MainPicture | ReleaseEventOptionalFields.Series));
break;
case EntryType.Song:
data = await RenderPartialViewToStringAsync("SongPopupContent", _songService.GetSong(id));
break;
case EntryType.Tag:
data = await RenderPartialViewToStringAsync("_TagPopupContent", _tagQueries.LoadTag(id, t =>
new TagForApiContract(t, _entryThumbPersister, ContentLanguagePreference.Default, TagOptionalFields.AdditionalNames | TagOptionalFields.MainPicture)));
break;
}

return Json(data, callback);
}

public async Task<ActionResult> OEmbed(string url, int maxwidth = 570, int maxheight = 400, DataFormat format = DataFormat.Json, bool responsiveWrapper = false)
{
if (string.IsNullOrEmpty(url))
Expand Down
28 changes: 0 additions & 28 deletions VocaDbWeb/Controllers/SongController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,34 +220,6 @@ public ActionResult PostMedia(IFormFile file)
return LowercaseJson(pv);
}

[ResponseCache(Location = ResponseCacheLocation.Client, Duration = 3600)]
public ActionResult PopupContent(int id = InvalidId)
{
if (id == InvalidId)
return NotFound();

var song = _queries.GetSong(id);
return PartialView("SongPopupContent", song);
}

[ResponseCache(Location = ResponseCacheLocation.Client, Duration = 3600)]
public async Task<ActionResult> PopupContentWithVote(int id = InvalidId, int? version = null, string callback = null)
{
if (id == InvalidId)
return NotFound();

var song = _queries.GetSongWithPVAndVote(id, false, includePVs: false);

if (string.IsNullOrEmpty(callback))
{
return PartialView("_SongWithVotePopupContent", song);
}
else
{
return Json(await RenderPartialViewToStringAsync("_SongWithVotePopupContent", song), callback);
}
}

public async Task<FeedResult> Feed(IndexRouteParams indexParams)
{
WebHelper.VerifyUserAgent(Request);
Expand Down
14 changes: 0 additions & 14 deletions VocaDbWeb/Controllers/TagController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,6 @@ public ActionResult Merge(int id, int? targetTagId)
return RedirectToAction("Edit", new { id = targetTagId.Value });
}

[ResponseCache(Location = ResponseCacheLocation.Any, Duration = 3600, VaryByQueryKeys = new[] { "*" })]
public ActionResult PopupContent(
int id = InvalidId,
ContentLanguagePreference lang = ContentLanguagePreference.Default,
string culture = InterfaceLanguage.DefaultCultureCode)
{
if (id == InvalidId)
return NotFound();

var tag = _queries.LoadTag(id, t => new TagForApiContract(t, _entryThumbPersister,
lang, TagOptionalFields.AdditionalNames | TagOptionalFields.Description | TagOptionalFields.MainPicture));
return PartialView("_TagPopupContent", tag);
}

public ActionResult UpdateVersionVisibility(int archivedVersionId, bool hidden)
{
_queries.UpdateVersionVisibility<ArchivedTagVersion>(archivedVersionId, hidden);
Expand Down
7 changes: 0 additions & 7 deletions VocaDbWeb/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,6 @@ public PartialViewResult OwnedArtistForUserEditRow(int artistId)
return PartialView(ownedArtist);
}

[ResponseCache(Location = ResponseCacheLocation.Any, Duration = 3600, VaryByQueryKeys = new[] { "*" })]
public PartialViewResult PopupContent(int id, string culture = InterfaceLanguage.DefaultCultureCode)
{
var user = Service.GetUser(id);
return PartialView("_UserPopupContent", user);
}

#nullable enable
public ActionResult Profile(string id, int? artistId = null, bool? childVoicebanks = null)
{
Expand Down
Loading

0 comments on commit c8ecc03

Please sign in to comment.