Fix bug leave org

This commit is contained in:
cuom1999 2021-12-27 15:43:03 +07:00
parent 120335ee1c
commit a026b034e6

View file

@ -29,13 +29,15 @@
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('.leave-organization').click(function () { $('.leave-organization').click(function () {
return confirm('{{ _('Are you sure you want to leave this organization?') }}\n' + if (confirm('{{ _('Are you sure you want to leave this organization?') }}\n' +
{% if organization.is_open %} {% if organization.is_open %}
'{{ _('You will have to rejoin to show up on the organization leaderboard.') }}' '{{ _('You will have to rejoin to show up on the organization leaderboard.') }}'
{% else %} {% else %}
'{{ _('You will have to request membership in order to join again.') }}' '{{ _('You will have to request membership in order to join again.') }}'
{% endif %} {% endif %}
); )) {
$(this).parent().submit();
}
}); });
$(document).ready(function () { $(document).ready(function () {
@ -76,7 +78,7 @@
{% elif organization.is_open or can_edit %} {% elif organization.is_open or can_edit %}
<form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}"> <form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="unselectable button" value="{{ _('Join organization') }}"> <input type="submit" class="unselectable button" value="{{ _('Join organization') }}" style="margin-right: 1em">
</form> </form>
{% else %} {% else %}
<a href="{{ url('request_organization', organization.id, organization.slug) }}" <a href="{{ url('request_organization', organization.id, organization.slug) }}"
@ -162,7 +164,7 @@
<li> <li>
<form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}"> <form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}">
{% csrf_token %} {% csrf_token %}
<a type="submit" href="#" class="leave-organization">{{ _('Leave organization') }}</a> <a href="#" class="leave-organization">{{ _('Leave organization') }}</a>
</form> </form>
</li> </li>
{% endif %} {% endif %}