🚸 Improved file entries from printer's SD
- Metadata dropdown button replaced with SD card icon to make clear this is a file from the SD - Unknown date now gets rendered more clearly
This commit is contained in:
1 parent
4af7bbea5f
commit
b155292410
3 files changed
+10
-7
No files matched your search
@@ -619,7 +619,8 @@ function formatDate(unixTimestamp, options) {
|
||||
options = {seconds: false};
|
||||
}
|
||||
|
||||
if (!unixTimestamp) return "-";
|
||||
var placeholder = options.placeholder || "-";
|
||||
if (!unixTimestamp) return placeholder;
|
||||
|
||||
var format = gettext(/* L10N: Date format */ "YYYY-MM-DD HH:mm");
|
||||
if (options.seconds) {
|
||||
@@ -629,8 +630,9 @@ function formatDate(unixTimestamp, options) {
|
||||
return moment.unix(unixTimestamp).format(format);
|
||||
}
|
||||
|
||||
function formatTimeAgo(unixTimestamp) {
|
||||
if (!unixTimestamp) return "-";
|
||||
function formatTimeAgo(unixTimestamp, placeholder) {
|
||||
placeholder = placeholder || "-";
|
||||
if (!unixTimestamp) return placeholder;
|
||||
return moment.unix(unixTimestamp).fromNow();
|
||||
}
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ $(function () {
|
||||
self.dateString = ko.pureComputed(function () {
|
||||
var date = self.filedate();
|
||||
if (!date) {
|
||||
return "";
|
||||
return gettext("unknown");
|
||||
}
|
||||
|
||||
return formatDate(date, {seconds: true});
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="files_template_machinecode">
|
||||
<div class="btn btn-mini toggleAdditionalData pull-right" data-bind="click: function() { if ($root.enableAdditionalData($data)) { $root.toggleAdditionalData($data); } else { return; } }, css: { disabled: !$root.enableAdditionalData($data) }" title="{{ _('Additional data')|edq }}"><i class="fas fa-chevron-down"></i></div>
|
||||
<div class="btn btn-mini toggleAdditionalData pull-right" data-bind="visible: origin != 'sdcard',click: function() { if ($root.enableAdditionalData($data)) { $root.toggleAdditionalData($data); } else { return; } }, css: { disabled: !$root.enableAdditionalData($data) }" title="{{ _('Additional data')|edq }}"><i class="fas fa-chevron-down"></i></div>
|
||||
<div class="btn btn-mini pull-right disabled" data-bind="visible: origin == 'sdcard'" title="{{ _('On SD Card')|edq }}"><i class="fas fa-sd-card"></i></div>
|
||||
<div class="title clickable" data-bind="click: function() { if ($root.enableSelect($data)) { $root.loadFile($data, false); } else { return; } }, css: $root.getSuccessClass($data), style: { 'font-weight': $root.listHelper.isSelected($data) ? 'bold' : 'normal' }, text: display"></div>
|
||||
<div class="internal" data-bind="visible: display && name != display && $root.showInternalFilename">{{ _('Internal') }}: <span data-bind="text: name"></span></div>
|
||||
<div class="uploaded">{{ _('Uploaded') }}: <span data-bind="text: formatTimeAgo(date), attr: {title: formatDate(date)}"></span></div>
|
||||
<div class="uploaded">{{ _('Uploaded') }}: <span data-bind="text: formatTimeAgo(date, '?'), attr: {title: formatDate(date, {placeholder:'{{ _('unknown') | esq }}'})}"></span></div>
|
||||
<div class="size">{{ _('Size') }}: <span data-bind="text: formatSize(size)"></span></div>
|
||||
<div class="additionalInfo hide" data-bind="html: $root.getAdditionalData($data)"></div>
|
||||
<div class="btn-group action-buttons">
|
||||
@@ -33,7 +34,7 @@
|
||||
<script type="text/html" id="files_template_model">
|
||||
<div class="title muted" data-bind="text: display"></div>
|
||||
<div class="internal" data-bind="visible: name != display">{{ _('Internal') }}: <span data-bind="text: name"></span></div>
|
||||
<div class="uploaded">{{ _('Uploaded') }}: <span data-bind="text: formatTimeAgo(date), attr: {title: formatDate(date)}"></span></div>
|
||||
<div class="uploaded">{{ _('Uploaded') }}: <span data-bind="text: formatTimeAgo(date, '?'), attr: {title: formatDate(date, {placeholder:'{{ _('unknown') | esq }}'})}"></span></div>
|
||||
<div class="size">{{ _('Size') }}: <span data-bind="text: formatSize(size)"></span></div>
|
||||
<div class="btn-group action-buttons">
|
||||
<a class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DOWNLOAD), attr: {href: $root.downloadLink($data), css: {disabled: !$root.downloadLink($data)}}" title="{{ _('Download')|edq }}" aria-label="{{ _('Download')|edq }}" role="link"><i class="fas fa-download"></i></a>
|
||||
|
||||
Reference in new issue
Block a user