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