From 6c601a35b1d79bfe5b53c3c6177420c9d90fbba9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 15 Dec 2017 11:00:06 +0100 Subject: list files in settings --- bucky/app/bucky.js | 4 +-- public/assets/css/bucky.css | 35 +++++++++++++++----------- public/assets/js/lib/views/details/settings.js | 23 +++++++++++++++++ views/partials/files.ejs | 2 +- views/partials/settings.ejs | 30 ++++++++++++++++++++++ 5 files changed, 77 insertions(+), 17 deletions(-) diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index 0c8d99a..295a813 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -84,7 +84,7 @@ var bucky = module.exports = { createdate: util.now(), lastmodified: util.now(), size: 0, - private: false, + privacy: false, color: req.body.color, viewed: 0, revision: 0, @@ -402,7 +402,7 @@ var bucky = module.exports = { filename: file.originalname, date: util.now(), size: file.size, - private: false, + privacy: false, storage: 'i.asdf.us', } db.createFile(data).then(function(file){ diff --git a/public/assets/css/bucky.css b/public/assets/css/bucky.css index 66058ba..9ee633f 100644 --- a/public/assets/css/bucky.css +++ b/public/assets/css/bucky.css @@ -565,47 +565,48 @@ pre br { /* FILES */ -#files, -#files tr { +.files, +.files tr { margin: 0; padding: 0; border-spacing: 0; } -#files { +.files { border: 1px solid #ccc; margin-bottom: 10px; } -#files td { +.files td { padding: 5px; font-size: 11px; } -#files td:first-child { +.files td:first-child { padding: 0; } -#files td:first-child a { +.files td:first-child a { display: block; padding: 5px; + text-overflow: ellipsis; } -#files .user a { +.files .user a { text-decoration: none; color: #333; } -.desktop #files user a:hover { +.desktop .files user a:hover { text-decoration: underline; } -#files td:first-child { +.files td:first-child { text-align: left; } -#files td { +.files td { text-align: right; } -#files .total td { +.files .total td { text-align: right; border-top: 1px dotted #888; } -#files .playing:before { +.files .playing:before { content: "> "; } -#files tr.total td:first-child { +.files tr.total td:first-child { padding: 5px; } .bold { @@ -619,7 +620,7 @@ pre br { flex-direction: row; justify-content: space-between; } -#files .total td a { +.files .total td a { display: inline; } #gallery { @@ -725,6 +726,12 @@ pre br { width: auto; display: inline-block; } +#thread_settings #right_side { + margin-left: 10px; +} +#thread_settings .files td:first-child a { + width: 130px; +} /* SEARCH */ diff --git a/public/assets/js/lib/views/details/settings.js b/public/assets/js/lib/views/details/settings.js index 06bb315..eac1520 100644 --- a/public/assets/js/lib/views/details/settings.js +++ b/public/assets/js/lib/views/details/settings.js @@ -21,6 +21,7 @@ var ThreadSettingsForm = FormView.extend({ this.__super__.initialize.call(this) this.template = this.$(".template").html() this.allowedTemplate = this.$(".allowedTemplate").html() + this.filesTemplate = this.$(".settingsFilesTemplate").html() }, populate: function(){ @@ -57,6 +58,28 @@ var ThreadSettingsForm = FormView.extend({ this.toggleAllowed() this.fetchKeywords() + + var $files = this.$(".files") + $files.empty() + files.sort((a,b) => cmp(a.filename, b.filename)) + .forEach(file => { + var size = hush_size(file.size) + var datetime = verbose_date(file.date, true) + var date_class = carbon_date(file.date) + var link = make_link(file) + + var t = this.filesTemplate.replace(/{{username}}/g, file.username) + .replace(/{{link}}/g, link) + .replace(/{{filename}}/g, file.filename) + .replace(/{{date_class}}/g, date_class) + .replace(/{{date}}/g, datetime[0]) + .replace(/{{time}}/g, datetime[1]) + .replace(/{{size_class}}/g, size[0]) + .replace(/{{size}}/g, size[1]) + .replace(/{{id}}/g, file.id) + var $t = $(t) + $files.append($t) + }) $("body").removeClass("loading") }, diff --git a/views/partials/files.ejs b/views/partials/files.ejs index 456fe17..72c39af 100644 --- a/views/partials/files.ejs +++ b/views/partials/files.ejs @@ -1,4 +1,4 @@ - +
+
+ + + -- cgit v1.2.3-70-g09d2