| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<odoo> |
| 3 |
|
| 4 |
<template id="event_leaderboard" name="Leaderboard"> |
| 5 |
<t t-call="website_event.layout"> |
| 6 |
<div t-if="visitors" class="pt32 pb32 o_wevent_quiz_leaderboard"> |
| 7 |
<t t-call="website_event_track_quiz.leaderboard_search_bar"/> |
| 8 |
<div class="container mt32"> |
| 9 |
<div t-if="not search" class="row mb-3"> |
| 10 |
<div class="col-md-4 d-flex flex-grow-1" t-foreach="top3_visitors" t-as="visitor"> |
| 11 |
<t t-call="website_event_track_quiz.top3_visitor_card"></t> |
| 12 |
</div> |
| 13 |
</div> |
| 14 |
<table class="table table-sm"> |
| 15 |
<tr t-foreach="visitors" t-as="visitor" |
| 16 |
t-attf-class="#{'alert-info' if visitor['visitor'] == current_visitor else ''} #{'o_wevent_quiz_scroll_to' if scroll_to_position and visitor['visitor'] == current_visitor else ''}"> |
| 17 |
<t t-call="website_event_track_quiz.all_visitor_card"/> |
| 18 |
</tr> |
| 19 |
</table> |
| 20 |
<div class="d-flex justify-content-center"> |
| 21 |
<t t-call="website_event_track_quiz.pager_nobox"/> |
| 22 |
</div> |
| 23 |
</div> |
| 24 |
</div> |
| 25 |
<div t-if="not visitors and search" class="container mt32"> |
| 26 |
<t t-call="website_event_track_quiz.leaderboard_search_bar"/> |
| 27 |
<div class='alert alert-warning mt32'>No user found for <strong><t t-out="search"/></strong>. Try another search.</div> |
| 28 |
</div> |
| 29 |
<div t-if="not visitors and not search" class="vh-100 d-flex justify-content-center align-items-center"> |
| 30 |
<h4 class="text-muted fw-bold">There is currently no leaderboard available</h4> |
| 31 |
</div> |
| 32 |
</t> |
| 33 |
</template> |
| 34 |
|
| 35 |
<template id="pager_nobox" name="Pager (not box display)"> |
| 36 |
<ul t-if="pager['page_count'] > 1" t-attf-class="o_wprofile_pager fw-bold pagination m-0"> |
| 37 |
<li t-attf-class="page-item o_wprofile_pager_arrow #{'disabled' if pager['page']['num'] == 1 else ''}"> |
| 38 |
<a t-att-href=" pager['page_first']['url'] if pager['page']['num'] != 1 else None" class="page-link"><i class="fa fa-step-backward"/></a> |
| 39 |
</li> |
| 40 |
<li t-attf-class="page-item o_wprofile_pager_arrow #{'disabled' if pager['page']['num'] == 1 else ''}"> |
| 41 |
<a t-att-href=" pager['page_previous']['url'] if pager['page']['num'] != 1 else None" class="page-link"><i class="fa fa-caret-left"/></a> |
| 42 |
</li> |
| 43 |
<t t-foreach="pager['pages']" t-as="page"> |
| 44 |
<li t-attf-class="page-item #{'active disabled bg-primary rounded-circle' if page['num'] == pager['page']['num'] else ''}"> <a t-att-href="page['url']" class="page-link" t-out="page['num']"/></li> |
| 45 |
</t> |
| 46 |
<li t-attf-class="page-item o_wprofile_pager_arrow #{'disabled' if pager['page']['num'] == pager['page_count'] else ''}"> |
| 47 |
<a t-att-href="pager['page_next']['url'] if pager['page']['num'] != pager['page_count'] else None" class="page-link"><i class="fa fa-caret-right"/></a> |
| 48 |
</li> |
| 49 |
<li t-attf-class="page-item o_wprofile_pager_arrow #{'disabled' if pager['page']['num'] == pager['page_count'] else ''}"> |
| 50 |
<a t-att-href=" pager['page_last']['url'] if pager['page']['num'] != pager['page_count'] else None" class="page-link"><i class="fa fa-step-forward"/></a> |
| 51 |
</li> |
| 52 |
</ul> |
| 53 |
</template> |
| 54 |
|
| 55 |
<template id="top3_visitor_card" name="Top 3 Visitor Card"> |
| 56 |
<div class="card w-100 text-center mb-2 border-bottom-0"> |
| 57 |
<div class="card-body"> |
| 58 |
<div class="d-inline-block position-relative"> |
| 59 |
<img class="rounded-circle img-fluid" |
| 60 |
style="width: 128px; height: 128px; object-fit: cover;" |
| 61 |
t-att-src="image_data_uri(visitor['visitor'].partner_image) if visitor['visitor'].partner_image else '/web/static/img/user_placeholder.jpg'"/> |
| 62 |
<img class="position-absolute" t-attf-src="/website_profile/static/src/img/rank_#{visitor['position']}.svg" alt="User rank" style="bottom: 0; right: -10px"/> |
| 63 |
</div> |
| 64 |
<h3 t-if="visitor['visitor'] == current_visitor and not visitor['visitor'].partner_id" class="mt-2 mb-0">You</h3> |
| 65 |
<h3 t-else="" class="mt-2 mb-0" t-out="visitor['visitor'].display_name"/> |
| 66 |
</div> |
| 67 |
<div class="row mx-0 o_wprofile_top3_card_footer text-nowrap"> |
| 68 |
<div class="col py-3"><b t-out="visitor['points']"/> <span class="text-muted">Points</span></div> |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
</template> |
| 72 |
|
| 73 |
<template id="all_visitor_card" name="All VIsitor Card"> |
| 74 |
<td class="align-middle text-end text-muted" style="width: 0"> |
| 75 |
<span t-out="visitor['position']"/> |
| 76 |
</td> |
| 77 |
<td class="align-middle d-none d-sm-table-cell"> |
| 78 |
<img class="object-fit-cover rounded-circle o_wprofile_img_small" |
| 79 |
width="30" |
| 80 |
height="30" |
| 81 |
t-att-src="image_data_uri(visitor['visitor'].partner_image) if visitor['visitor'].partner_image else '/web/static/img/user_placeholder.jpg'"/> |
| 82 |
</td> |
| 83 |
<td class="align-middle w-md-75"> |
| 84 |
<span t-if="visitor['visitor'] == current_visitor and not visitor['visitor'].partner_id" class="fw-bold">You</span> |
| 85 |
<span t-else="" class="fw-bold" t-out="visitor['visitor'].display_name"/><br/> |
| 86 |
</td> |
| 87 |
<td class="align-middle fw-bold text-end text-nowrap"> |
| 88 |
<b t-out="visitor['points']"/> <span class="text-muted small fw-bold">Points</span> |
| 89 |
</td> |
| 90 |
</template> |
| 91 |
|
| 92 |
<!-- Sub nav --> |
| 93 |
<template id="leaderboard_search_bar" name="Leaderboard search bar"> |
| 94 |
<div class="container"> |
| 95 |
<div class="row align-items-center justify-content-between"> |
| 96 |
<!-- Desktop Mode --> |
| 97 |
<div class="col d-none d-md-flex flex-row align-items-center justify-content-end"> |
| 98 |
<!-- search --> |
| 99 |
<form t-attf-action="#{'/event/%s/community/leaderboard/results' % (slug(event))}" role="search" method="get"> |
| 100 |
<div class="input-group ms-1 position-relative"> |
| 101 |
<button class="btn btn-link text-white rounded-0 pe-1" type="submit" aria-label="Search" title="Search"> |
| 102 |
<i class="fa fa-search"></i> |
| 103 |
</button> |
| 104 |
<input type="text" class="form-control rounded-0" name="search" placeholder="Search Attendees" t-att-value="searched_name or ''"/> |
| 105 |
</div> |
| 106 |
</form> |
| 107 |
</div> |
| 108 |
|
| 109 |
<!-- Mobile Mode --> |
| 110 |
<div class="col d-md-none py-1 o_wprofile_user_profile_sub_nav_mobile_col"> |
| 111 |
<div class="btn-group w-100 position-relative" role="group" aria-label="Mobile sub-nav"> |
| 112 |
|
| 113 |
<div class="btn-group ms-1 position-static me-2"> |
| 114 |
<a class="btn bg-black-25 text-white dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-search"></i></a> |
| 115 |
<div class="dropdown-menu dropdown-menu-end w-100" style="right: 10px;"> |
| 116 |
<form class="px-3" t-attf-action="#{'/event/%s/community/leaderboard' % (slug(event))}" role="search" method="get"> |
| 117 |
<div class="input-group"> |
| 118 |
<input type="text" class="form-control" name="search" placeholder="Search users"/> |
| 119 |
<button class="btn btn-primary" type="submit" aria-label="Search" title="Search"> |
| 120 |
<i class="fa fa-search"/> |
| 121 |
</button> |
| 122 |
</div> |
| 123 |
</form> |
| 124 |
</div> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
</div> |
| 128 |
</div> |
| 129 |
</div> |
| 130 |
</template> |
| 131 |
</odoo> |