Changeset - e8af467b5a60
[Not reviewed]
default
0 4 0
Marcin Kuzminski - 15 years ago 2010-08-06 02:40:57
marcin@python-works.com
Added hooks managment into application settings
4 files changed with 48 insertions and 5 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/admin/settings.py
Show inline comments
 
@@ -156,8 +156,23 @@ class SettingsController(BaseController)
 
                    .filter(HgAppUi.ui_key == '/').one()
 
                    hgsettings2.ui_value = form_result['paths_root_path']                    
 
                    
 
                    
 
                    #HOOKS
 
                    hgsettings3 = self.sa.query(HgAppUi)\
 
                    .filter(HgAppUi.ui_key == 'changegroup.update').one()
 
                    hgsettings3.ui_active = bool(form_result['hooks_changegroup_update'])  
 
                    
 
                    hgsettings4 = self.sa.query(HgAppUi)\
 
                    .filter(HgAppUi.ui_key == 'changegroup.repo_size').one()
 
                    hgsettings4.ui_active = bool(form_result['hooks_changegroup_repo_size'])                                          
 
                    
 
                    
 
                    
 
                    
 
                    self.sa.add(hgsettings1)
 
                    self.sa.add(hgsettings2)
 
                    self.sa.add(hgsettings3)
 
                    self.sa.add(hgsettings4)
 
                    self.sa.commit()
 
                    
 
                    h.flash(_('Updated application settings'),
pylons_app/lib/utils.py
Show inline comments
 
@@ -123,8 +123,18 @@ def get_hg_ui_settings():
 
        raise Exception('Could not get application ui settings !')
 
    settings = {}
 
    for each in ret:
 
        k = each.ui_key if each.ui_key != '/' else 'root_path'
 
        settings[each.ui_section + '_' + k] = each.ui_value    
 
        k = each.ui_key
 
        v = each.ui_value
 
        if k == '/':
 
            k = 'root_path'
 
        
 
        if k.find('.') != -1:
 
            k = k.replace('.', '_')
 
        
 
        if each.ui_section == 'hooks':
 
            v = each.ui_active
 
        
 
        settings[each.ui_section + '_' + k] = v  
 
    
 
    return settings
 

	
pylons_app/model/forms.py
Show inline comments
 
@@ -323,6 +323,8 @@ def ApplicationUiSettingsForm():
 
        filter_extra_fields = False
 
        web_push_ssl = OneOf(['true', 'false'], if_missing='false')
 
        paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=3, not_empty=True))
 
        hooks_changegroup_update = OneOf(['True', 'False'], if_missing=False)
 
        hooks_changegroup_repo_size = OneOf(['True', 'False'], if_missing=False)
 
        
 
    return _ApplicationUiSettingsForm
 

	
pylons_app/templates/admin/settings/settings.html
Show inline comments
 
@@ -89,7 +89,7 @@
 
             
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label for="web_push_ssl">${_('Push ssl')}:</label>
 
                    <label for="web_push_ssl">${_('Web')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
					<div class="checkbox">
 
@@ -100,11 +100,27 @@
 
             </div>						
 
							                          
 
            <div class="field">
 
                <div class="label label-checkbox">
 
                    <label for="web_push_ssl">${_('Hooks')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
					<div class="checkbox">
 
						${h.checkbox('hooks_changegroup_update','True')}
 
						<label for="hooks_changegroup_update">${_('Update repository after push (hg update)')}</label>
 
					</div>
 
					<div class="checkbox">
 
						${h.checkbox('hooks_changegroup_repo_size','True')}
 
						<label for="hooks_changegroup_repo_size">${_('Show repository size after push')}</label>
 
					</div>					
 
				</div>
 
             </div>	
 
							                          
 
            <div class="field">
 
                <div class="label">
 
                    <label for="paths_root_path">${_('Repositories location')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('paths_root_path',size=30,disabled="disabled")}
 
                    ${h.text('paths_root_path',size=30,readonly="readonly")}
 
					<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.'))}">
 
		                ${_('unlock')}</span>
 
                </div>
 
@@ -120,7 +136,7 @@
 
    <script type="text/javascript">
 
        YAHOO.util.Event.onDOMReady(function(){
 
            YAHOO.util.Event.addListener('path_unlock','click',function(){
 
                YAHOO.util.Dom.get('paths_root_path').disabled=false;
 
                YAHOO.util.Dom.get('paths_root_path').readonly=false;
 
            });
 
        });
 
    </script>
0 comments (0 inline, 0 general)