diff --git a/renderer/controllers/torrent-list-controller.js b/renderer/controllers/torrent-list-controller.js index 29727052..2b4a7b36 100644 --- a/renderer/controllers/torrent-list-controller.js +++ b/renderer/controllers/torrent-list-controller.js @@ -55,6 +55,13 @@ module.exports = class TorrentListController { findFilesRecursive(files, (allFiles) => this.showCreateTorrent(allFiles)) } + // Switches between the advanced and simple Create Torrent UI + toggleCreateTorrentAdvanced () { + var info = this.state.location.current() + if (info.url !== 'create-torrent') return + info.showAdvanced = !info.showAdvanced + } + // Creates a new torrent and start seeeding createTorrent (options) { var state = this.state diff --git a/renderer/main.js b/renderer/main.js index 3e3356ca..b94c9875 100644 --- a/renderer/main.js +++ b/renderer/main.js @@ -174,6 +174,7 @@ const dispatchHandlers = { 'addTorrent': (torrentId) => controllers.torrentList.addTorrent(torrentId), 'showCreateTorrent': (paths) => controllers.torrentList.showCreateTorrent(paths), + 'toggleCreateTorrentAdvanced': () => controllers.torrentList.toggleCreateTorrentAdvanced(), 'createTorrent': (options) => controllers.torrentList.createTorrent(options), 'toggleTorrent': (infoHash) => controllers.torrentList.toggleTorrent(infoHash), 'toggleTorrentFile': (infoHash, index) => controllers.torrentList.toggleTorrentFile(infoHash, index), diff --git a/renderer/views/create-torrent.js b/renderer/views/create-torrent.js index 28c8f5fd..42585431 100644 --- a/renderer/views/create-torrent.js +++ b/renderer/views/create-torrent.js @@ -65,7 +65,8 @@ function CreateTorrentPage (state) {
${pathPrefix}

-
+
${info.showAdvanced ? 'Basic' : 'Advanced'}
@@ -87,7 +88,7 @@ function CreateTorrentPage (state) {

- +

@@ -114,17 +115,6 @@ function CreateTorrentPage (state) { } dispatch('createTorrent', options) } - - function handleCancel () { - dispatch('back') - } - - function handleToggleShowAdvanced () { - // TODO: what's the clean way to handle this? - // Should every button on every screen have its own dispatch()? - info.showAdvanced = !info.showAdvanced - dispatch('update') - } } function CreateTorrentErrorPage () {