Commit 5db596b49f48e2f158e97352473192d2985e2006
1 parent
edc2add5
fix
Showing
3 changed files
with
19 additions
and
9 deletions
entries/static/entries/js/entries.js
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | //TODO clear those to null on new entry to make sure |
4 | 4 | var curr_entry = null; |
5 | +var curr_no_filters = null; | |
5 | 6 | var curr_alternations = null; |
6 | 7 | var curr_realisation_phrases = null; |
7 | 8 | var curr_realisation_descriptions = null; |
... | ... | @@ -798,6 +799,7 @@ function get_entry(entry_id, related) { |
798 | 799 | timeout : 60000, |
799 | 800 | success : function(response) { |
800 | 801 | curr_entry = entry_id; |
802 | + curr_no_filters = related; | |
801 | 803 | clear_info(); |
802 | 804 | curr_alternations = response.alternations; |
803 | 805 | curr_realisation_phrases = response.realisation_phrases; |
... | ... | @@ -843,7 +845,8 @@ function bind_last_visited() { |
843 | 845 | var selected_entry = $(this).data('entry'); |
844 | 846 | if (selected_entry !== curr_entry) { |
845 | 847 | $('.entry[data-entry="' + curr_entry + '"]').removeClass('table-primary'); |
846 | - get_entry(selected_entry); | |
848 | + // TODO? don’t apply current filters to last visited | |
849 | + get_entry(selected_entry, true); | |
847 | 850 | } |
848 | 851 | }); |
849 | 852 | } |
... | ... | @@ -1000,6 +1003,13 @@ function clear_results() { |
1000 | 1003 | } |
1001 | 1004 | |
1002 | 1005 | function clear_entry() { |
1006 | + curr_entry = null; | |
1007 | + curr_no_filters = null; | |
1008 | + curr_alternations = null; | |
1009 | + curr_realisation_phrases = null; | |
1010 | + curr_realisation_descriptions = null; | |
1011 | + curr_examples = null; | |
1012 | + curr_examples_by_id = null; | |
1003 | 1013 | $('#syntax-schemata').empty(); |
1004 | 1014 | $('#syntax-examples-list').empty(); |
1005 | 1015 | $('#syntax-examples').hide(); |
... | ... | @@ -1097,11 +1107,11 @@ $(document).ready(function() { |
1097 | 1107 | initialize_entries_list(); |
1098 | 1108 | |
1099 | 1109 | $('#id_filter_schema_').change(function() { |
1100 | - get_entry(curr_entry); | |
1110 | + get_entry(curr_entry, curr_no_filters); | |
1101 | 1111 | }); |
1102 | 1112 | |
1103 | 1113 | $('#id_filter_frame_').change(function() { |
1104 | - get_entry(curr_entry); | |
1114 | + get_entry(curr_entry, curr_no_filters); | |
1105 | 1115 | }); |
1106 | 1116 | |
1107 | 1117 | initialize_main_form(); |
... | ... |
entries/static/entries/js/forms.js
... | ... | @@ -476,7 +476,7 @@ function initialize_local_form(selector, url) { |
476 | 476 | if (response.errors) { |
477 | 477 | show_form_errors(form, response.errors); |
478 | 478 | } else if (response.success) { |
479 | - get_entry(curr_entry); | |
479 | + get_entry(curr_entry, curr_no_filters); | |
480 | 480 | selector.modal('hide'); |
481 | 481 | } |
482 | 482 | submit.prop('disabled', false); |
... | ... |
entries/views.py
... | ... | @@ -684,9 +684,9 @@ def get_entry(request): |
684 | 684 | assert(not errors_dict) |
685 | 685 | |
686 | 686 | # dont’ do schema/frame filtering for related entries |
687 | - FILTERING_OK = not simplejson.loads(request.POST['no_filters']) | |
688 | - filter_schemata = FILTERING_OK and entry_form.cleaned_data['filter_schemata'] | |
689 | - filter_frames = FILTERING_OK and entry_form.cleaned_data['filter_frames'] | |
687 | + apply_filters = not simplejson.loads(request.POST['no_filters']) | |
688 | + filter_schemata = apply_filters and entry_form.cleaned_data['filter_schemata'] | |
689 | + filter_frames = apply_filters and entry_form.cleaned_data['filter_frames'] | |
690 | 690 | if filter_schemata: |
691 | 691 | schema_forms = [] |
692 | 692 | # e.g. entry has schema that satisfies X & entry has schema that satisfies Y |
... | ... | @@ -727,14 +727,14 @@ def get_entry(request): |
727 | 727 | |
728 | 728 | |
729 | 729 | local_schema_form = None |
730 | - if FILTERING_OK and 'schema_form' in request.session: | |
730 | + if apply_filters and 'schema_form' in request.session: | |
731 | 731 | errors_dict = dict() |
732 | 732 | local_schema_form = collect_forms(request.session['schema_form'], errors_dict) |
733 | 733 | print(local_schema_form) |
734 | 734 | assert(not errors_dict) |
735 | 735 | |
736 | 736 | local_frame_form = None |
737 | - if FILTERING_OK and 'frame_form' in request.session: | |
737 | + if apply_filters and 'frame_form' in request.session: | |
738 | 738 | errors_dict = dict() |
739 | 739 | local_frame_form = collect_forms(request.session['frame_form'], errors_dict) |
740 | 740 | assert(not errors_dict) |
... | ... |