Skip to content

Commit

Permalink
feat: add possibility to mark the track media as available
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Vieilledent committed Jul 13, 2018
1 parent 64fe29b commit e730d2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/components/track-edit/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import TrackFormComponent from 'radio4000/components/track-form/component'

const {
get,
set,
computed} = Ember

export default TrackFormComponent.extend({
Expand Down Expand Up @@ -31,5 +32,11 @@ export default TrackFormComponent.extend({
yield get(this, 'track.delete').perform()
get(this, 'flashMessages').success('Track deleted')
yield get(this, 'onDelete')()
}).drop(),

setMediaAvailable: task(function * (event) {
event.preventDefault()
set(this, 'track.mediaNotAvailable', false)
get(this, 'submitTask').perform(event)
}).drop()
})
10 changes: 9 additions & 1 deletion app/components/track-edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
{{/form-group}}

{{#if track.mediaNotAvailable}}
<p>This link seems to be broken, <a href={{youtubeSearchUrl}} target="_blank" rel="noopener">find a new one</a>!</p>
<p>
<a href={{track.url}} target="_blank" rel="noopener">This link</a> seems to be broken, <a href={{youtubeSearchUrl}} target="_blank" rel="noopener">find a new one</a>!
<button
class="Btn Btn--small"
title="Signal that this link is not really broken, maybe just unavailable temporarily (ex: in the country you are currently)."
onclick={{perform setMediaAvailable}}>
No problem
</button>
</p>
{{/if}}

{{#form-group
Expand Down

0 comments on commit e730d2a

Please sign in to comment.