Projet

Général

Profil

0001-views-remove-login-blocks-is_hidden-attribute-41140.patch

Voir les différences:

Subject: [PATCH] views: remove login blocks' "is_hidden" attribute (#41140)

 src/authentic2/templates/authentic2/login.html | 4 ----
 src/authentic2/views.py                        | 5 -----
 2 files changed, 9 deletions(-)
src/authentic2/templates/authentic2/login.html
17 17
{% block content %}
18 18
  <div id="a2-login-forms">
19 19
    {% for id, login_block in blocks.items %}
20
      {% if not login_block.is_hidden %}
21 20
        <span id="css-tab{{ forloop.counter }}"></span>
22
      {% endif %}
23 21
    {% endfor %}
24 22

  
25 23
    {% if blocks|length != 1 %}
26 24
      {% for id, login_block in blocks.items %}
27
        {% if not login_block.is_hidden %}
28 25
          <a class="css-tab-link css-tab{{ forloop.counter }} {% if forloop.first %}css-tab-default{% endif %} {{ login_block.extra_css_class }}" href="#css-tab{{ forloop.counter }}">
29 26
              {{ login_block.name }}
30 27
          </a>
31
        {% endif %}
32 28
      {% endfor %}
33 29
    {% endif %}
34 30

  
src/authentic2/views.py
345 345
                if block:
346 346
                    if block['status_code'] != 200:
347 347
                        return block['response']
348
                    block['is_hidden'] = False
349 348
                    blocks.append(block)
350
        # TODO: remove attribute below after cleaning up the templates
351
        if blocks:
352
            blocks[-1]['is_hidden'] = False
353 349

  
354 350
    # Old frontends API
355 351
    for block in blocks:
......
375 371
        'methods': rendered_forms,
376 372
        # new definition
377 373
        'blocks': collections.OrderedDict((block['id'], block) for block in blocks),
378
        'visible_blocks_count': len([x for x in blocks if not x['is_hidden']]),
379 374
        redirect_field_name: redirect_to,
380 375
    })
381 376
    return render(request, template_name, context)
382
-