internet4000 / explorer-discogs

A work in progress to explore and play Discogs
https://explorer.radio4000.com
2 stars 0 forks source link

Add formatting to profile fields for artists #47

Closed oskarrough closed 6 years ago

oskarrough commented 6 years ago

I configured the API to return HTML for "profile" field.

I did it with a computed property on the model that returns whichever profile field is available, prefering HTML or plaintext to the bbcode.

Other models also need it but I did not feel like creating a shared model or component yet. Thoughts?

Example https://deploy-preview-47--explorer-discogs.netlify.com/artists/15885/info

4www commented 6 years ago

Now that I am thinking about it, the best would be to parse the bb code and return the appropriate explorer route.

Right now it opens a lot of links to discogs.

oskarrough commented 6 years ago

True, I did not consider that. I'd say the easiest would be to write a helper that parses the HTML and replaces discogs.com/xxx with our paths?

4www commented 6 years ago

Updated this js regex so it has two capture group, model type and model id: https://regexr.com/3pkgo Not sure how to remove the tailing slash at the end of the first capture group.