show warning for deleting modified files

This commit is contained in:
antelle 2016-03-19 09:15:20 +03:00
parent e6f56526ac
commit 452830b651
2 changed files with 3 additions and 2 deletions

View File

@ -126,6 +126,7 @@ var Locale = {
openPassFor: 'Password for',
openRemoveLastQuestion: 'Delete local file?',
openRemoveLastQuestionBody: 'The file you are deleting is stored only inside the app. Delete it permanently?',
openRemoveLastQuestionModBody: 'The file you are deleting has local modifications. Delete it and discard these modifications?',
openLocalFile: 'Local file',
openLocalFileBody: 'You are going to open a file which will be stored inside the app. ' +
'Changes you make will not be saved back to file system. ' +

View File

@ -288,11 +288,11 @@ var OpenView = Backbone.View.extend({
var id = $(e.target).closest('.open__last-item').data('id').toString();
if ($(e.target).is('.open__last-item-icon-del')) {
var fileInfo = this.model.fileInfos.get(id);
if (!fileInfo.get('storage')) {
if (!fileInfo.get('storage') || fileInfo.get('modified')) {
var that = this;
Alerts.yesno({
header: Locale.openRemoveLastQuestion,
body: Locale.openRemoveLastQuestionBody,
body: fileInfo.get('modified') ? Locale.openRemoveLastQuestionModBody : Locale.openRemoveLastQuestionBody,
buttons: [
{result: 'yes', title: Locale.alertYes},
{result: '', title: Locale.alertNo}