|
23 | 23 | this.optionsForm = document.querySelector('form'); |
24 | 24 | this.submitButtonInOptionsForm = this.optionsForm.querySelector('button[type="submit"]'); |
25 | 25 |
|
26 | | - this.enableButtonsToCopySourceAndTargetBranchesNameCheckbox = document.querySelector('input#enable_buttons_to_copy_source_and_target_branches_name'); |
27 | 26 | this.displaySourceTargetBranchesOptionsDiv = document.querySelector('div#display-source-target-branches-options'); |
| 27 | + this.displaySourceAndTargetBranchesCheckbox = document.querySelector('input#display_source_and_target_branches'); |
| 28 | + this.enableButtonsToCopySourceAndTargetBranchesNameCheckbox = document.querySelector('input#enable_buttons_to_copy_source_and_target_branches_name'); |
28 | 29 |
|
29 | 30 | this.copyMrInfoOptionsDiv = document.querySelector('div#copy-mr-info-options'); |
30 | 31 | this.enableButtonToCopyMrInfoCheckbox = document.querySelector('input#enable_button_to_copy_mr_info'); |
|
45 | 46 | let self = this; |
46 | 47 |
|
47 | 48 | this.preferencesManager.getAll(function(preferences) { |
| 49 | + self.displaySourceAndTargetBranchesCheckbox.checked = preferences.display_source_and_target_branches; |
| 50 | + self.displaySourceAndTargetBranchesCheckbox.dispatchEvent(new CustomEvent('change')); |
| 51 | + |
48 | 52 | self.enableButtonsToCopySourceAndTargetBranchesNameCheckbox.checked = preferences.enable_buttons_to_copy_source_and_target_branches_name; |
49 | 53 |
|
50 | 54 | self.enableButtonToCopyMrInfoCheckbox.checked = preferences.enable_button_to_copy_mr_info; |
|
81 | 85 | self.saveOptionsToStorage(); |
82 | 86 | }); |
83 | 87 |
|
| 88 | + this.displaySourceAndTargetBranchesCheckbox.addEventListener('change', function() { |
| 89 | + self.displaySourceTargetBranchesOptionsDiv.classList.toggle('is-hidden', !this.checked); |
| 90 | + }); |
| 91 | + |
84 | 92 | this.enableButtonToCopyMrInfoCheckbox.addEventListener('change', function() { |
85 | 93 | self.copyMrInfoOptionsDiv.classList.toggle('is-hidden', !this.checked); |
86 | 94 | self.copyMrInfoFormatTextarea.toggleAttribute('required', this.checked); |
|
108 | 116 |
|
109 | 117 | this.preferencesManager.setAll( |
110 | 118 | { |
| 119 | + display_source_and_target_branches: this.displaySourceAndTargetBranchesCheckbox.checked, |
111 | 120 | enable_buttons_to_copy_source_and_target_branches_name: this.enableButtonsToCopySourceAndTargetBranchesNameCheckbox.checked, |
112 | 121 | enable_button_to_copy_mr_info: this.enableButtonToCopyMrInfoCheckbox.checked, |
113 | 122 | copy_mr_info_format: this.copyMrInfoFormatTextarea.value, |
|
0 commit comments