|
118 | 118 | var ENABLE_UNRESTRICTED_ANNOTATION = true; |
119 | 119 |
|
120 | 120 | var scalarSliderEnabled = {{ scalar_slider|yesno:"true,false" }}; |
| 121 | +var scale100 = {{ scale_100|yesno:"true,false" }}; |
121 | 122 | var scalarSliderOptions = { |
122 | 123 | enabled: scalarSliderEnabled, |
123 | | - valueCount: 10, |
124 | | - min: 0, |
125 | | - max: 100 |
| 124 | + valueCount: scale100 ? 101 : 10, |
| 125 | + min: scale100 ? 0 : 0, |
| 126 | + max: scale100 ? 100 : 100 |
126 | 127 | }; |
127 | 128 | var scalarSliderRegistry = {}; |
128 | 129 | var collectBrowserInfo = {{ collect_browser_info|yesno:"true,false" }}; |
|
688 | 689 | var score = item_box.find('input[name="score"]').val(); |
689 | 690 | var index = item_box.data('item-id'); |
690 | 691 | if (score == -1) { |
691 | | - alert('Sentence #' + (index + 1) + ' has no score. ' + |
| 692 | + _show_error_box(item_box, 'Sentence #' + (index + 1) + ' has no score. ' + |
692 | 693 | 'Please score all candidate sentences. Thanks!'); |
693 | 694 | return false; |
694 | 695 | } |
|
807 | 808 | var score = item_box.find('input[name="score"]').val(); |
808 | 809 | var index = item_box.data('item-id'); |
809 | 810 | if (score == -1) { |
810 | | - alert('Please score the document translation. Thanks!'); |
| 811 | + _show_error_box(item_box, 'Please score the document translation. Thanks!'); |
811 | 812 | return false; |
812 | 813 | } |
813 | 814 | // It is a security check, but this should never occur, because the last |
814 | 815 | // item is disabled if there is at least one sentence that is not scored |
815 | 816 | if (!_all_sentences_scored()) { |
816 | | - alert('Please score all sentences from the document first. Thanks!'); |
| 817 | + _show_error_box(item_box, 'Please score all sentences from the document first. Thanks!'); |
817 | 818 | return false; |
818 | 819 | } |
819 | 820 | // Add end timestamp |
|
882 | 883 | } |
883 | 884 |
|
884 | 885 | function _show_error_box(item_box, msg) { |
| 886 | + // Remove any existing error boxes to prevent stacking |
| 887 | + $('.alert-danger.alert-dismissible.appraise-error').remove(); |
885 | 888 | // A hideable error box with a custom message displayed right above the item box |
886 | | - item_box.before( |
887 | | - '<div class="alert alert-danger alert-dismissible" role="alert">' + |
| 889 | + var $box = $( |
| 890 | + '<div class="alert alert-danger alert-dismissible appraise-error" role="alert">' + |
888 | 891 | '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' + |
889 | 892 | '<span aria-hidden="true">×</span>' + |
890 | 893 | '</button>Oops... ' + msg + '</div>' |
891 | 894 | ); |
| 895 | + item_box.before($box); |
| 896 | + // Auto-fade after 3 seconds |
| 897 | + setTimeout(function() { $box.fadeOut(700, function() { $box.remove(); }); }, 3000); |
892 | 898 | } |
893 | 899 |
|
894 | 900 | function _has_single_sentence_document() { |
|
1173 | 1179 |
|
1174 | 1180 | <div class="col-sm-10"> |
1175 | 1181 | {% if scalar_slider %} |
1176 | | - {% with sliderid=item.itemID mono=monolingual %} |
| 1182 | + {% with sliderid=item.itemID mono=monolingual scale_100=scale_100 %} |
1177 | 1183 | {% include 'EvalView/_scalar_slider.html' %} |
1178 | 1184 | {% endwith %} |
1179 | 1185 | {% elif sqm %} |
|
1223 | 1229 | <div class="row"> |
1224 | 1230 | <div class="col-sm-12"> |
1225 | 1231 | {% if scalar_slider %} |
1226 | | - {% with sliderid=item.itemID mono=monolingual %} |
| 1232 | + {% with sliderid=item.itemID mono=monolingual scale_100=scale_100 %} |
1227 | 1233 | {% include 'EvalView/_scalar_slider.html' %} |
1228 | 1234 | {% endwith %} |
1229 | 1235 | {% elif sqm %} |
|
0 commit comments