|
373 | 373 | </script>
|
374 | 374 |
|
375 | 375 | <script type="text/x-handlebars-template" id="switchData">
|
376 |
| - <div id="id_{{key}}" class="switch" data-switch-key="{{key}}" data-switch-label="{{label}}" data-switch-description="{{description}}" data-switch-status="{{status}}"> |
| 376 | + <div id="id_{{key}}" class="switch" data-switch-key="{{key}}" data-switch-label="{{label}}" data-switch-description="{{description}}" data-switch-status="{{status}}" style="order:{{ cssOrder }}"> |
377 | 377 | <div class="status">
|
378 | 378 | <label for="status_{{key}}">Status</label>
|
379 | 379 | <select name="status_{{key}}">
|
|
724 | 724 | $('.switches', $sb).on('submit', '.conditions-form form', function(e) {
|
725 | 725 | e.preventDefault();
|
726 | 726 | var $form = $(this);
|
727 |
| -
|
| 727 | + var $switch = $form.parents('.switch:first'); |
728 | 728 | var data = {
|
729 |
| - key: $form.parents('.switch:first').attr('data-switch-key'), |
| 729 | + key: $switch.attr('data-switch-key'), |
730 | 730 | id: $form.attr('data-switch'),
|
731 | 731 | field: $form.attr('data-field')
|
732 | 732 | };
|
|
744 | 744 | });
|
745 | 745 |
|
746 | 746 | api(SWITCHBOARD.addCondition, data, function (swtch) {
|
| 747 | + swtch.cssOrder = $switch.css('order'); |
747 | 748 | var result = templates.switchData(swtch);
|
748 | 749 | $('.switches .switch[data-switch-key="' + data.key + '"]', $sb).replaceWith(result);
|
749 | 750 | });
|
|
753 | 754 | e.preventDefault();
|
754 | 755 |
|
755 | 756 | var $el = $(this).parents('span:first');
|
756 |
| -
|
| 757 | + var $switch = $el.parents('.switch:first'); |
757 | 758 | var data = {
|
758 |
| - key: $el.parents('.switch:first').attr('data-switch-key'), |
| 759 | + key: $switch.attr('data-switch-key'), |
759 | 760 | id: $el.attr('data-switch'),
|
760 | 761 | field: $el.attr('data-field'),
|
761 | 762 | value: $el.attr('data-value')
|
762 | 763 | };
|
763 | 764 |
|
764 | 765 | api(SWITCHBOARD.delCondition, data, function (swtch) {
|
| 766 | + swtch.cssOrder = $switch.css('order'); |
765 | 767 | var result = templates.switchData(swtch);
|
766 | 768 | $('.switches .switch[data-switch-key="' + data.key + '"]').replaceWith(result);
|
767 | 769 | });
|
|
814 | 816 | },
|
815 | 817 |
|
816 | 818 | function (swtch) {
|
| 819 | + swtch.cssOrder = -999999; |
817 | 820 | var result = templates.switchData(swtch);
|
818 | 821 |
|
819 | 822 | if (action === 'add') {
|
|
0 commit comments