Show Permission Restrictions in a Table (#5457)

This commit is contained in:
Faris Ansari 2018-04-20 12:36:21 +05:30 committed by GitHub
parent d6902b5010
commit 8283cd3fbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View file

@ -111,7 +111,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
}
}
show_restrictions(match_rules_list) {
show_restrictions(match_rules_list=[]) {
frappe.msgprint(frappe.render_template('list_view_permission_restrictions', {
condition_list: match_rules_list
}), 'Restrictions');

View file

@ -1,13 +1,16 @@
<div class="level">
{% for(var i=0; i < condition_list.length; i++) { var conditions=condition_list[i]; %}
<div class="level-item">
{% if (i > 0) { %}
<span style="margin-right: 10px;">{{ __("Or") }}</span>{% } %} {% for(key in conditions) { %}
<span class="label label-default" style="margin-right: 10px;">
{% if(conditions[key].length) { %} {{ key }} = {{ frappe.utils.comma_or(conditions[key]) }} {% } else { %} {{ __("{0} is
not set", [key]) }} {% } %}
</span>
<table class="table table-bordered" style="margin: 0;">
<thead>
<th>{{ __("Field") }}</th>
<th>{{ __("Value") }}</th>
</thead>
<tbody>
{% for (let condition of condition_list ) { %}
{% for (let key in condition) { %}
<tr>
<td>{{ __(key) }}</td>
<td>{{ frappe.utils.comma_or(condition[key]) }}</td>
</tr>
{% } %}
{% } %}
</div>
{% } %}
</div>
</tbody>
</table>