Bigfiles.coffee 911 B

1234567891011121314151617181920212223242526272829303132333435
  1. class Bigfiles extends Class
  2. constructor: ->
  3. @files = new SiteFiles(@)
  4. @files.mode = "bigfiles"
  5. @files.limit = 100
  6. @files.update = @updateFiles
  7. @row = {"address": "bigfiles"}
  8. updateFiles: (cb) =>
  9. if Page.server_info.rev < 3090
  10. return cb?()
  11. orderby = @files.orderby + (if @files.orderby_desc then " DESC" else "")
  12. Page.cmd "optionalFileList", {address: "all", filter: "downloaded,bigfile", limit: @files.limit+1, orderby: orderby}, (res) =>
  13. for row in res
  14. row.site = Page.site_list.sites_byaddress[row.address]
  15. @files.items = res[0..@files.limit-1]
  16. @files.loaded = true
  17. @files.has_more = res.length > @files.limit
  18. Page.projector.scheduleRender()
  19. cb?()
  20. getHref: (row) =>
  21. return row.inner_path
  22. render: =>
  23. if not @files.items.length
  24. return []
  25. h("div.site", [
  26. h("div.title", [h("h3.name", "Bigfiles")])
  27. @files.render()
  28. ])
  29. window.Bigfiles = Bigfiles