Skip to content
Snippets Groups Projects
Commit 1b9b830c authored by Антон Шалимов's avatar Антон Шалимов
Browse files

fix double click (add module and submodule)

parent 6277b24d
Branches
Tags
No related merge requests found
......@@ -54,7 +54,7 @@
{% endfor %}
</div>
{% if Discipline.isLocked != 1 %}
<div class="addSubModule">Добавить мероприятие</div>
<button class="addSubModule">Добавить мероприятие</button>
{% endif %}
</div>
{% endif %}
......@@ -81,6 +81,6 @@
{% endfor %}
</div>
{% if Discipline.isLocked != 1 %}
<div class="addModule">Добавить модуль</div>
<button class="addModule">Добавить модуль</button>
{% endif %}
{% endblock %}
......@@ -273,6 +273,7 @@
/* Кнопка добавления модуля */
.addModule {
width: 100%;
background-color: #CDE8FD;
padding: 8px 10px;
text-align: center;
......
......@@ -38,7 +38,7 @@ $(function() {
<div class="subModules">\
'+ GetSubModuleTmp() +'\
</div>\
<div class="addSubModule">Добавить мероприятие</div>\
<button class="addSubModule">Добавить мероприятие</button>\
</div>'
};
......@@ -255,6 +255,8 @@ $(function() {
// Добавить модуль
$('.addModule').click(function(){
var thisObj = $(this);
$(this).attr("disabled", true);
var OrderNum = $('div.moduleGroup', 'div.moduleList').last().index('.moduleGroup') + 2;
$.post(
URLdir + 'handler/map/AddModule',
......@@ -282,6 +284,7 @@ $(function() {
thisModuleDIV.children('div.subModules').children('div.subModule').eq(0).attr('id', data.SubmoduleID);
EventInspector_ShowMsg('Модуль добавлен', 'success');
} else EventInspector_ShowMsg('Ошибка при добавление модуля', 'error');
thisObj.removeAttr('disabled');
}
);
......@@ -291,7 +294,9 @@ $(function() {
});
// Добавить мероприятие
$('.moduleList').on('click', '.addSubModule', function(){
$('div.moduleList').on('click', 'button.addSubModule', function(){
var thisObj = $(this);
$(this).attr("disabled", true);
var ModuleID = $(this).parent().attr('id');
var SubmodulesDIV = $(this).siblings('div.subModules');
var OrderNum = SubmodulesDIV.children('div.subModule').last().index() + 2;
......@@ -308,6 +313,7 @@ $(function() {
SubmodulesDIV.children('div.subModule').eq(OrderNum - 1).attr('id', data.SubmoduleID);
EventInspector_ShowMsg('Мероприятие добавлено', 'success');
} else EventInspector_ShowMsg('Ошибка при добавление мероприятия', 'error');
thisObj.removeAttr('disabled');
}
);
});
......
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