@@ -121,42 +121,22 @@ App.Model.update = function(values, source_json, elm)
121121{
122122 var method = App . Settings . getMethodName ( 'update' ) ;
123123 var build_method = App . Env . getWorldName ( ) + '_entry' ;
124- App . Ajax . request ( method , {
124+ var params = {
125125 'old' : source_json ,
126126 'new' : App . Helpers . toJSON ( values )
127- } , function ( reply ) {
127+ } ;
128+ App . Ajax . request ( method , params , function ( reply ) {
128129 if ( ! reply . result ) {
129130 var tpl = App . HTML . Build [ build_method ] ( App . Helpers . evalJSON ( source_json ) ) ;
130131 $ ( elm ) . replaceWith ( tpl ) ;
131132 App . Helpers . updateScreen ( ) ;
132- App . Helpers . Warn ( 'Changes were not applied' ) ;
133+ App . Helpers . Warn ( 'Changes were not applied. ' + reply . message ) ;
133134 }
134135 else {
135- /* var tpl = App.HTML.Build[build_method](reply.data );
136+ var tpl = App . HTML . Build [ build_method ] ( $ . extend ( App . Helpers . evalJSON ( source_json ) , values ) ) ;
136137 $ ( elm ) . replaceWith ( tpl ) ;
137- App.Helpers.updateScreen();*/
138- // todo: reply.data;
139- App . Pages . prepareHTML ( ) ;
140138 App . Helpers . updateScreen ( ) ;
141- /*var refl = {'USER': 'LOGIN_NAME'};
142- App.Model[App.Env.world].loadList(function(reply) {
143- var acc = [];
144- var build_method = App.Env.getWorldName() + '_entry';
145- var data = reply.data;
146- // TODO: fix it data.data
147- $.each(data, function(key)
148- {
149- var o = data[key];
150- fb.warn(key);
151- acc[acc.length++] = App.HTML.Build[build_method](o, key);
152- });
153-
154- var html = acc.done().wrapperize('ENTRIES_WRAPPER', App.Env.getWorldName());
155- App.Ref.CONTENT.html(html);
156- App.Helpers.updateScreen();
157- );*/
158139 }
159- // TODO: !
160140 } ) ;
161141}
162142
0 commit comments