diff --git a/core/static/core/colors.scss b/core/static/core/colors.scss index 5453dd34..35dc6a69 100644 --- a/core/static/core/colors.scss +++ b/core/static/core/colors.scss @@ -29,4 +29,9 @@ $shadow-color: rgb(223, 223, 223); $background-button-color: hsl(0, 0%, 95%); -$deepblue: #354a5f; \ No newline at end of file +$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; +} \ No newline at end of file diff --git a/core/static/core/style.scss b/core/static/core/style.scss index 6973aa75..cbe8d326 100644 --- a/core/static/core/style.scss +++ b/core/static/core/style.scss @@ -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 { diff --git a/counter/templates/counter/fragments/create_student_card.jinja b/counter/templates/counter/fragments/create_student_card.jinja index d972ff33..c0701b7a 100644 --- a/counter/templates/counter/fragments/create_student_card.jinja +++ b/counter/templates/counter/fragments/create_student_card.jinja @@ -13,13 +13,18 @@ {% trans %}No student card registered.{% endtrans %} {% else %}
- {% trans %}Card registered{% endtrans %} - - - + + {% trans %}Card registered{% endtrans %} + + + - +
{% endif %} diff --git a/counter/tests/test_customer.py b/counter/tests/test_customer.py index 3e745ecc..21f5604c 100644 --- a/counter/tests/test_customer.py +++ b/counter/tests/test_customer.py @@ -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)