Skip to content

[fix] Fixed re-ordering templates on device add page #434#829

Merged
nemesifier merged 3 commits into
masterfrom
issues/434-reorder-templates-device-add
Feb 14, 2024
Merged

[fix] Fixed re-ordering templates on device add page #434#829
nemesifier merged 3 commits into
masterfrom
issues/434-reorder-templates-device-add

Conversation

@pandafy

@pandafy pandafy commented Feb 6, 2024

Copy link
Copy Markdown
Member

Closes #434

@pandafy
pandafy force-pushed the issues/434-reorder-templates-device-add branch from 59ab2ad to cd31571 Compare February 6, 2024 14:19
@coveralls

coveralls commented Feb 6, 2024

Copy link
Copy Markdown

Coverage Status

coverage: 99.008%. first build
when pulling 36edf95 on issues/434-reorder-templates-device-add
into ca86ced on master.

@pandafy
pandafy force-pushed the issues/434-reorder-templates-device-add branch from cd31571 to e4806e8 Compare February 7, 2024 12:19

@nemesifier nemesifier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a corner case to handle: if adding device returns a validation error the bug shows up again.

If save is successful the chosen order doesn't seem to be retained, is that because of the bug being fixed in #830? Please double check. It was indeed caused by that issue, please rebase on the latest master.

@pandafy
pandafy force-pushed the issues/434-reorder-templates-device-add branch from df756ce to 36edf95 Compare February 13, 2024 11:11
Comment on lines +7 to +9
$(document).on('click', 'a.inline-deletelink', function () {
destroyHiddenSortableWidget($);
});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that the previous solution was not working when the config form was removed and then added back using the "add row" button.

This solution is also not ideal because it is listening for all .inline-deletelink elements. I had to choose this because inline.js in Django has event.preventDefault present in the click handler.

@nemesifier
nemesifier merged commit 87a301a into master Feb 14, 2024
@nemesifier
nemesifier deleted the issues/434-reorder-templates-device-add branch February 14, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Re-ordering templates in device add view

3 participants