Skip to content

Commit

Permalink
fix for issue 446
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimocoder committed Jun 26, 2024
1 parent b8eabec commit fd43d2d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions resources/js/humhub.calendar.reminder.Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,30 @@ humhub.module('calendar.reminder.Form', function (module, require, $) {
Form.prototype.add = function(evt) {
var $triggerRow = evt.$trigger.closest('.row');
var $lastIndex = parseInt($triggerRow.attr('data-reminder-index'));
var $newRow = $triggerRow.clone().attr('data-reminder-index', ++$lastIndex);

$newRow.find('[name]').each(function() {
var name = $(this).attr('name').replace(/CalendarReminder\[[0-9]]/, 'CalendarReminder['+$lastIndex+']');
$(this).attr('name', name);
});
var $newRow = $triggerRow.clone()
.attr('data-reminder-index', $lastIndex + 1)
.find('[name]')
.each(function() {
$(this).attr('name', $(this).attr('name').replace(/CalendarReminder\[[0-9]]/, 'CalendarReminder[' + ($lastIndex + 1) + ']'));
})
.end()
.find('select')
.each(function() {
var currentId = $(this).attr('id');
var newId = currentId.replace(/\d+/, $lastIndex + 1);
$(this).attr({'id': newId});
})
.end()
.find('span')
.remove()
.end();

$newRow.insertAfter($triggerRow);

evt.$trigger.data('action-click', 'delete')
$newRow.find('select').select2();

evt.$trigger
.data('action-click', 'delete')
.removeClass('btn-primary')
.addClass('btn-danger')
.find('i')
Expand Down
Binary file modified resources/js/humhub.calendar.reminder.Form.min.js
Binary file not shown.

0 comments on commit fd43d2d

Please sign in to comment.