Changeset - f9801165dc97
[Not reviewed]
stable
0 1 0
Thomas De Schampheleire - 6 years ago 2019-11-30 19:55:45
thomas.de_schampheleire@nokia.com
admin: fix 'Settings > Visual' form validation after commit 574218777086

Commit 574218777086 introduced a setting for 'SSH Clone URL' in 'Admin >
Settings > Visual' and placed it under a check 'if c.ssh_enabled', which
means that the corresponding form field is not present when SSH is not
enabled.
In this case, when trying to save the form (changing any or none setting),
form validation reports an error 'Missing value' without much detail. At the
top of the HTML document, even before the opening HTML tag, we can see:

<!-- for: clone_ssh_tmpl -->
<span class="error-message">Missing value</span><br />


Fix this problem by adding a hidden form field for clone_ssh_tmpl, with the
current value from the database, in case SSH is not enabled.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/admin/settings/settings_visual.html
Show inline comments
 
@@ -37,48 +37,50 @@ ${h.form(url('admin_settings_visual'), m
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label">${_('HTTP Clone URL')}:</label>
 
                <div>
 
                    ${h.text('clone_uri_tmpl', size=80, class_='form-control')}
 
                    <span class="help-block">${_('''Schema of clone URL construction eg. '{scheme}://{user}@{netloc}/{repo}'.
 
                                                    The following variables are available:
 
                                                    {scheme} 'http' or 'https' sent from running Kallithea server,
 
                                                    {user}   current user username,
 
                                                    {netloc} network location/server host of running Kallithea server,
 
                                                    {repo}   full repository name,
 
                                                    {repoid} ID of repository, can be used to construct clone-by-id,
 
                                                    {system_user}  name of the Kallithea system user,
 
                                                    {hostname}  server hostname
 
                                                    ''')}
 
                    </span>
 
                </div>
 
                %if c.ssh_enabled:
 
                <label class="control-label">${_('SSH Clone URL')}:</label>
 
                <div>
 
                    ${h.text('clone_ssh_tmpl', size=80, class_='form-control')}
 
                    <span class="help-block">${_('''Schema for constructing SSH clone URL, eg. 'ssh://{system_user}@{hostname}/{repo}'.''')}</span>
 
                </div>
 
                %else:
 
                ${h.hidden('clone_ssh_tmpl', size=80, class_='form-control')}
 
                %endif
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="dashboard_items">${_('Repository page size')}:</label>
 
                <div>
 
                    ${h.text('dashboard_items',size=5,class_='form-control')}
 
                    <span class="help-block">${_('Number of items displayed in the repository pages before pagination is shown.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label" for="admin_grid_items">${_('Admin page size')}:</label>
 
                <div>
 
                    ${h.text('admin_grid_items',size=5,class_='form-control')}
 
                    <span class="help-block">${_('Number of items displayed in the admin pages grids before pagination is shown.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="form-group">
 
                <label class="control-label">${_('Icons')}:</label>
 
                <div>
 
                    <div class="checkbox">
 
                        <label>
0 comments (0 inline, 0 general)