Remove torrent/data confirmation modal

This commit is contained in:
Mathias Rasmussen
2016-06-01 16:20:01 +02:00
committed by DC
parent b950829de3
commit 54e70e7158
6 changed files with 41 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ var Views = {
var Modals = {
'open-torrent-address-modal': require('./open-torrent-address-modal'),
'remove-torrent-modal': require('./remove-torrent-modal'),
'update-available-modal': require('./update-available-modal'),
'unsupported-media-modal': require('./unsupported-media-modal')
}

View File

@@ -0,0 +1,26 @@
module.exports = RemoveTorrentModal
var {dispatch, dispatcher} = require('../lib/dispatcher')
var hx = require('../lib/hx')
function RemoveTorrentModal (state) {
var message = state.modal.deleteData
? 'Are you sure you want to remove this torrent from the list and delete the data file?'
: 'Are you sure you want to remove this torrent from the list?'
var buttonText = state.modal.deleteData ? 'Remove Data' : 'Remove'
return hx`
<div>
<p><strong>${message}</strong></p>
<p class='float-right'>
<button class='button button-flat' onclick=${dispatcher('exitModal')}>Cancel</button>
<button class='button button-raised' onclick=${handleRemove}>${buttonText}</button>
</p>
</div>
`
function handleRemove () {
dispatch('deleteTorrent', state.modal.infoHash, state.modal.deleteData)
dispatch('exitModal')
}
}

View File

@@ -172,7 +172,7 @@ function TorrentList (state) {
<i
class='icon delete'
title='Remove torrent'
onclick=${dispatcher('deleteTorrent', infoHash)}>
onclick=${dispatcher('confirmDeleteTorrent', infoHash, false)}>
close
</i>
</div>