##// END OF EJS Templates
Added hooks managment into application settings
marcink -
r395:e8af467b default
parent child Browse files
Show More
@@ -156,8 +156,23 b' class SettingsController(BaseController)'
156 .filter(HgAppUi.ui_key == '/').one()
156 .filter(HgAppUi.ui_key == '/').one()
157 hgsettings2.ui_value = form_result['paths_root_path']
157 hgsettings2.ui_value = form_result['paths_root_path']
158
158
159
160 #HOOKS
161 hgsettings3 = self.sa.query(HgAppUi)\
162 .filter(HgAppUi.ui_key == 'changegroup.update').one()
163 hgsettings3.ui_active = bool(form_result['hooks_changegroup_update'])
164
165 hgsettings4 = self.sa.query(HgAppUi)\
166 .filter(HgAppUi.ui_key == 'changegroup.repo_size').one()
167 hgsettings4.ui_active = bool(form_result['hooks_changegroup_repo_size'])
168
169
170
171
159 self.sa.add(hgsettings1)
172 self.sa.add(hgsettings1)
160 self.sa.add(hgsettings2)
173 self.sa.add(hgsettings2)
174 self.sa.add(hgsettings3)
175 self.sa.add(hgsettings4)
161 self.sa.commit()
176 self.sa.commit()
162
177
163 h.flash(_('Updated application settings'),
178 h.flash(_('Updated application settings'),
@@ -123,8 +123,18 b' def get_hg_ui_settings():'
123 raise Exception('Could not get application ui settings !')
123 raise Exception('Could not get application ui settings !')
124 settings = {}
124 settings = {}
125 for each in ret:
125 for each in ret:
126 k = each.ui_key if each.ui_key != '/' else 'root_path'
126 k = each.ui_key
127 settings[each.ui_section + '_' + k] = each.ui_value
127 v = each.ui_value
128 if k == '/':
129 k = 'root_path'
130
131 if k.find('.') != -1:
132 k = k.replace('.', '_')
133
134 if each.ui_section == 'hooks':
135 v = each.ui_active
136
137 settings[each.ui_section + '_' + k] = v
128
138
129 return settings
139 return settings
130
140
@@ -323,6 +323,8 b' def ApplicationUiSettingsForm():'
323 filter_extra_fields = False
323 filter_extra_fields = False
324 web_push_ssl = OneOf(['true', 'false'], if_missing='false')
324 web_push_ssl = OneOf(['true', 'false'], if_missing='false')
325 paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=3, not_empty=True))
325 paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=3, not_empty=True))
326 hooks_changegroup_update = OneOf(['True', 'False'], if_missing=False)
327 hooks_changegroup_repo_size = OneOf(['True', 'False'], if_missing=False)
326
328
327 return _ApplicationUiSettingsForm
329 return _ApplicationUiSettingsForm
328
330
@@ -89,7 +89,7 b''
89
89
90 <div class="field">
90 <div class="field">
91 <div class="label label-checkbox">
91 <div class="label label-checkbox">
92 <label for="web_push_ssl">${_('Push ssl')}:</label>
92 <label for="web_push_ssl">${_('Web')}:</label>
93 </div>
93 </div>
94 <div class="checkboxes">
94 <div class="checkboxes">
95 <div class="checkbox">
95 <div class="checkbox">
@@ -98,13 +98,29 b''
98 </div>
98 </div>
99 </div>
99 </div>
100 </div>
100 </div>
101
102 <div class="field">
103 <div class="label label-checkbox">
104 <label for="web_push_ssl">${_('Hooks')}:</label>
105 </div>
106 <div class="checkboxes">
107 <div class="checkbox">
108 ${h.checkbox('hooks_changegroup_update','True')}
109 <label for="hooks_changegroup_update">${_('Update repository after push (hg update)')}</label>
110 </div>
111 <div class="checkbox">
112 ${h.checkbox('hooks_changegroup_repo_size','True')}
113 <label for="hooks_changegroup_repo_size">${_('Show repository size after push')}</label>
114 </div>
115 </div>
116 </div>
101
117
102 <div class="field">
118 <div class="field">
103 <div class="label">
119 <div class="label">
104 <label for="paths_root_path">${_('Repositories location')}:</label>
120 <label for="paths_root_path">${_('Repositories location')}:</label>
105 </div>
121 </div>
106 <div class="input">
122 <div class="input">
107 ${h.text('paths_root_path',size=30,disabled="disabled")}
123 ${h.text('paths_root_path',size=30,readonly="readonly")}
108 <span id="path_unlock" class="tooltip" tooltip_title="${h.tooltip(_('This a crucial application setting. If You really sure you need to change this, you must restart application in order to make this settings take effect. Click this label to unlock.'))}">
124 <span id="path_unlock" class="tooltip" tooltip_title="${h.tooltip(_('This a crucial application setting. If You really sure you need to change this, you must restart application in order to make this settings take effect. Click this label to unlock.'))}">
109 ${_('unlock')}</span>
125 ${_('unlock')}</span>
110 </div>
126 </div>
@@ -120,7 +136,7 b''
120 <script type="text/javascript">
136 <script type="text/javascript">
121 YAHOO.util.Event.onDOMReady(function(){
137 YAHOO.util.Event.onDOMReady(function(){
122 YAHOO.util.Event.addListener('path_unlock','click',function(){
138 YAHOO.util.Event.addListener('path_unlock','click',function(){
123 YAHOO.util.Dom.get('paths_root_path').disabled=false;
139 YAHOO.util.Dom.get('paths_root_path').readonly=false;
124 });
140 });
125 });
141 });
126 </script>
142 </script>
General Comments 0
You need to be logged in to leave comments. Login now