Skip to content

Commit 79699b8

Browse files
committed
Timezone warning / add entry no-reload
1 parent 511703f commit 79699b8

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

web/dispatch.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
date_default_timezone_set('Europe/Moscow');
4+
35
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vesta/core/utils/error_logger.php';
46
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vesta/app.init.php';
57

web/js/actions.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,19 @@ App.Actions.save_form = function(evt) {
252252
}
253253

254254
if (elm.attr('id') == App.Constants[elm_id]) { // NEW ITEM
255-
var values = App.Helpers.getFormValues(elm);
256-
if(App.Validate.form(values, $('#'+elm_id))) {
257-
App.Model.add(values, source);
258-
var form_id = App.Constants[App.Env.world + '_FORM_ID'];
259-
$('#'+form_id).remove();
255+
if ($('.b-new-entry').length > 1) {
256+
var confirmed = confirm('You were editing other entries and those changes will be discarded. Click cancel if you want to save updated entries before adding new one.');
257+
if (!confirmed) {
258+
return true;
259+
}
260+
else {
261+
var values = App.Helpers.getFormValues(elm);
262+
if(App.Validate.form(values, $('#'+elm_id))) {
263+
App.Model.add(values, source);
264+
var form_id = App.Constants[App.Env.world + '_FORM_ID'];
265+
$('#'+form_id).remove();
266+
}
267+
}
260268
}
261269
}
262270
else { // OLD ITEM, UPDATING IT

web/js/model.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,15 @@ App.Model.CRON.loadList = function(callback)
8282
App.Model.add = function(values, source_json)
8383
{
8484
var method = App.Settings.getMethodName('add');
85+
8586
App.Ajax.request(method, {
8687
spell: $.toJSON(values)
8788
}, function(reply){
8889
if(!reply.result) {
8990
App.Helpers.Warn('Changes were not applied ' + App.Helpers.toJSON(reply.errors) );
9091
}
9192
else {
92-
/*var build_method = App.Env.getWorldName() + '_entry';
93-
var tpl = App.HTML.Build[build_method](values, 'new');
94-
App.Ref.CONTENT..replaceWith(tpl);*/
95-
// todo: reply.data;
9693
App.Pages.prepareHTML();
97-
App.Helpers.updateScreen();
9894
}
9995
});
10096
}

0 commit comments

Comments
 (0)