diff --git a/TODO b/TODO index 325c5b57..778a5e8f 100644 --- a/TODO +++ b/TODO @@ -4,14 +4,9 @@ first major release. everything related to posts: - single post view - basic information - - safety - - source - - image dimensions - time of last edit - time of last feature - how many times the post was featured - - download - - permalink - delete - feature - fav diff --git a/public_html/css/post.css b/public_html/css/post.css index 50fefdfb..2a264001 100644 --- a/public_html/css/post.css +++ b/public_html/css/post.css @@ -55,11 +55,18 @@ } -#post-view-wrapper #sidebar ul { +#sidebar ul { list-style-type: none; margin: 0; padding: 0; } +#sidebar .tags li, +#sidebar .other-info li { + display: block; + word-break: break-all; + padding-left: 1em; + text-indent: -1em; +} #sidebar .tags .tag-wrapper { max-width: 100%; @@ -68,9 +75,6 @@ } #sidebar .tags li a { display: block; - padding-left: 1em; - word-break: break-all; - text-indent: -1em; } #sidebar .tags li .usages { color: silver; @@ -84,3 +88,27 @@ #sidebar .author-box .author-name { font-weight: bold; } + +#sidebar .other-info { + margin-top: 1em; + line-height: 150%; +} + +#sidebar .essential { + display: flex; + justify-content: space-around; + margin-bottom: 2em; +} +#sidebar .essential li { + display: block; + margin: 0 0.25em; + vertical-align: top; +} +#sidebar .essential li i.fa { + font-size: 30px; +} +#sidebar .essential li a { + display: block; + text-align: center; + font-size: 12px; +} diff --git a/public_html/js/Presenters/PostPresenter.js b/public_html/js/Presenters/PostPresenter.js index 1bef93f8..3818907e 100644 --- a/public_html/js/Presenters/PostPresenter.js +++ b/public_html/js/Presenters/PostPresenter.js @@ -48,6 +48,7 @@ App.Presenters.PostPresenter = function( $el.html(postTemplate({ post: post, formatRelativeTime: util.formatRelativeTime, + formatFileSize: util.formatFileSize, postContentTemplate: postContentTemplate, })); } diff --git a/public_html/js/Util.js b/public_html/js/Util.js index b958cdf2..17753528 100644 --- a/public_html/js/Util.js +++ b/public_html/js/Util.js @@ -152,11 +152,44 @@ App.Util = function(_, jQuery, promise) { return future ? 'in ' + text : text + ' ago'; } + function formatUnits(number, base, suffixes, callback) { + if (!number) { + return NaN; + } + number *= 1.0; + + var suffix = suffixes.shift(); + while (number >= base && suffixes.length > 0) { + suffix = suffixes.shift(); + number /= base; + } + + if (typeof(callback) === 'undefined') { + callback = function(number, suffix) { + return suffix ? number.toFixed(1) + suffix : number; + }; + } + + return callback(number, suffix); + } + + function formatFileSize(fileSize) { + return formatUnits( + fileSize, + 1024, + ['B', 'K', 'M', 'G'], + function(number, suffix) { + var decimalPlaces = number < 20 && suffix !== 'B' ? 1 : 0; + return number.toFixed(decimalPlaces) + suffix; + }); + } + return { promiseTemplate: promiseTemplate, parseComplexRouteArgs: parseComplexRouteArgs, compileComplexRouteArgs: compileComplexRouteArgs, formatRelativeTime: formatRelativeTime, + formatFileSize: formatFileSize, enableExitConfirmation: enableExitConfirmation, disableExitConfirmation: disableExitConfirmation, isExitConfirmationEnabled: isExitConfirmationEnabled, diff --git a/public_html/templates/post.tpl b/public_html/templates/post.tpl index 3aeb65f8..340da497 100644 --- a/public_html/templates/post.tpl +++ b/public_html/templates/post.tpl @@ -1,5 +1,15 @@