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