|
11 | 11 | var $responseModal = $('#response-modal'); |
12 | 12 | var $responseModalTitle = $responseModal.find('#response-title'); |
13 | 13 | var $responseModalBody = $responseModal.find('#response-body'); |
14 | | - var $settingsModal = $('#settings-modal'); |
| 14 | + |
15 | 15 |
|
16 | 16 | $responseModal.on('hide.bs.modal', function(e) { |
17 | 17 | $responseModalBody.html(''); |
|
25 | 25 | vm.openAfterCheckingOut = true; |
26 | 26 | vm.testGit = testGit; |
27 | 27 | vm.getRepoTitle = getRepoTitle; |
28 | | - vm.viewSettingsModal = viewSettingsModal; |
29 | | - |
30 | | - vm.saveGitExecutablePath = saveGitExecutablePath; |
31 | 28 |
|
32 | 29 | WebgitHomeService.getClonedRepos().then(function(data) { |
33 | 30 | var allRepos = data.allRepos; |
34 | 31 | vm.clonedRepos = allRepos; |
35 | 32 | }); |
36 | | - |
37 | | - resetSettings(); |
38 | | - bindEvents(); |
39 | | - |
| 33 | + |
40 | 34 | return; |
41 | 35 |
|
42 | | - function resetSettings() { |
43 | | - vm.settings = { |
44 | | - gitExists: {} |
45 | | - }; |
46 | | - } |
47 | | - |
48 | | - function saveGitExecutablePath() { |
49 | | - // save vm.settings.gitExists to local storage. rescan for settings. |
50 | | - localStorage.setItem('gitonbrowser.gitPath', vm.settings.gitExists.path); |
51 | | - validateSettings(); |
52 | | - } |
53 | | - |
54 | | - function bindEvents() { |
55 | | - $('.settings-obj').on('click', '.fix-this-error', function(e) { |
56 | | - var $settingsObj = $(e.delegateTarget); |
57 | | - $settingsObj.find('.settings-obj-fix').toggleClass('hidden'); |
58 | | - }); |
59 | | - } |
60 | | - |
61 | | - function viewSettingsModal() { |
62 | | - $settingsModal.modal('show'); |
63 | | - return validateSettings(); |
64 | | - } |
65 | | - |
66 | | - function validateSettings() { |
67 | | - resetSettings(); |
68 | | - var options = {}; |
69 | | - var gitExecutablePath = localStorage.getItem('gitonbrowser.gitPath'); |
70 | | - if(gitExecutablePath) { |
71 | | - options.gitExecutablePath = gitExecutablePath; |
72 | | - } |
73 | | - return WebgitHomeService.getSettings(options).then(function(d) { |
74 | | - if(d.errorCode) { |
75 | | - switch(d.errorCode) { |
76 | | - case 1: { |
77 | | - // git not found. |
78 | | - vm.settings.gitExists.err = 1; |
79 | | - vm.settings.gitExists.msg = d.msg; |
80 | | - vm.settings.gitExists.description = d.description; |
81 | | - break; |
82 | | - } |
83 | | - } |
84 | | - } |
85 | | - }); |
86 | | - } |
87 | | - |
88 | 36 | function getRepoTitle(path) { |
89 | 37 | return utils.decodePath(path); |
90 | 38 | } |
|
130 | 78 | this.browseRepo = browseRepo; |
131 | 79 | this.clone = clone; |
132 | 80 | this.testGit = testGit; |
133 | | - this.getSettings = getSettings; |
| 81 | + |
134 | 82 |
|
135 | 83 | return; |
136 | 84 |
|
137 | | - function getSettings(options) { |
138 | | - return $http.post('/settings', options).then(function(res) { |
139 | | - return res.data; |
140 | | - }); |
141 | | - } |
142 | | - |
143 | 85 | function clone(pathOfRepo, pathOfDestination, subdirName) { |
144 | 86 | return $http.post('/clonerepo', { |
145 | 87 | url: window.encodeURIComponent(pathOfRepo), |
|
0 commit comments