Commit a99a7216b2cebc81f658bcc1ea974cf9497cd315

Authored by janek37
1 parent 8e5bdf1d

zapisywanie filtrów w localStorage

(+ różne drobne refaktoryzacje)

--HG--
branch : beta
common/static/css/general.css
... ... @@ -191,6 +191,10 @@ label {
191 191 clear: both;
192 192 }
193 193  
  194 +.dialog-stretcher {
  195 + width: 150px;
  196 +}
  197 +
194 198 #login-box {
195 199 display: inline-block;
196 200 margin-top: 100px;
... ...
common/static/js/common.js
... ... @@ -101,6 +101,21 @@ $.fn.multiSelect = function(params) {
101 101 this.multiselect2(ms_params);
102 102 };
103 103  
  104 +$.fn.default_dialog = function(params) {
  105 + "use strict";
  106 + this.dialog($.extend(
  107 + {
  108 + autoOpen: false,
  109 + width: 'auto',
  110 + height: 'auto',
  111 + // workaround do http://bugs.jqueryui.com/ticket/11776
  112 + resizable: false,
  113 + dragStop: function() {
  114 + jQuery(this).dialog({width: 'auto', height: 'auto'});
  115 + }
  116 + }, params));
  117 +};
  118 +
104 119 var common = (function() {
105 120 "use strict";
106 121 return {
... ...
common/static/js/slickgrid.js
1 1 /* global $dj, Slick, edit, layout, common, getBusyOverlay, gettext */
2 2  
3   -var slickgrid = {
4   - loader: new Slick.Data.RemoteModel(
5   - $dj.ajax_get_page, $dj.ajax_search_index),
6   - grid: undefined,
7   - set_active_when_loaded: undefined,
8   - skip_cell_changed: false,
9   - last_active_row: undefined,
10   - last_search: undefined,
11   -
12   - op_names: {
13   - eq: gettext("equal to"),
14   - in: gettext("equal to"),
15   - ne: gettext("not equal to"),
16   - '-in': gettext("not equal to"),
17   - le: gettext("less than"),
18   - ge: gettext("greater than"),
19   - bw: gettext("starts with"),
20   - bn: gettext("doesn't start with"),
21   - ew: gettext("ends with"),
22   - en: gettext("doesn't end with"),
23   - cn: gettext("contains"),
24   - nc: gettext("doesn't contain"),
25   - re: gettext("matched by pattern"),
26   - nr: gettext("not matched by pattern")
27   - },
28   -
29   - search_string: function() {
30   - "use strict";
31   - return $('#text-search').val();
32   - },
33   -
34   - set_active: function(index, load) {
35   - "use strict";
36   - if (load && edit.changed && !edit.confirm_discard()) {
37   - return;
38   - }
39   -
40   - if (slickgrid.grid.getData().length > 0) {
41   - slickgrid.skip_cell_changed = true;
42   - slickgrid.grid.setActiveCell(index, 0);
43   - slickgrid.skip_cell_changed = false;
44   - slickgrid.last_active_row = index;
45   - if (load) {
46   - slickgrid.load_content(slickgrid.active_id());
  3 +var slickgrid = (function() {
  4 + "use strict";
  5 + return {
  6 + loader: new Slick.Data.RemoteModel(
  7 + $dj.ajax_get_page, $dj.ajax_search_index),
  8 + grid: undefined,
  9 + set_active_when_loaded: undefined,
  10 + skip_cell_changed: false,
  11 + last_active_row: undefined,
  12 + last_search: undefined,
  13 +
  14 + op_names: {
  15 + eq: gettext("equal to"),
  16 + in: gettext("equal to"),
  17 + ne: gettext("not equal to"),
  18 + '-in': gettext("not equal to"),
  19 + le: gettext("less than"),
  20 + ge: gettext("greater than"),
  21 + bw: gettext("starts with"),
  22 + bn: gettext("doesn't start with"),
  23 + ew: gettext("ends with"),
  24 + en: gettext("doesn't end with"),
  25 + cn: gettext("contains"),
  26 + nc: gettext("doesn't contain"),
  27 + re: gettext("matched by pattern"),
  28 + nr: gettext("not matched by pattern")
  29 + },
  30 +
  31 + search_string: function () {
  32 + return $('#text-search').val();
  33 + },
  34 +
  35 + set_active: function (index, load) {
  36 + if (load && edit.changed && !edit.confirm_discard()) {
  37 + return;
47 38 }
48   - } else
49   - slickgrid.last_active_row = undefined;
50   - },
51   -
52   - active_id: function() {
53   - "use strict";
54   - var cell = slickgrid.grid.getActiveCell();
55   - if (cell === null || cell === undefined)
56   - return undefined;
57   - var row = slickgrid.grid.getActiveCell().row;
58   - if (row === undefined)
59   - return undefined;
60   - if (slickgrid.grid.getDataItem(row) === undefined)
61   - return undefined;
62   - return slickgrid.grid.getDataItem(row).id;
63   - },
64   -
65   - get_id: function() {
66   - "use strict";
67   - return edit.active_id;
68   - },
69   -
70   - search_counter: 0,
71   -
72   - scroll_search: function() {
73   - "use strict";
74   - if (slickgrid.search_string() === slickgrid.last_search)
75   - return;
76   - slickgrid.last_search = slickgrid.search_string();
77   - slickgrid.search_counter++;
78   - //slickgrid.loader.onDataLoading.notify();
79   - slickgrid.loader.searchRow(
80   - function (row) {
81   - slickgrid.set_active_when_loaded = row;
82   - slickgrid.grid.scrollRowToCenter(row);
83   - slickgrid.loading_off();
84   - });
85   - },
86 39  
87   - search: function() {
88   - "use strict";
89   - slickgrid.scroll_search();
90   - },
91   -
92   - search_enter: function() {
93   - "use strict";
94   - slickgrid.search();
95   - },
96   -
97   - row_index: function(id) {
98   - "use strict";
99   - $.ajaxJSON({
100   - url: $dj.ajax_row_index,
101   - method: 'get',
102   - data: {
103   - id: id,
104   - query_params: slickgrid.query_params()
105   - },
106   - callback: function(data) {
107   - var index = data.index;
108   - if (index === null) {
109   - slickgrid.load_content(id);
110   - slickgrid.last_active_row = undefined;
111   - slickgrid.grid.resetActiveCell();
112   - } else {
113   - slickgrid.set_active_when_loaded = index;
114   - slickgrid.grid.scrollRowToCenter(index);
115   - slickgrid.ensure_data();
  40 + if (slickgrid.grid.getData().length > 0) {
  41 + slickgrid.skip_cell_changed = true;
  42 + slickgrid.grid.setActiveCell(index, 0);
  43 + slickgrid.skip_cell_changed = false;
  44 + slickgrid.last_active_row = index;
  45 + if (load) {
  46 + slickgrid.load_content(slickgrid.active_id());
116 47 }
117   - }
118   - });
119   - },
120   -
121   - ensure_data: function() {
122   - "use strict";
123   - var filter_button = $('#filter-button');
124   - filter_button.children().first().toggleClass('ui-state-highlight',
125   - slickgrid.loader.getFilter().rules.length !== 0);
126   - filter_button.toggleClass(
127   - 'menu-button-active',
128   - slickgrid.loader.getFilter().rules.length !== 0);
129   - var vp = slickgrid.grid.getViewport();
130   - slickgrid.loader.ensureData(vp.top, vp.bottom);
131   - },
132   -
133   - reload_data: function() {
134   - "use strict";
135   - var vp = slickgrid.grid.getViewport();
136   - slickgrid.loader.reloadData(vp.top, vp.bottom);
137   - },
138   -
139   - title_part: function() {
140   - "use strict";
141   - return slickgrid.grid_caption;
142   - },
143   -
144   - refresh_title: function() {
145   - "use strict";
146   - var num = slickgrid.grid.getDataLength();
147   - document.title = slickgrid.title_part() +
148   - ' – SGJP (' + num + ' ' + slickgrid.counter(num) + ')';
149   - }
150   -};
  48 + } else
  49 + slickgrid.last_active_row = undefined;
  50 + },
  51 +
  52 + active_id: function () {
  53 + var cell = slickgrid.grid.getActiveCell();
  54 + if (cell === null || cell === undefined)
  55 + return undefined;
  56 + var row = slickgrid.grid.getActiveCell().row;
  57 + if (row === undefined)
  58 + return undefined;
  59 + if (slickgrid.grid.getDataItem(row) === undefined)
  60 + return undefined;
  61 + return slickgrid.grid.getDataItem(row).id;
  62 + },
  63 +
  64 + get_id: function () {
  65 + return edit.active_id;
  66 + },
  67 +
  68 + search_counter: 0,
  69 +
  70 + scroll_search: function () {
  71 + if (slickgrid.search_string() === slickgrid.last_search)
  72 + return;
  73 + slickgrid.last_search = slickgrid.search_string();
  74 + slickgrid.search_counter++;
  75 + //slickgrid.loader.onDataLoading.notify();
  76 + slickgrid.loader.searchRow(
  77 + function (row) {
  78 + slickgrid.set_active_when_loaded = row;
  79 + slickgrid.grid.scrollRowToCenter(row);
  80 + slickgrid.loading_off();
  81 + });
  82 + },
  83 +
  84 + search: function () {
  85 + slickgrid.scroll_search();
  86 + },
  87 +
  88 + search_enter: function () {
  89 + slickgrid.search();
  90 + },
  91 +
  92 + row_index: function (id) {
  93 + $.ajaxJSON({
  94 + url: $dj.ajax_row_index,
  95 + method: 'get',
  96 + data: {
  97 + id: id,
  98 + query_params: slickgrid.query_params()
  99 + },
  100 + callback: function (data) {
  101 + var index = data.index;
  102 + if (index === null) {
  103 + slickgrid.load_content(id);
  104 + slickgrid.last_active_row = undefined;
  105 + slickgrid.grid.resetActiveCell();
  106 + } else {
  107 + slickgrid.set_active_when_loaded = index;
  108 + slickgrid.grid.scrollRowToCenter(index);
  109 + slickgrid.ensure_data();
  110 + }
  111 + }
  112 + });
  113 + },
  114 +
  115 + ensure_data: function () {
  116 + var filter_button = $('#filter-button');
  117 + filter_button.children().first().toggleClass('ui-state-highlight',
  118 + slickgrid.loader.getFilter().rules.length !== 0);
  119 + filter_button.toggleClass(
  120 + 'menu-button-active',
  121 + slickgrid.loader.getFilter().rules.length !== 0);
  122 + var vp = slickgrid.grid.getViewport();
  123 + slickgrid.loader.ensureData(vp.top, vp.bottom);
  124 + },
  125 +
  126 + reload_data: function () {
  127 + var vp = slickgrid.grid.getViewport();
  128 + slickgrid.loader.reloadData(vp.top, vp.bottom);
  129 + },
  130 +
  131 + title_part: function () {
  132 + return slickgrid.grid_caption;
  133 + },
  134 +
  135 + refresh_title: function () {
  136 + var num = slickgrid.grid.getDataLength();
  137 + document.title = slickgrid.title_part() +
  138 + ' – SGJP (' + num + ' ' + slickgrid.counter(num) + ')';
  139 + },
  140 +
  141 + saved_filters: function () {
  142 + return $.parseJSON(
  143 + localStorage.getItem(slickgrid.storage_filters_key));
  144 + },
  145 +
  146 + update_saved_filters: function (filters) {
  147 + localStorage.setItem(
  148 + slickgrid.storage_filters_key, $.toJSON(filters));
  149 + }
  150 + };
  151 +})();
151 152  
152 153 var options = {
153 154 editable: false,
... ... @@ -278,42 +279,58 @@ function get_filter() {
278 279  
279 280 function save_filter() {
280 281 "use strict";
281   - var filter_name, post_data;
282   - filter_name = window.prompt("Wybierz nazwę filtru do zapisania");
  282 + var filter_name = window.prompt("Wybierz nazwę filtru do zapisania");
283 283 if (filter_name) {
284   - post_data = {
285   - name: filter_name,
286   - serialized_filter: $.toJSON(get_filter())
287   - };
288   - var save_filter_data = {
289   - method: 'post',
290   - url: $dj.ajax_save_filter,
291   - data: post_data,
292   - description: 'Zapisanie filtru'
293   - };
294   - $.ajaxJSON($.extend(save_filter_data, {
295   - callback: function (data) {
296   - if (data.exists && window.confirm(
  284 + var filter_params = get_filter();
  285 + if (edit.reader) {
  286 + if (common.storage_present() && slickgrid.storage_filters_key) {
  287 + var saved_filters = slickgrid.saved_filters();
  288 + if (!saved_filters)
  289 + saved_filters = {};
  290 + if (!saved_filters[filter_name] || window.confirm(
297 291 "Filtr o tej nazwie już istnieje. Nadpisać?")) {
298   - $.ajaxJSON($.extend(save_filter_data, {
299   - data: $.extend(post_data, {force: true})
300   - }));
  292 + saved_filters[filter_name] = filter_params;
301 293 }
  294 + slickgrid.update_saved_filters(saved_filters);
302 295 }
303   - }));
  296 + } else {
  297 + var post_data = {
  298 + name: filter_name,
  299 + serialized_filter: $.toJSON(filter_params)
  300 + };
  301 + var save_filter_params = {
  302 + method: 'post',
  303 + url: $dj.ajax_save_filter,
  304 + data: post_data,
  305 + description: 'Zapisanie filtru'
  306 + };
  307 + $.ajaxJSON($.extend(save_filter_params, {
  308 + callback: function (data) {
  309 + if (data.exists && window.confirm(
  310 + "Filtr o tej nazwie już istnieje. Nadpisać?")) {
  311 + $.ajaxJSON($.extend(save_filter_params, {
  312 + data: $.extend(post_data, {force: true})
  313 + }));
  314 + }
  315 + }
  316 + }));
  317 + }
304 318 }
305 319 return false;
306 320 }
307 321  
308   -function put_filter(filter) {
  322 +function put_filter(filter_params) {
309 323 "use strict";
310   - $('#group-op').val(filter.group_op);
  324 + $('#group-op').val(filter_params.group_op);
311 325 $('#filter-table').empty();
312   - $.each(filter.rules, function(i, rule) {
313   - var filter_dialog = $('#choose-filter-dialog');
314   - filter_dialog.dialog('open');
  326 + var filter_dialog = $('#choose-filter-dialog');
  327 + var filter_is_open = filter_dialog.dialog('isOpen');
  328 + $.each(filter_params.rules, function(i, rule) {
  329 + if (!filter_is_open)
  330 + filter_dialog.dialog('open');
315 331 var row = add_filter_rule(rule.field);
316   - filter_dialog.dialog('close');
  332 + if (!filter_is_open)
  333 + filter_dialog.dialog('close');
317 334 if ($.fn.selectmenu)
318 335 row.find('.rule-op').selectmenu('value', rule.op);
319 336 else
... ... @@ -326,33 +343,41 @@ function put_filter(filter) {
326 343 });
327 344 }
328 345  
329   -function filter_choice(ajax_data) {
  346 +function filter_choice(filters) {
330 347 "use strict";
331   - var filters = ajax_data.filters;
332 348 var list = $('#filter-list');
333 349 list.empty();
334 350 $.each(filters, function (i, filter) {
335   - var item = $('<li/>').addClass('ui-state-default').attr('id', filter.id);
  351 + var item = $('<li/>').addClass('ui-state-default');
  352 + if (filter.id)
  353 + item.attr('id', filter.id);
336 354 var delete_button = $('<span/>')
337 355 .addClass('remove ui-icon ui-icon-closethick');
338 356 delete_button.click(function () {
339 357 if (window.confirm('Usunąć filtr "' + filter.name + '"?')) {
340   - $.ajaxJSON({
341   - method: 'post',
342   - url: $dj.ajax_delete_filter,
343   - data: {id: filter.id},
344   - description: 'Usunięcie filtru',
345   - callback: function () {
346   - item.remove();
347   - }
348   - });
  358 + if (edit.reader && slickgrid.storage_filters_key) {
  359 + var saved_filters = slickgrid.saved_filters();
  360 + delete saved_filters[filter.name];
  361 + slickgrid.update_saved_filters(saved_filters);
  362 + item.remove();
  363 + } else {
  364 + $.ajaxJSON({
  365 + method: 'post',
  366 + url: $dj.ajax_delete_filter,
  367 + data: {id: filter.id},
  368 + description: 'Usunięcie filtru',
  369 + callback: function () {
  370 + item.remove();
  371 + }
  372 + });
  373 + }
349 374 }
350 375 return false;
351 376 });
352 377 item.append(delete_button);
353 378 item.append(filter.name);
354 379 item.click(function () {
355   - put_filter($.parseJSON(filter.json));
  380 + put_filter(filter.params);
356 381 $("#load-filter-dialog").dialog('close');
357 382 });
358 383 list.append(item);
... ... @@ -508,14 +533,25 @@ $(function() {
508 533 {
509 534 text: gettext("Load filter"),
510 535 click: function () {
511   - $.ajaxJSON({
512   - method: 'get',
513   - url: $dj.ajax_get_filters,
514   - data: {},
515   - description: 'Pobranie listy filtrów',
516   - callback: filter_choice
517   - });
518   - return false;
  536 + if (edit.reader && slickgrid.storage_filters_key) {
  537 + var saved_filters = slickgrid.saved_filters();
  538 + var filters = [];
  539 + $.each(saved_filters, function(name, filter) {
  540 + filters.push({name: name, params: filter});
  541 + });
  542 + filter_choice(filters);
  543 + } else {
  544 + $.ajaxJSON({
  545 + method: 'get',
  546 + url: $dj.ajax_get_filters,
  547 + data: {},
  548 + description: 'Pobranie listy filtrów',
  549 + callback: function(data) {
  550 + filter_choice(data.filters);
  551 + }
  552 + });
  553 + }
  554 + //return false;
519 555 }
520 556 },
521 557 apply:
... ... @@ -527,7 +563,7 @@ $(function() {
527 563 }
528 564 };
529 565 var filter_buttons;
530   - if (edit.reader) {
  566 + if (edit.reader && !common.storage_present()) {
531 567 filter_buttons = [all_filter_buttons.clear, all_filter_buttons.apply];
532 568 } else {
533 569 filter_buttons = [
... ... @@ -538,17 +574,9 @@ $(function() {
538 574 ];
539 575 }
540 576 var filter_dialog = $('#choose-filter-dialog');
541   - filter_dialog.dialog({
542   - autoOpen: false,
543   - width: 'auto',
544   - height: 'auto',
545   - resizable: false,
  577 + filter_dialog.default_dialog({
546 578 modal: false,
547   - buttons: filter_buttons,
548   - // workaround do http://bugs.jqueryui.com/ticket/11776
549   - dragStop: function() {
550   - jQuery(this).dialog({width: 'auto', height: 'auto'});
551   - }
  579 + buttons: filter_buttons
552 580 });
553 581 filter_dialog.dialog('open');
554 582 if ($.fn.selectmenu)
... ... @@ -569,6 +597,12 @@ $(function() {
569 597 $('#choose-filter-dialog').dialog('open');
570 598 });
571 599  
  600 + $('#load-filter-dialog').default_dialog({
  601 + autoOpen: false,
  602 + modal: true
  603 + });
  604 +
  605 +
572 606 $(document).on('keyup', '#filter-table input', function (e) {
573 607 if (e.which === 13) { // enter
574 608 $(this).change();
... ... @@ -582,9 +616,7 @@ $(function() {
582 616 }
583 617  
584 618 // wybór kolumn
585   - $('#choose-columns-dialog').dialog({
586   - autoOpen: false,
587   - width: 'auto',
  619 + $('#choose-columns-dialog').default_dialog({
588 620 modal: true,
589 621 buttons: [
590 622 {
... ... @@ -630,9 +662,7 @@ $(function() {
630 662 });
631 663  
632 664 // inne działania
633   - $('#more-actions-dialog').dialog({
634   - autoOpen: false,
635   - width: 'auto',
  665 + $('#more-actions-dialog').default_dialog({
636 666 modal: true
637 667 });
638 668  
... ... @@ -660,8 +690,8 @@ $(function() {
660 690 function export_list(filename) {
661 691 "use strict";
662 692 var param = {
663   - query_params: JSON.stringify(slickgrid.query_params()),
664   - columns: JSON.stringify($.map(
  693 + query_params: $.toJSON(slickgrid.query_params()),
  694 + columns: $.toJSON($.map(
665 695 slickgrid.grid.getColumns(), function(col) {return col.field;})),
666 696 filename: filename
667 697 };
... ...
dictionary/ajax_filters.py
1 1 # -*- coding: utf-8 -*-/home/janek/src/lexeme_forge/dictionary
2 2  
3 3 from common.decorators import ajax, AjaxError
  4 +from common.util import json_decode
4 5 from dictionary.models import SavedFilter
5 6  
6 7  
... ... @@ -27,11 +28,12 @@ def save_filter(request, name, serialized_filter, super=False, force=False):
27 28  
28 29 @ajax(method='get')
29 30 def get_filters(request):
30   - filters = [{
31   - 'id': 'filter%s' % filter.pk,
32   - 'name': filter.name,
33   - 'json': filter.serialized_filter,
34   - }
  31 + filters = [
  32 + {
  33 + 'id': 'filter%s' % filter.pk,
  34 + 'name': filter.name,
  35 + 'params': json_decode(filter.serialized_filter),
  36 + }
35 37 for filter in SavedFilter.objects.filter(user=request.user)]
36 38 return {'filters': filters}
37 39  
... ...
dictionary/static/js/lexeme-edit.js
... ... @@ -151,21 +151,10 @@ $.extend(edit, {
151 151 $(document).on('change', '.cr-add .entry', set_cr_homonym_number);
152 152 $(document).on('click', '.cr-add .homonym-number', set_cr_homonym_number);
153 153  
154   - $('#load-filter-dialog').dialog({
155   - autoOpen: false,
156   - width: 'auto',
  154 + $('#choose-homonym-dialog').default_dialog({
157 155 modal: true
158 156 });
159   - $('#choose-homonym-dialog').dialog({
160   - autoOpen: false,
161   - width: 'auto',
162   - modal: true
163   - });
164   - $('#prompter-dialog').dialog({
165   - autoOpen: false,
166   - width: 'auto',
167   - height: 'auto',
168   - resizable: false,
  157 + $('#prompter-dialog').default_dialog({
169 158 modal: true,
170 159 buttons: [
171 160 {
... ... @@ -178,15 +167,9 @@ $.extend(edit, {
178 167 text: gettext("Choose"),
179 168 click: input_prompter_pattern
180 169 }
181   - ],
182   - // workaround do http://bugs.jqueryui.com/ticket/11776
183   - dragStop: function() {
184   - jQuery(this).dialog({width: 'auto', height: 'auto'});
185   - }
  170 + ]
186 171 });
187   - $('#auto-derivatives-dialog').dialog({
188   - autoOpen: false,
189   - width: 'auto',
  172 + $('#auto-derivatives-dialog').default_dialog({
190 173 modal: true,
191 174 buttons: [
192 175 {
... ... @@ -201,9 +184,7 @@ $.extend(edit, {
201 184 }
202 185 ]
203 186 });
204   - $('#back-references-dialog').dialog({
205   - autoOpen: false,
206   - width: 'auto',
  187 + $('#back-references-dialog').default_dialog({
207 188 modal: true,
208 189 buttons: [
209 190 {
... ... @@ -230,10 +211,8 @@ $.extend(edit, {
230 211 $(document).on('click', '.delete-action-row', function () {
231 212 $(this).closest('tr').remove();
232 213 });
233   - $('#group-action-dialog').dialog({
234   - autoOpen: false,
  214 + $('#group-action-dialog').default_dialog({
235 215 modal: true,
236   - width: 'auto',
237 216 buttons: [
238 217 {
239 218 text: gettext("Execute"),
... ... @@ -247,8 +226,7 @@ $.extend(edit, {
247 226 $(document).on('click', '#prompter-checkboxes :checkbox', reload_prompter);
248 227  
249 228 $('#add-button').click(add_lexeme);
250   - $('#default-owner-dialog').dialog({
251   - autoOpen: false,
  229 + $('#default-owner-dialog').default_dialog({
252 230 modal: true,
253 231 buttons: [
254 232 {
... ...
dictionary/static/js/lexeme-view.js
... ... @@ -26,10 +26,7 @@ $(function() {
26 26 var id = parseInt(this.id.substr(2), 10);
27 27 slickgrid.row_index(id);
28 28 });
29   - $('#search-by-form-dialog').dialog({
30   - autoOpen: false,
31   - width: 'auto',
32   - height: 'auto',
  29 + $('#search-by-form-dialog').default_dialog({
33 30 modal: false
34 31 });
35 32 $(document).on('click', '.search-by-form-row', function() {
... ... @@ -286,7 +283,7 @@ $.extend(slickgrid, {
286 283 sort_rules: slickgrid.loader.getSort(),
287 284 filter: slickgrid.loader.getFilter(),
288 285 visible_vocabs: visible_vocab_ids,
289   - reader: $dj.reader
  286 + reader: edit.reader
290 287 };
291 288 },
292 289  
... ...
dictionary/static/js/reader-view.js
... ... @@ -45,6 +45,8 @@ var AJAX_URLS = {
45 45 slickgrid.filter_fields.qualifier.name = gettext("Qualifier");
46 46 slickgrid.filter_fields.classification_value.name = gettext("Commonness");
47 47  
  48 + slickgrid.storage_filters_key = 'saved_lexeme_filters';
  49 +
48 50 var new_columns = {};
49 51  
50 52 $.each(narrowed_columns, function (i, column) {
... ...
dictionary/templates/lexeme_view.html
... ... @@ -118,6 +118,7 @@
118 118 </div>
119 119 <div id="load-filter-dialog" title="{% trans 'Choose filter' %}">
120 120 <ul id="filter-list" class="load-dialog-list"></ul>
  121 + <div class="dialog-stretcher"></div>
121 122 </div>
122 123 <div id="group-action-dialog" title="{% trans 'Choose group action' %}">
123 124 <button id="add-action" title="{% trans 'add action' %}">
... ...
dictionary/templates/reader_view.html
... ... @@ -66,6 +66,7 @@
66 66 </div>
67 67 <div id="load-filter-dialog" title="{% trans 'Choose filter' %}">
68 68 <ul id="filter-list" class="load-dialog-list"></ul>
  69 + <div class="dialog-stretcher"></div>
69 70 </div>
70 71 <div id="search-by-form-dialog" title="{% trans 'Search by form' %}">
71 72 <table id="search-by-form-table">
... ...
dictionary/views.py
... ... @@ -131,7 +131,6 @@ def lexeme_view(request):
131 131 User.objects.order_by('username').values_list('id', 'username'))
132 132 js_vars = common_lexeme_js_vars(request, visible)
133 133 js_vars.update({
134   - 'reader': False,
135 134 'ajax_history_table': reverse('history_table'),
136 135 'ajax_odm_forms': reverse('odm_forms'),
137 136 'ajax_edit_form': reverse('lexeme_edit_form'),
... ... @@ -182,7 +181,6 @@ def reader_view(request):
182 181 ]
183 182 js_vars = common_lexeme_js_vars(request, visible, reader=True)
184 183 js_vars.update({
185   - 'reader': True,
186 184 'vocabs': {},
187 185 'user_options': [],
188 186 'auto_search': True,
... ...
export/static/js/export.js
... ... @@ -179,10 +179,7 @@ $(function () {
179 179 $('#add-magic-qualifier-row').click(add_qualifier_row);
180 180 $('button.save').click(save_export_data);
181 181 $('button.load').click(load_export_data);
182   - $('#load-data-dialog').dialog({
183   - autoOpen: false,
184   - height: 'auto',
185   - width: 'auto',
  182 + $('#load-data-dialog').default_dialog({
186 183 modal: true
187 184 });
188 185 $(document).on('click', '#magic-qualifiers .remove', remove_qualifier_row);
... ...
patterns/static/js/pattern-view.js
... ... @@ -64,7 +64,7 @@ $.extend(slickgrid, {
64 64 return {
65 65 sort_rules: slickgrid.loader.getSort(),
66 66 filter: slickgrid.loader.getFilter(),
67   - reader: $dj.reader
  67 + reader: edit.reader
68 68 };
69 69 }
70 70 });
71 71 \ No newline at end of file
... ...
patterns/views.py
... ... @@ -44,7 +44,6 @@ def pattern_view(request):
44 44 vocabs.update(dict((str(q.pk), v.id) for q in v.qualifiers.all()))
45 45 js_vars = common_pattern_js_vars(request)
46 46 js_vars.update({
47   - 'reader': False,
48 47 'ajax_edit_form': reverse('pattern_edit_form'),
49 48 'ajax_update_pattern': reverse('update_pattern'),
50 49 'ajax_new_ending_row': reverse('new_ending_row'),
... ... @@ -63,7 +62,6 @@ def pattern_view(request):
63 62 def pattern_reader_view(request):
64 63 js_vars = common_pattern_js_vars(request, reader=True)
65 64 js_vars.update({
66   - 'reader': True,
67 65 'auto_search': True,
68 66 'vocabs': {},
69 67 })
... ...