Projet

Général

Profil

0001-backoffice-move-lateral-view-links-to-top-actions-28.patch

Frédéric Péters, 17 novembre 2018 13:37

Télécharger (3,55 ko)

Voir les différences:

Subject: [PATCH] backoffice: move lateral view links to top actions (#28104)

 wcs/backoffice/management.py | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)
wcs/backoffice/management.py
494 494
                if user.is_admin or formdef.is_of_concern_for_user(user):
495 495
                    append_form_entry(formdef)
496 496

  
497
        def top_action_links(r):
498
            r += htmltext('<span class="actions">')
499
            if get_publisher().is_using_postgresql() and \
500
                    get_publisher().get_site_option('postgresql_views') != 'false':
501
                r += htmltext('<a href="listing">%s</a>') % _('Global View')
502
                if get_publisher().has_site_option('per-user-view'):
503
                    r += htmltext(' <a href="users/">%s</a>') % _('Per User View')
504
            for formdef in formdefs:
505
                if formdef.geolocations:
506
                    r += htmltext(' <a href="map">%s</a>') % _('Map View')
507
                    break
508
            r += htmltext('</span>')
509

  
497 510
        if forms_with_pending_stuff:
498 511
            r += htmltext('<div id="appbar">')
499 512
            r += htmltext('<h2>%s</h2>') % _('Forms in your care')
513
            top_action_links(r)
500 514
            r += htmltext('</div>')
501 515
            r += htmltext('<div class="bo-block" id="forms-in-your-care">')
502 516
            r += self.display_forms(forms_with_pending_stuff)
......
505 519
        if forms_without_pending_stuff:
506 520
            r += htmltext('<div id="appbar">')
507 521
            r += htmltext('<h2>%s</h2>') % _('Other Forms')
522
            if not forms_without_pending_stuff:
523
                top_action_links(r)
508 524
            r += htmltext('</div>')
509 525
            r += htmltext('<div class="bo-block" id="other-forms">')
510 526
            r += self.display_forms(forms_without_pending_stuff)
511 527
            r += htmltext('</div>')
512 528

  
529
        if not (forms_with_pending_stuff or forms_without_pending_stuff):
530
            r += htmltext('<div id="appbar">')
531
            r += htmltext('<h2>%s</h2>') % _('Forms')
532
            top_action_links(r)
533
            r += htmltext('</div>')
534

  
513 535
        return r.getvalue()
514 536

  
515 537
    def get_sidebar(self, formdefs):
516 538
        r = TemplateIO(html=True)
539
        r += self.get_lookup_sidebox()
517 540
        r += htmltext('<div class="bo-block">')
518 541
        r += htmltext('<ul id="sidebar-actions">')
519 542
        r += htmltext('<li class="stats"><a href="statistics">%s</a></li>') % _('Global statistics')
520
        if get_publisher().is_using_postgresql() and \
521
                get_publisher().get_site_option('postgresql_views') != 'false':
522
            r += htmltext('<li><a href="listing">%s</a></li>') % _('Global View')
523
            if get_publisher().has_site_option('per-user-view'):
524
                r += htmltext('<li><a href="users/">%s</a></li>') % _('Per User View')
525
            for formdef in formdefs:
526
                if formdef.geolocations:
527
                    r += htmltext('<li><a href="map">%s</a>') % _('Map View')
528
                    break
529 543
        r += htmltext('</ul>')
530 544
        r += htmltext('</div>')
531
        r += self.get_lookup_sidebox()
532 545
        return r.getvalue()
533 546

  
534 547
    def lookup(self):
535
-