Skip to content
Snippets Groups Projects
Commit f516db9d authored by PavelBegunkov's avatar PavelBegunkov Committed by Artem Konenko
Browse files

#80 add current semester id in js layer

parent 1be9165e
Branches
Tags
No related merge requests found
......@@ -6,6 +6,12 @@ var SitePath = g_SitePath;
// Далее юзаем глобальные переменные с префиксом "g"
var singleNumRegexp = /\w_(\d+)/;
var parseID = function($this) {
singleNumRegexp.lastIndex = 0;
return +singleNumRegexp.exec($this.attr('id'))[1];
};
// Common.js
$.postJSON = function (url, data, callback) {
return $.post(url, data, callback, 'json');
......
class Base {
static parseID($this) {
return +/\w_(\d+)/.exec($this.attr('id'))[1];
}
static parsePosition($this) {
let doubleNumReg = /[A-Za-z_]+(\d+)[A-Za-z_]+(\d+)/;
return doubleNumReg.exec($this.attr('id')).splice(1, 2);
......@@ -84,7 +80,7 @@ class RateInfo {
var jCurSubmoduleHead = this.$submodulesHead.children(`.col_${col}:first`);
var submodule = +jCurSubmoduleInfo.attr('id');
var student = Base.parseID($this.siblings('.studentCell'));
var student = parseID($this.siblings('.studentCell'));
var maxRate = +this.$submodulesMaxRate.children(`.col_${col}`).text();
// Проверяем допустимое значение (только для добора)
......
......@@ -253,7 +253,7 @@ $(function () {
// Ведомость в формате excel
$('body').on('click', '.downloadExcelStatement', function () {
var groupID = Base.parseID($(this));
var groupID = parseID($(this));
var $stageSelector = $('#stageSelector_' + groupID);
$.fileDownload(URLdir + 'handler/FileCreator/GenerateFinalForm', {
......
var getSemester;
$(function () {
let $semesters = $('.semesterSwitcher').first(),
$switch = $('#changeSemester'),
......@@ -12,4 +14,7 @@ $(function () {
id: e.target.id.split('-')[1]
}).done(_ => window.location.replace(URLdir));
});
});
\ No newline at end of file
getSemester = () => parseID($semesters);
});
......@@ -21,7 +21,7 @@
<i class="fa fa-angle-down"></i>
</a>
<div class="semesterSwitcherBtn">
<div class="semesterSwitcher" style="display: none;">
<div class="semesterSwitcher" id="semester_{{ User.SemesterID }}" style="display: none;">
<ul>
{% for i in SemesterList %}
<li><a href="#" id="S-{{ i.ID }}" class="switchSemester">{{ i.Num }} семестр {{ i.Year }}/{{ i.Year + 1 }}</a></li>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment