manager: access context through table object bis (#31222)

Related to #31092.
This commit is contained in:
Valentin Deniaud 2019-03-08 13:56:25 +01:00
parent 4a69acd8bd
commit df8cc6dff5
7 changed files with 7 additions and 7 deletions

View File

@ -7,6 +7,6 @@
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<td>{% if view.can_change and row.record.direct %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with username=row.record.get_full_name role=active_role.name %}Do you really want to remove user &quot;{{ username }}&quot; from role &quot;{{ object }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="user"></a>{% endif %}</td>
<td>{% if table.context.view.can_change and row.record.direct %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with username=row.record.get_full_name role=table.context.object %}Do you really want to remove user &quot;{{ username }}&quot; from role &quot;{{ role }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="user"></a>{% endif %}</td>
{% endblock %}
{% endif %}

View File

@ -7,6 +7,6 @@
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<td>{% if view.can_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
<td>{% if table.context.view.can_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
{% endblock %}
{% endif %}

View File

@ -7,6 +7,6 @@
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<td>{% if view.can_change %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name slug=row.record.slug %}Do you really want to remove role &quot;{{ name }}&quot; from service &quot;{{ object }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
<td>{% if table.context.view.can_change %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name slug=table.context.object %}Do you really want to remove role &quot;{{ name }}&quot; from service &quot;{{ slug }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
{% endblock %}
{% endif %}

View File

@ -24,8 +24,8 @@
{% if popup_edit %}
rel="popup"
{% endif %}
{% if url_name %}
data-url="{% url url_name pk=row.record.pk %}"
{% if table.context.url_name %}
data-url="{% url table.context.url_name pk=row.record.pk %}"
{% else %}
data-url="{{ row.record.pk }}/"
{% endif %}

View File

@ -11,7 +11,6 @@
{% block page_title %}
{% trans "Edit User Roles" %}
{% endblock %}
{% block extrascripts %}
{{ block.super }}
<script>

View File

@ -7,6 +7,6 @@
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<td>{% if view.can_change and row.record.member %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name role=active_role.name %}Do you really want to remove role &quot;{{ name }}&quot; from user &quot;{{ object }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
<td>{% if table.context.view.can_change and row.record.member %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name username=table.context.object.get_full_name %}Do you really want to remove role &quot;{{ name }}&quot; from user &quot;{{ username }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
{% endblock %}
{% endif %}

View File

@ -319,6 +319,7 @@ def test_manager_one_ou(app, superuser, admin, simple_role, settings):
q = response.pyquery.remove_namespaces()
assert len(q('table tbody tr')) == 1
assert q('table tbody tr').text() == u'simple role'
assert q('table tbody tr').attr('data-url') == '/manage/roles/%s/' % simple_role.pk
form.set('search-internals', True)
response = form.submit()