view rhodecode/templates/base/default_perms_box.html @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents 87e6960e250b
children
line wrap: on
line source

## snippet for displaying default permission box
## usage:
##    <%namespace name="dpb" file="/base/default_perms_box.html"/>
##    ${dpb.default_perms_box(<url_to_form>)}


<%def name="default_perms_box(form_url)">
${h.form(form_url, method='put')}
    <div class="form">
        <!-- fields -->
        <div class="fields">
             <div class="field">
                <div class="label label-checkbox">
                    <label for="inherit_default_permissions">${_('Inherit from defaults')}:</label>
                </div>
                <div class="checkboxes">
                    ${h.checkbox('inherit_default_permissions',value=True)}
                    <span class="help-block">
                    ${h.literal(_('Select to inherit permissions from %s permissions settings, and default IP address whitelist.')
                                % h.link_to('default global', url('admin_permissions')))}
                    </span>
                </div>
             </div>

             <div id="inherit_overlay">
             <div class="field">
                <div class="label label-checkbox">
                    <label for="create_repo_perm">${_('Create repositories')}:</label>
                </div>
                <div class="checkboxes">
                    ${h.checkbox('create_repo_perm',value=True)}
                    <span class="help-block">
                    ${h.literal(_('Select this option to allow repository creation for this user'))}
                    </span>
                </div>
             </div>

             <div class="field">
                <div class="label label-checkbox">
                    <label for="create_user_group_perm">${_('Create user groups')}:</label>
                </div>
                <div class="checkboxes">
                    ${h.checkbox('create_user_group_perm',value=True)}
                    <span class="help-block">
                        ${h.literal(_('Select this option to allow user group creation for this user'))}
                    </span>
                </div>
             </div>

             <div class="field">
                <div class="label label-checkbox">
                    <label for="fork_repo_perm">${_('Fork repositories')}:</label>
                </div>
                <div class="checkboxes">
                    ${h.checkbox('fork_repo_perm',value=True)}
                    <span class="help-block">
                        ${h.literal(_('Select this option to allow repository forking for this user'))}
                    </span>
                </div>
             </div>

            </div>
            <div class="buttons">
              ${h.submit('save',_('Save'),class_="btn")}
              ${h.reset('reset',_('Reset'),class_="btn")}
            </div>
        </div>
    </div>
${h.end_form()}

## JS
<script>
YUE.onDOMReady(function(e){

    var show_custom_perms = function(inherit_default){
        if(inherit_default){
            YUD.setStyle('inherit_overlay', 'display', 'none');
        }
        else{
            YUD.setStyle('inherit_overlay', 'display', '');
        }
    }

    var defaults = YUD.get('inherit_default_permissions').checked;
    show_custom_perms(defaults);
    YUE.on('inherit_default_permissions', 'change', function(e){
        if(YUD.get('inherit_default_permissions').checked){
            show_custom_perms(true);
        }
        else{
            show_custom_perms(false);
        }
    })
})
</script>

</%def>