mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 07:41:14 +00:00
Fix tooltip shadow and position and improve unittests
This commit is contained in:
parent
4975475e85
commit
2cc4308a58
@ -30,3 +30,8 @@ $shadow-color: rgb(223, 223, 223);
|
||||
$background-button-color: hsl(0, 0%, 95%);
|
||||
|
||||
$deepblue: #354a5f;
|
||||
|
||||
@mixin shadow {
|
||||
box-shadow: rgba(60, 64, 67, 0.3) 0 1px 3px 0,
|
||||
rgba(60, 64, 67, 0.15) 0 4px 8px 3px;
|
||||
}
|
@ -46,22 +46,25 @@ body {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
[tooltip]:before {
|
||||
[tooltip]::before {
|
||||
@include shadow;
|
||||
opacity: 0;
|
||||
z-index: 1;
|
||||
content: attr(tooltip);
|
||||
background: $white-color;
|
||||
background: hsl(219.6, 20.8%, 96%);
|
||||
color: $black-color;
|
||||
border: 1px solid $black-color;
|
||||
border: 0.5px solid hsl(0, 0%, 50%);
|
||||
;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
top: 1em;
|
||||
position: absolute;
|
||||
margin-top: 5px;
|
||||
white-space: nowrap;
|
||||
transition: opacity 500ms ease-out;
|
||||
}
|
||||
|
||||
[tooltip]:hover:before {
|
||||
[tooltip]:hover::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@ -102,8 +105,7 @@ body {
|
||||
}
|
||||
|
||||
.shadow {
|
||||
box-shadow: rgba(60, 64, 67, 0.3) 0 1px 3px 0,
|
||||
rgba(60, 64, 67, 0.15) 0 4px 8px 3px;
|
||||
@include shadow;
|
||||
}
|
||||
|
||||
.w_big {
|
||||
|
@ -13,13 +13,18 @@
|
||||
<em class="no-cards">{% trans %}No student card registered.{% endtrans %}</em>
|
||||
{% else %}
|
||||
<p>
|
||||
{% trans %}Card registered{% endtrans %}</span>
|
||||
<span tooltip="{% trans uid=customer.student_card.uid %}uid: {{ uid }} {% endtrans %}"><i class="fa fa-check" style="color: green"></i></span> -
|
||||
<span tooltip="{% trans uid=customer.student_card.uid %}uid: {{ uid }} {% endtrans %}">
|
||||
{% trans %}Card registered{% endtrans %}
|
||||
<i class="fa fa-check" style="color: green"></i>
|
||||
</span>
|
||||
-
|
||||
<button
|
||||
hx-get="{{ url('counter:delete_student_card', customer_id=customer.pk) }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#student_card_form"
|
||||
>{% trans %}Delete{% endtrans %}</button>
|
||||
>
|
||||
{% trans %}Delete{% endtrans %}
|
||||
</button>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -271,8 +271,8 @@ class TestStudentCard(TestCase):
|
||||
assert not hasattr(customer, "student_card")
|
||||
|
||||
def test_add_student_card_from_counter_unauthorized(self):
|
||||
def send_valid_request(counter_id):
|
||||
return self.client.post(
|
||||
def send_valid_request(client, counter_id):
|
||||
return client.post(
|
||||
reverse(
|
||||
"counter:add_student_card", kwargs={"customer_id": self.customer.pk}
|
||||
),
|
||||
@ -284,11 +284,24 @@ class TestStudentCard(TestCase):
|
||||
)
|
||||
|
||||
# Send to a counter where you aren't logged in
|
||||
assert send_valid_request(self.counter.id).status_code == 403
|
||||
assert send_valid_request(self.client, self.counter.id).status_code == 403
|
||||
|
||||
self.login_in_counter()
|
||||
barman = subscriber_user.make()
|
||||
self.counter.sellers.add(barman)
|
||||
# We want to test sending requests from another counter while
|
||||
# we are currently registered to another counter
|
||||
# so we connect to a counter and
|
||||
# we create a new client, in order to check
|
||||
# that using a client not logged to a counter
|
||||
# where another client is logged still isn't authorized.
|
||||
client = Client()
|
||||
# Send to a counter where you aren't logged in
|
||||
assert send_valid_request(client, self.counter.id).status_code == 403
|
||||
|
||||
# Send to a non bar counter
|
||||
self.client.force_login(self.club_admin)
|
||||
assert send_valid_request(self.club_counter.id).status_code == 403
|
||||
client.force_login(self.club_admin)
|
||||
assert send_valid_request(client, self.club_counter.id).status_code == 403
|
||||
|
||||
def test_delete_student_card_with_owner(self):
|
||||
self.client.force_login(self.customer)
|
||||
|
Loading…
Reference in New Issue
Block a user