diff --git a/~dev_rating/media/js/discipline/general.js b/~dev_rating/media/js/discipline/general.js index 589444dc989be15408e0265b09859023640a656b..0418f70db0622c3dfc02f712515a2a5422164eca 100644 --- a/~dev_rating/media/js/discipline/general.js +++ b/~dev_rating/media/js/discipline/general.js @@ -11,29 +11,34 @@ $(function() { // Получить список в память function GetSubjectsList() { - var g_facultyID = 0; var optionVal = parseInt($("select.SelectFaculty").children("option:selected").val()); if (optionVal <= 0) return; - - var g_facultyID = optionVal; + + selectSubject.attr("disabled", true); $.post( g_URLdir + "handler/map/GetSubjectsList", { - "FacultyID": g_facultyID + "FacultyID": optionVal }, function(data) { selectSubject.select2("val", ""); - selectSubject.attr("disabled", true); data = (data !== "") ? $.parseJSON(data) : {}; var jProto = $($.parseHTML("<option></option>")); selectSubject.html(""); - + + selectSubject.append($.parseHTML("<option></option>")); $.each(data, function (key, cur) { jProto.html(cur.Title).val(cur.ID); selectSubject.append(jProto.clone()); - }); + }); + } + ).always( + function(success) + { + if (selectSubject.children().first().is(":selected")) + selectSubject.select2({placeholder: "Выберите предмет", allowClear: true}); selectSubject.removeAttr("disabled"); } ); diff --git a/~dev_rating/media/js/select2.js b/~dev_rating/media/js/select2.js index 7590b82295325b277441528766d83e9010f00c27..6e5fe0ba49fcc8eb5674a32bfa0d6b40c61b8ca3 100644 --- a/~dev_rating/media/js/select2.js +++ b/~dev_rating/media/js/select2.js @@ -3509,7 +3509,18 @@ the specific language governing permissions and limitations under the Apache Lic formatSearching: function () { return "Searching…"; } }; - $.extend($.fn.select2.defaults, $.fn.select2.locales['en']); + $.fn.select2.locales['ru'] = { + formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; }, + formatNoMatches: function () { return "Совпадений не найдено"; }, + formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Загрузка прервалась"; }, + formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); }, + formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); }, + formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); }, + formatLoadMore: function (pageNumber) { return "Загрузка…"; }, + formatSearching: function () { return "Поиск…"; } + }; + + $.extend($.fn.select2.defaults, $.fn.select2.locales['ru']); $.fn.select2.ajaxDefaults = { transport: $.ajax,