Projet

Général

Profil

0001-manager-access-context-through-table-object-bis-3122.patch

Valentin Deniaud, 14 mars 2019 12:08

Télécharger (6,73 ko)

Voir les différences:

Subject: [PATCH 1/3] manager: access context through table object bis (#31222)

Related to #31092.
 .../templates/authentic2/manager/role_members_table.html      | 2 +-
 .../templates/authentic2/manager/role_permissions_table.html  | 2 +-
 .../templates/authentic2/manager/service_roles_table.html     | 2 +-
 .../manager/templates/authentic2/manager/table.html           | 4 ++--
 .../manager/templates/authentic2/manager/user_roles.html      | 1 -
 .../templates/authentic2/manager/user_roles_table.html        | 2 +-
 tests/test_manager.py                                         | 1 +
 7 files changed, 7 insertions(+), 7 deletions(-)
src/authentic2/manager/templates/authentic2/manager/role_members_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
    <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>
10
  <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>
11 11
  {% endblock %}
12 12
{% endif %}
src/authentic2/manager/templates/authentic2/manager/role_permissions_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
    <td>{% if view.can_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
10
    <td>{% if table.context.view.can_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
11 11
  {% endblock %}
12 12
{% endif %}
src/authentic2/manager/templates/authentic2/manager/service_roles_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
    <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>
10
    <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>
11 11
  {% endblock %}
12 12
{% endif %}
src/authentic2/manager/templates/authentic2/manager/table.html
24 24
       {% if popup_edit %}
25 25
         rel="popup"
26 26
       {% endif %}
27
       {% if url_name %}
28
         data-url="{% url url_name pk=row.record.pk %}"
27
       {% if table.context.url_name %}
28
         data-url="{% url table.context.url_name pk=row.record.pk %}"
29 29
       {% else %}
30 30
         data-url="{{ row.record.pk }}/"
31 31
       {% endif %}
src/authentic2/manager/templates/authentic2/manager/user_roles.html
11 11
{% block page_title %}
12 12
{% trans "Edit User Roles" %}
13 13
{% endblock %}
14

  
15 14
{% block extrascripts %}
16 15
  {{ block.super }}
17 16
  <script>
src/authentic2/manager/templates/authentic2/manager/user_roles_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
  <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>
10
  <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>
11 11
  {% endblock %}
12 12
{% endif %}
tests/test_manager.py
319 319
        q = response.pyquery.remove_namespaces()
320 320
        assert len(q('table tbody tr')) == 1
321 321
        assert q('table tbody tr').text() == u'simple role'
322
        assert q('table tbody tr').attr('data-url') == '/manage/roles/%s/' % simple_role.pk
322 323

  
323 324
        form.set('search-internals', True)
324 325
        response = form.submit()
325
-