Skip to content

Commit

Permalink
Move all optional file download to separate button on sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Feb 7, 2020
1 parent 6d425f3 commit c91f2f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/Sidebar/SidebarPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def sidebarRenderOptionalFileSettings(self, body, site):

body.append(_("""
<li>
<label>{_[Download and help distribute all files]}</label>
<label>{_[Help distribute added optional files]}</label>
<input type="checkbox" class="checkbox" id="checkbox-autodownloadoptional" {checked}/><div class="checkbox-skin"></div>
"""))

Expand All @@ -326,6 +326,7 @@ def sidebarRenderOptionalFileSettings(self, body, site):
<label>{_[Auto download big file size limit]}</label>
<input type='text' class='text text-num' value="{autodownload_bigfile_size_limit}" id='input-autodownload_bigfile_size_limit'/><span class='text-post'>MB</span>
<a href='#Set' class='button' id='button-autodownload_bigfile_size_limit'>{_[Set]}</a>
<a href='#Download+previous' class='button' id='button-autodownload_previous'>{_[Download previous files]}</a>
</div>
"""))
body.append("</li>")
Expand Down Expand Up @@ -754,8 +755,6 @@ def actionUserSetSitePrivatekey(self, to, privatekey):
@flag.no_multiuser
def actionSiteSetAutodownloadoptional(self, to, owned):
self.site.settings["autodownloadoptional"] = bool(owned)
self.site.bad_files = {}
gevent.spawn(self.site.update, check_files=True)
self.site.worker_manager.removeSolvedFileTasks()

@flag.no_multiuser
Expand Down
8 changes: 8 additions & 0 deletions plugins/Sidebar/media/Sidebar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ class Sidebar extends Class
@updateHtmlTag()
return false

# Site start download optional files
@tag.find("#button-autodownload_previous").off("click touchend").on "click touchend", =>
@wrapper.ws.cmd "siteUpdate", {"address": @wrapper.site_info.address, "check_files": true}, =>
@wrapper.notifications.add "done-download_optional", "done", "Optional files downloaded", 5000

@wrapper.notifications.add "start-download_optional", "info", "Optional files download started", 5000
return false

# Database reload
@tag.find("#button-dbreload").off("click touchend").on "click touchend", =>
@wrapper.ws.cmd "dbReload", [], =>
Expand Down

0 comments on commit c91f2f0

Please sign in to comment.