Commit 26b878b19f08981d1a26bdaf70d67df31bc52855

Authored by janek37
1 parent c8db8b57

poprawki do listy leksemów

media/js/common.js
... ... @@ -125,7 +125,11 @@ $.ajaxJSON = function (params) {
125 125 dataType: 'json',
126 126 data: encoded_data,
127 127 success: parse_result(params),
128   - error: params.error_callback
  128 + error: function(request, status, error) {
  129 + if (request.responseText) {
  130 + params.error_callback(request, status, error);
  131 + }
  132 + }
129 133 });
130 134 } else {
131 135 return $.parseJSON($.ajax({
... ...
media/js/lexeme-view.js
... ... @@ -76,7 +76,7 @@ $.extend(slickgrid, {
76 76 options: $dj.cv_options
77 77 },
78 78 gloss: {name: 'Glosa', gender: 'f', ops: text_ops},
79   - nota: {name: 'Nota', gender: 'f', ops: text_ops},
  79 + note: {name: 'Nota', gender: 'f', ops: text_ops},
80 80 cr_type: {
81 81 name: 'Typ odsyłacza',
82 82 gender: 'm',
... ...
media/js/remotemodel.js
... ... @@ -16,6 +16,7 @@
16 16 // events
17 17 var onDataLoading = new Slick.Event();
18 18 var onDataLoaded = new Slick.Event();
  19 + var onAjaxError = new Slick.Event();
19 20  
20 21 function init() {
21 22 }
... ... @@ -93,7 +94,7 @@
93 94 method: 'get',
94 95 callback: onSuccess,
95 96 data: ajax_data,
96   - error: function () {
  97 + error_callback: function () {
97 98 onError(fromPage, toPage);
98 99 }
99 100 });
... ... @@ -103,8 +104,7 @@
103 104 }
104 105  
105 106 function onError(fromPage, toPage) {
106   - common.error_alert(
107   - "Błąd w ładowaniu stron od " + fromPage + " do " + toPage);
  107 + onAjaxError.notify();
108 108 }
109 109  
110 110 function onSuccess(ajax_data) {
... ... @@ -189,7 +189,8 @@
189 189  
190 190 // events
191 191 "onDataLoading": onDataLoading,
192   - "onDataLoaded": onDataLoaded
  192 + "onDataLoaded": onDataLoaded,
  193 + "onAjaxError": onAjaxError
193 194 };
194 195 }
195 196  
... ...
media/js/slickgrid.js
... ... @@ -293,17 +293,21 @@ $(function() {
293 293  
294 294 var loadingIndicator = null;
295 295 slickgrid.loader.onDataLoading.subscribe(function () {
  296 + layout.adjust_grid_size();
  297 + var $g = slickgrid.element;
296 298 if (!loadingIndicator) {
297 299 loadingIndicator = $(
298 300 "<span class='loading-indicator'><label>Ładowanie..." +
299 301 "</label></span>").appendTo(document.body);
300   - var $g = slickgrid.element;
301   -
302 302 loadingIndicator
303   - .css("position", "absolute")
304   - .css("top", $g.position().top + $g.height() / 2 - loadingIndicator.height() / 2)
305   - .css("left", $g.position().left + $g.width() / 2 - loadingIndicator.width() / 2);
  303 + .css("position", "absolute");
306 304 }
  305 + loadingIndicator.css(
  306 + "top", $g.position().top + $g.height() / 2 -
  307 + loadingIndicator.height() / 2)
  308 + .css(
  309 + "left", $g.position().left + $g.width() / 2 -
  310 + loadingIndicator.width() / 2);
307 311  
308 312 loadingIndicator.show();
309 313 });
... ... @@ -317,7 +321,6 @@ $(function() {
317 321 slickgrid.grid.render();
318 322  
319 323 loadingIndicator.fadeOut();
320   - layout.adjust_grid_size();
321 324 var num = slickgrid.grid.getDataLength();
322 325 document.title = slickgrid.grid_caption + ' (' + num + ')';
323 326  
... ... @@ -341,6 +344,11 @@ $(function() {
341 344 }
342 345 });
343 346  
  347 + slickgrid.loader.onAjaxError.subscribe(function() {
  348 + common.error_alert("Załadowanie leksemów nie powiodło się.");
  349 + loadingIndicator.fadeOut();
  350 + });
  351 +
344 352 // wyszukiwanie
345 353 var search_timeout_handler;
346 354 $("#text-search").keyup(function (e) {
... ...