Merge branch 'maintenance' of github.com:OctoPrint/OctoPrint into maintenance
This commit is contained in:
commit
b38b50f4b4
3 files changed
+23
-7
No files matched your search
@@ -89,7 +89,7 @@ $(function () {
|
||||
self.moveDestinationFilename = ko.observable(undefined);
|
||||
self.moveDestinationFullpath = ko.pureComputed(function () {
|
||||
// Join the paths for renaming
|
||||
if (self.moveSourceFilename() != self.moveDestinationFilename()) {
|
||||
if (self.moveSourceFilename() !== self.moveDestinationFilename()) {
|
||||
if (self.moveDestination() === "/") {
|
||||
return self.moveDestination() + self.moveDestinationFilename();
|
||||
} else {
|
||||
@@ -100,6 +100,16 @@ $(function () {
|
||||
}
|
||||
});
|
||||
self.moveError = ko.observable("");
|
||||
self.moveButtonText = ko.pureComputed(function () {
|
||||
if (self.moveSource() === self.moveDestination()) {
|
||||
return gettext("Rename");
|
||||
} else {
|
||||
// Moving, but maybe also renaming
|
||||
if (self.moveSourceFilename() !== self.moveDestinationFilename()) {
|
||||
return gettext("Move & Rename");
|
||||
} else return gettext("Move");
|
||||
}
|
||||
});
|
||||
|
||||
self.folderList = ko.observableArray(["/"]);
|
||||
self.addFolderDialog = undefined;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<div id="move_file_or_folder_dialog" class="modal hide fade-in">
|
||||
<div class="modal-header">
|
||||
<a href="#" class="close" data-dismiss="modal" aria-hidden="true">×</a>
|
||||
<h3>{{ _('Move File or Folder') }}</h3>
|
||||
<h3>{{ _('Move or Rename ') }}<span data-bind="text: moveEntry().type === 'folder' ? gettext('Folder') : gettext('File')"></span></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-vertical" action="javascript:void(0)">
|
||||
@@ -33,18 +33,24 @@
|
||||
<select class="input-block-level" data-bind="value: moveDestination, options: folderList"></select>
|
||||
<span class="help-block"><small class="text-error" data-bind="text: moveError, visible: moveError().length > 0" style="display: none"></small></span>
|
||||
</div>
|
||||
<label class="control-label">{{ _('Set destination filename ') }} ({{ _('Currently:') }} <span data-bind="text: moveSourceFilename()"></span>)</label>
|
||||
<label class="control-label">{{ _('Set destination name ') }} ({{ _('Currently:') }} <span data-bind="text: moveSourceFilename()"></span>)</label>
|
||||
<div class="controls">
|
||||
<input class="input-block-level" data-bind="value: moveDestinationFilename" />
|
||||
<input type="text" class="input-block-level" data-bind="value: moveDestinationFilename" />
|
||||
</div>
|
||||
|
||||
<p> {{ _('File/Folder will be moved to: ') }} <span data-bind="text: moveDestinationFullpath()"></span></p>
|
||||
<p data-bind="visible: moveSource() !== moveDestination() || moveSourceFilename() !== moveDestinationFilename()">
|
||||
<span data-bind="text: moveEntry().type === 'folder' ? gettext('Folder') : gettext('File')"></span>{{ _(' will be moved to: ') }} <span data-bind="text: moveDestinationFullpath()"></span>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Cancel') }}</a>
|
||||
<a href="#" class="btn btn-primary" data-bind="click: function() { if ((moveSource() !== moveDestination() || moveSourceFilename() !== moveDestinationFilename()) && !movingFileOrFolder()) { $root.moveFileOrFolder(moveEntry().path, moveDestinationFullpath()) } else {} }, css: {disabled: (moveSource() === moveDestination() && moveSourceFilename() === moveDestinationFilename()) || movingFileOrFolder()}"><i class="fas fa-spinner fa-spin" data-bind="visible: movingFileOrFolder"></i> {{ _('Move') }}</a>
|
||||
<a href="#" class="btn btn-primary"
|
||||
data-bind="click: function() { if ((moveSource() !== moveDestination() || moveSourceFilename() !== moveDestinationFilename()) && !movingFileOrFolder()) { $root.moveFileOrFolder(moveEntry().path, moveDestinationFullpath()) } else {} },
|
||||
css: {disabled: (moveSource() === moveDestination() && moveSourceFilename() === moveDestinationFilename()) || movingFileOrFolder()},
|
||||
text: moveButtonText">
|
||||
<i class="fas fa-spinner fa-spin" data-bind="visible: movingFileOrFolder"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="additionalInfo hide" data-bind="html: $root.getAdditionalData($data)"></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 }}"><i class="fas fa-download"></i></a>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasAllPermissionsKo($root.access.permissions.FILES_UPLOAD, $root.access.permissions.FILES_DELETE), click: function(data, event) { if ($root.enableMove($data)) { $root.showMoveDialog($data, event); } else { return; } }, css: {disabled: !$root.enableMove($data)}" title="{{ _('Move')|edq }}" aria-label="{{ _('Move')|edq }}" role="link"><i class="fas fa-cut"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasAllPermissionsKo($root.access.permissions.FILES_UPLOAD, $root.access.permissions.FILES_DELETE), click: function(data, event) { if ($root.enableMove($data)) { $root.showMoveDialog($data, event); } else { return; } }, css: {disabled: !$root.enableMove($data)}" title="{{ _('Move or Rename')|edq }}" aria-label="{{ _('Move or Rename')|edq }}" role="link"><i class="fas fa-cut"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove')|edq }}" aria-label="{{ _('Remove')|edq }}" role="link"><i class="far fa-trash-alt"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_SELECT), click: function() { if ($root.enableSelect($data)) { $root.loadFile($data, false); } else { return; } }, css: {disabled: !$root.enableSelect($data)}" title="{{ _('Load')|edq }}" aria-label="{{ _('Load')|edq }}" role="link"><i class="fas fa-folder-open"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.PRINT), click: function() { if ($root.enableSelectAndPrint($data)) { $root.loadFile($data, true); } else { return; } }, css: {disabled: !$root.enableSelectAndPrint($data)}" title="{{ _('Load and Print')|edq }}" aria-label="{{ _('Load and Print')|edq }}" role="link"><i class="fas fa-print"></i></div>
|
||||
|
||||
Reference in new issue
Block a user