Show More
@@ -1,169 +1,169 b'' | |||||
1 | ## snippet for displaying default permission box |
|
1 | ## snippet for displaying default permission box | |
2 | ## usage: |
|
2 | ## usage: | |
3 | ## <%namespace name="dpb" file="/base/default_perms_box.mako"/> |
|
3 | ## <%namespace name="dpb" file="/base/default_perms_box.mako"/> | |
4 | ## ${dpb.default_perms_box(<url_to_form>)} |
|
4 | ## ${dpb.default_perms_box(<url_to_form>)} | |
5 | ## ${dpb.default_perms_radios()} |
|
5 | ## ${dpb.default_perms_radios()} | |
6 | <%namespace name="base" file="/base/base.mako"/> |
|
6 | <%namespace name="base" file="/base/base.mako"/> | |
7 |
|
7 | |||
8 | <%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)"> |
|
8 | <%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)"> | |
9 | <div class="main-content-full-width"> |
|
9 | <div class="main-content-full-width"> | |
10 | <div class="panel panel-default"> |
|
10 | <div class="panel panel-default"> | |
11 |
|
11 | |||
12 | ## displayed according to checkbox selection |
|
12 | ## displayed according to checkbox selection | |
13 | <div class="panel-heading"> |
|
13 | <div class="panel-heading"> | |
14 | %if not global_permissions_template: |
|
14 | %if not global_permissions_template: | |
15 | <h3 class="inherit_overlay_default panel-title"> |
|
15 | <h3 class="inherit_overlay_default panel-title"> | |
16 | % if hasattr(c, 'user'): |
|
16 | % if hasattr(c, 'user'): | |
17 | ${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} - |
|
17 | ${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} - | |
18 | % endif |
|
18 | % endif | |
19 | ${_('Inherited Permissions')} |
|
19 | ${_('Inherited Permissions')} | |
20 | </h3> |
|
20 | </h3> | |
21 | <h3 class="inherit_overlay panel-title"> |
|
21 | <h3 class="inherit_overlay panel-title"> | |
22 | % if hasattr(c, 'user'): |
|
22 | % if hasattr(c, 'user'): | |
23 | ${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} - |
|
23 | ${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} - | |
24 | % endif |
|
24 | % endif | |
25 | ${_('Custom Permissions')} |
|
25 | ${_('Custom Permissions')} | |
26 | </h3> |
|
26 | </h3> | |
27 | %else: |
|
27 | %else: | |
28 | <h3 class="panel-title"> |
|
28 | <h3 class="panel-title"> | |
29 | ${_('Default Global Permissions')} |
|
29 | ${_('Default Global Permissions')} | |
30 | </h3> |
|
30 | </h3> | |
31 | %endif |
|
31 | %endif | |
32 | </div> |
|
32 | </div> | |
33 |
|
33 | |||
34 | <div class="panel-body"> |
|
34 | <div class="panel-body"> | |
35 | %if global_permissions_template: |
|
35 | %if global_permissions_template: | |
36 | <p>${_('The following options configure the default permissions each user or group will inherit. You can override these permissions for each individual user or user group using individual permissions settings.')}</p> |
|
36 | <p>${_('The following options configure the default permissions each user or group will inherit. You can override these permissions for each individual user or user group using individual permissions settings.')}</p> | |
37 | %endif |
|
37 | %endif | |
38 | <div class="field"> |
|
38 | <div class="field"> | |
39 | <div class="label"> |
|
39 | <div class="label"> | |
40 | <label for="default_repo_create${suffix}">${_('Repository Creation')}:</label> |
|
40 | <label for="default_repo_create${suffix}">${_('Repository Creation')}:</label> | |
41 | </div> |
|
41 | </div> | |
42 | <div class="radios"> |
|
42 | <div class="radios"> | |
43 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[1][0], label=c.repo_create_choices[1][1], **kwargs)} |
|
43 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[1][0], label=c.repo_create_choices[1][1], **kwargs)} | |
44 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[0][0], label=c.repo_create_choices[0][1], **kwargs)} |
|
44 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[0][0], label=c.repo_create_choices[0][1], **kwargs)} | |
45 | <span class="help-block">${_('Permission to create root level repositories. When disabled, users can still create repositories inside their own repository groups.')}</span> |
|
45 | <span class="help-block">${_('Permission to create root level repositories. When disabled, users can still create repositories inside their own repository groups.')}</span> | |
46 | </div> |
|
46 | </div> | |
47 | </div> |
|
47 | </div> | |
48 | <div class="field"> |
|
48 | <div class="field"> | |
49 | <div class="label"> |
|
49 | <div class="label"> | |
50 | <label for="default_repo_create_on_write${suffix}">${_('Repository Creation With Group Write Access')}:</label> |
|
50 | <label for="default_repo_create_on_write${suffix}">${_('Repository Creation With Group Write Access')}:</label> | |
51 | </div> |
|
51 | </div> | |
52 | <div class="radios"> |
|
52 | <div class="radios"> | |
53 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[1][0], label=c.repo_create_on_write_choices[1][1], **kwargs)} |
|
53 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[1][0], label=c.repo_create_on_write_choices[1][1], **kwargs)} | |
54 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[0][0], label=c.repo_create_on_write_choices[0][1], **kwargs)} |
|
54 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[0][0], label=c.repo_create_on_write_choices[0][1], **kwargs)} | |
55 | <span class="help-block">${_('Write permission given on a repository group will allow creating repositories inside that group.')}</span> |
|
55 | <span class="help-block">${_('Write permission given on a repository group will allow creating repositories inside that group.')}</span> | |
56 | </div> |
|
56 | </div> | |
57 | </div> |
|
57 | </div> | |
58 | <div class="field"> |
|
58 | <div class="field"> | |
59 | <div class="label"> |
|
59 | <div class="label"> | |
60 | <label for="default_fork_create${suffix}">${_('Repository Forking')}:</label> |
|
60 | <label for="default_fork_create${suffix}">${_('Repository Forking')}:</label> | |
61 | </div> |
|
61 | </div> | |
62 | <div class="radios"> |
|
62 | <div class="radios"> | |
63 | ${h.radio('default_fork_create' + suffix, c.fork_choices[1][0], label=c.fork_choices[1][1], **kwargs)} |
|
63 | ${h.radio('default_fork_create' + suffix, c.fork_choices[1][0], label=c.fork_choices[1][1], **kwargs)} | |
64 | ${h.radio('default_fork_create' + suffix, c.fork_choices[0][0], label=c.fork_choices[0][1], **kwargs)} |
|
64 | ${h.radio('default_fork_create' + suffix, c.fork_choices[0][0], label=c.fork_choices[0][1], **kwargs)} | |
65 |
<span class="help-block">${_('Permission to create r |
|
65 | <span class="help-block">${_('Permission to create repository forks. Root level forks will only work if repository creation is enabled.')}</span> | |
66 | </div> |
|
66 | </div> | |
67 | </div> |
|
67 | </div> | |
68 | <div class="field"> |
|
68 | <div class="field"> | |
69 | <div class="label"> |
|
69 | <div class="label"> | |
70 | <label for="default_repo_group_create${suffix}">${_('Repository Group Creation')}:</label> |
|
70 | <label for="default_repo_group_create${suffix}">${_('Repository Group Creation')}:</label> | |
71 | </div> |
|
71 | </div> | |
72 | <div class="radios"> |
|
72 | <div class="radios"> | |
73 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[1][0], label=c.repo_group_create_choices[1][1], **kwargs)} |
|
73 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[1][0], label=c.repo_group_create_choices[1][1], **kwargs)} | |
74 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[0][0], label=c.repo_group_create_choices[0][1], **kwargs)} |
|
74 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[0][0], label=c.repo_group_create_choices[0][1], **kwargs)} | |
75 | <span class="help-block">${_('Permission to create root level repository groups. When disabled, repository group admins can still create repository subgroups within their repository groups.')}</span> |
|
75 | <span class="help-block">${_('Permission to create root level repository groups. When disabled, repository group admins can still create repository subgroups within their repository groups.')}</span> | |
76 | </div> |
|
76 | </div> | |
77 | </div> |
|
77 | </div> | |
78 | <div class="field"> |
|
78 | <div class="field"> | |
79 | <div class="label"> |
|
79 | <div class="label"> | |
80 | <label for="default_user_group_create${suffix}">${_('User Group Creation')}:</label> |
|
80 | <label for="default_user_group_create${suffix}">${_('User Group Creation')}:</label> | |
81 | </div> |
|
81 | </div> | |
82 | <div class="radios"> |
|
82 | <div class="radios"> | |
83 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[1][0], label=c.user_group_create_choices[1][1], **kwargs)} |
|
83 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[1][0], label=c.user_group_create_choices[1][1], **kwargs)} | |
84 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[0][0], label=c.user_group_create_choices[0][1], **kwargs)} |
|
84 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[0][0], label=c.user_group_create_choices[0][1], **kwargs)} | |
85 | <span class="help-block">${_('Permission to allow user group creation.')}</span> |
|
85 | <span class="help-block">${_('Permission to allow user group creation.')}</span> | |
86 | </div> |
|
86 | </div> | |
87 | </div> |
|
87 | </div> | |
88 |
|
88 | |||
89 | <div class="field"> |
|
89 | <div class="field"> | |
90 | <div class="label"> |
|
90 | <div class="label"> | |
91 | <label for="default_inherit_default_permissions${suffix}">${_('Inherit Permissions From The Default User')}:</label> |
|
91 | <label for="default_inherit_default_permissions${suffix}">${_('Inherit Permissions From The Default User')}:</label> | |
92 | </div> |
|
92 | </div> | |
93 | <div class="radios"> |
|
93 | <div class="radios"> | |
94 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[1][0], label=c.inherit_default_permission_choices[1][1], **kwargs)} |
|
94 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[1][0], label=c.inherit_default_permission_choices[1][1], **kwargs)} | |
95 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[0][0], label=c.inherit_default_permission_choices[0][1], **kwargs)} |
|
95 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[0][0], label=c.inherit_default_permission_choices[0][1], **kwargs)} | |
96 | <span class="help-block">${_('Inherit default permissions from the default user. Turn off this option to force explicit permissions for users, even if they are more restrictive than the default user permissions.')}</span> |
|
96 | <span class="help-block">${_('Inherit default permissions from the default user. Turn off this option to force explicit permissions for users, even if they are more restrictive than the default user permissions.')}</span> | |
97 | </div> |
|
97 | </div> | |
98 | </div> |
|
98 | </div> | |
99 |
|
99 | |||
100 | <div class="buttons"> |
|
100 | <div class="buttons"> | |
101 | ${h.submit('save',_('Save'),class_="btn")} |
|
101 | ${h.submit('save',_('Save'),class_="btn")} | |
102 | ${h.reset('reset',_('Reset'),class_="btn")} |
|
102 | ${h.reset('reset',_('Reset'),class_="btn")} | |
103 | </div> |
|
103 | </div> | |
104 | </div> |
|
104 | </div> | |
105 | </div> |
|
105 | </div> | |
106 | </div> |
|
106 | </div> | |
107 | </%def> |
|
107 | </%def> | |
108 |
|
108 | |||
109 | <%def name="default_perms_box(form_url)"> |
|
109 | <%def name="default_perms_box(form_url)"> | |
110 | ${h.secure_form(form_url, request=request)} |
|
110 | ${h.secure_form(form_url, request=request)} | |
111 | <div class="form"> |
|
111 | <div class="form"> | |
112 | <div class="fields"> |
|
112 | <div class="fields"> | |
113 | <div class="field panel panel-default panel-body"> |
|
113 | <div class="field panel panel-default panel-body"> | |
114 | <div class="label label-checkbox"> |
|
114 | <div class="label label-checkbox"> | |
115 | <label for="inherit_default_permissions">${_('Inherit from default settings')}:</label> |
|
115 | <label for="inherit_default_permissions">${_('Inherit from default settings')}:</label> | |
116 | </div> |
|
116 | </div> | |
117 | <div class="checkboxes"> |
|
117 | <div class="checkboxes"> | |
118 | ${h.checkbox('inherit_default_permissions',value=True)} |
|
118 | ${h.checkbox('inherit_default_permissions',value=True)} | |
119 | <span class="help-block"> |
|
119 | <span class="help-block"> | |
120 | ${h.literal(_('Select to inherit permissions from %s permissions settings, ' |
|
120 | ${h.literal(_('Select to inherit permissions from %s permissions settings, ' | |
121 | 'including default IP address whitelist and inheritance of \npermission by members of user groups.') |
|
121 | 'including default IP address whitelist and inheritance of \npermission by members of user groups.') | |
122 | % h.link_to('default user', h.route_path('admin_permissions_global')))} |
|
122 | % h.link_to('default user', h.route_path('admin_permissions_global')))} | |
123 | </span> |
|
123 | </span> | |
124 | </div> |
|
124 | </div> | |
125 | </div> |
|
125 | </div> | |
126 |
|
126 | |||
127 | ## INHERITED permissions == the user permissions in admin |
|
127 | ## INHERITED permissions == the user permissions in admin | |
128 | ## if inherit checkbox is set this is displayed in non-edit mode |
|
128 | ## if inherit checkbox is set this is displayed in non-edit mode | |
129 | <div class="inherit_overlay_default"> |
|
129 | <div class="inherit_overlay_default"> | |
130 | ${default_perms_radios(global_permissions_template = False, suffix='_inherited', disabled="disabled")} |
|
130 | ${default_perms_radios(global_permissions_template = False, suffix='_inherited', disabled="disabled")} | |
131 | </div> |
|
131 | </div> | |
132 |
|
132 | |||
133 | ## CUSTOM permissions |
|
133 | ## CUSTOM permissions | |
134 | <div class="inherit_overlay"> |
|
134 | <div class="inherit_overlay"> | |
135 | ${default_perms_radios(global_permissions_template = False)} |
|
135 | ${default_perms_radios(global_permissions_template = False)} | |
136 | </div> |
|
136 | </div> | |
137 | </div> |
|
137 | </div> | |
138 | </div> |
|
138 | </div> | |
139 | ${h.end_form()} |
|
139 | ${h.end_form()} | |
140 |
|
140 | |||
141 |
|
141 | |||
142 | ## JS |
|
142 | ## JS | |
143 | <script> |
|
143 | <script> | |
144 | var show_custom_perms = function(inherit_default){ |
|
144 | var show_custom_perms = function(inherit_default){ | |
145 | if(inherit_default) { |
|
145 | if(inherit_default) { | |
146 | $('.inherit_overlay_default').show(); |
|
146 | $('.inherit_overlay_default').show(); | |
147 | $('.inherit_overlay').hide(); |
|
147 | $('.inherit_overlay').hide(); | |
148 | } |
|
148 | } | |
149 | else { |
|
149 | else { | |
150 | $('.inherit_overlay').show(); |
|
150 | $('.inherit_overlay').show(); | |
151 | $('.inherit_overlay_default').hide(); |
|
151 | $('.inherit_overlay_default').hide(); | |
152 | } |
|
152 | } | |
153 | }; |
|
153 | }; | |
154 | $(document).ready(function(e){ |
|
154 | $(document).ready(function(e){ | |
155 | var inherit_checkbox = $('#inherit_default_permissions'); |
|
155 | var inherit_checkbox = $('#inherit_default_permissions'); | |
156 | var defaults = inherit_checkbox.prop('checked'); |
|
156 | var defaults = inherit_checkbox.prop('checked'); | |
157 | show_custom_perms(defaults); |
|
157 | show_custom_perms(defaults); | |
158 | inherit_checkbox.on('change', function(){ |
|
158 | inherit_checkbox.on('change', function(){ | |
159 | if($(this).prop('checked')){ |
|
159 | if($(this).prop('checked')){ | |
160 | show_custom_perms(true); |
|
160 | show_custom_perms(true); | |
161 | } |
|
161 | } | |
162 | else{ |
|
162 | else{ | |
163 | show_custom_perms(false); |
|
163 | show_custom_perms(false); | |
164 | } |
|
164 | } | |
165 | }) |
|
165 | }) | |
166 | }) |
|
166 | }) | |
167 | </script> |
|
167 | </script> | |
168 |
|
168 | |||
169 | </%def> |
|
169 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now