PageRenderTime 29ms CodeModel.GetById 24ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/templates/admin/user/user.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 83 lines | 78 code | 5 blank | 0 comment | 4 complexity | e77a41d6572a27025f7f467fe6f41362 MD5 | raw file
 1<%inherit file="/base.mako"/>
 2<%namespace file="/message.mako" import="render_msg" />
 3
 4<%def name="javascripts()">
 5    ${parent.javascripts()}
 6    <script type="text/javascript">
 7        $(function(){
 8            $("input:text:first").focus();
 9        })
10    </script>
11</%def>
12
13<%def name="render_select( name, options )">
14    <select name="${name}" id="${name}" style="min-width: 250px; height: 150px;" multiple>
15        %for option in options:
16            <option value="${option[0]}">${option[1]}</option>
17        %endfor
18    </select>
19</%def>
20
21<script type="text/javascript">
22$().ready(function() {  
23    $('#roles_add_button').click(function() {
24        return !$('#out_roles option:selected').remove().appendTo('#in_roles');
25    });
26    $('#roles_remove_button').click(function() {
27        return !$('#in_roles option:selected').remove().appendTo('#out_roles');
28    });
29    $('#groups_add_button').click(function() {
30        return !$('#out_groups option:selected').remove().appendTo('#in_groups');
31    });
32    $('#groups_remove_button').click(function() {
33        return !$('#in_groups option:selected').remove().appendTo('#out_groups');
34    });
35    $('form#associate_user_role_group').submit(function() {
36        $('#in_roles option').each(function(i) {
37            $(this).attr("selected", "selected");
38        });
39        $('#in_groups option').each(function(i) {
40            $(this).attr("selected", "selected");
41        });
42    });
43});
44</script>
45
46%if message:
47    ${render_msg( message, status )}
48%endif
49
50<div class="toolForm">
51    <div class="toolFormTitle">User '${user.email}'</div>
52    <div class="toolFormBody">
53        <form name="associate_user_role_group" id="associate_user_role_group" action="${h.url_for(controller='admin', action='manage_roles_and_groups_for_user', id=trans.security.encode_id( user.id ) )}" method="post" >
54            <div class="form-row">
55                <div style="float: left; margin-right: 10px;">
56                    <label>Roles associated with '${user.email}'</label>
57                    ${render_select( "in_roles", in_roles )}<br/>
58                    <input type="submit" id="roles_remove_button" value=">>"/>
59                </div>
60                <div>
61                    <label>Roles not associated with '${user.email}'</label>
62                    ${render_select( "out_roles", out_roles )}<br/>
63                    <input type="submit" id="roles_add_button" value="<<"/>
64                </div>
65            </div>
66            <div class="form-row">
67                <div style="float: left; margin-right: 10px;">
68                    <label>Groups associated with '${user.email}'</label>
69                    ${render_select( "in_groups", in_groups )}<br/>
70                    <input type="submit" id="groups_remove_button" value=">>"/>
71                </div>
72                <div>
73                    <label>Groups not associated with '${user.email}'</label>
74                    ${render_select( "out_groups", out_groups )}<br/>
75                    <input type="submit" id="groups_add_button" value="<<"/>
76                </div>
77            </div>
78            <div class="form-row">
79                <input type="submit" name="user_roles_groups_edit_button" value="Save"/>
80            </div>
81        </form>
82    </div>
83</div>