Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up membership page - member table #436

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions projects/templates/projects/view_project.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ <h3>Project Members</h3>
<th>Last Name</th>
<th>Email</th>
<th>Role</th>
<th>Edit</th>
<th></th>
</tr>
{% for join_request in join_requests %}
Expand Down Expand Up @@ -193,39 +194,41 @@ <h3>Project Members</h3>
<td>{{ u.first_name }}</td>
<td>{{ u.last_name }}</td>
<td>{{ u.email }}</td>
{% if can_manage_project_membership %}
<td>
<form role="form" method="post" style="display:inline">
{% csrf_token %}
<input type="hidden" name="user_ref" value="{{ u.username }}">
<select id="role_{{ u.id }}" name="user_role" class="form-select role_selector" data-initial="{{ u.role }}" disabled>
{% for role in roles %}
<option value="{{ role }}" {% if role == u.role %}selected disabled{% endif %}>{{ role }}</option>
{% endfor %}
</select>
<button type="submit" id="submit_role_{{ u.id }}" class="btn btn-xs btn-primary" name="change_role" style="display:none;">Submit</button>
<button type="button" onclick="resetRole('role_{{ u.id }}')" id="cancel_role_{{ u.id }}" class="btn btn-xs btn-danger" style="display:none;">Cancel</button>
</form>
</td>
{% else %}
<td>{{u.role}}</td>
{% endif %}
<td>
<form role="form" method="post" style="display:inline">
{% csrf_token %}
<input type="hidden" name="user_ref" value="{{ u.username }}">
<select id="role_{{ u.id }}" name="user_role" class="form-select role_selector" data-initial="{{ u.role }}" disabled>
{% for role in roles %}
<option value="{{ role }}" {% if role == u.role %}selected disabled{% endif %}>{{ role }}</option>
{% endfor %}
</select>
<button type="submit" id="submit_role_{{ u.id }}" class="btn btn-xs btn-primary" name="change_role" style="display:none;">Submit</button>
<button type="button" onclick="resetRole('role_{{ u.id }}')" id="cancel_role_{{ u.id }}" class="btn btn-xs btn-danger" style="display:none;">Cancel</button>
</form>
</td>
<td>
{% if u.username != request.user.username %}
{% if u.username == request.user.username or can_manage_project_membership %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea!

<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" {% if not can_manage_project_membership %}disabled{%endif%}>
<i class="fa fa-gear text-info dropbtn"></i><span class="sr-only">Manage Member</span>
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-gear text-info dropbtn" title="Manage Member"></i>
</button>
<div class="dropdown-menu dropdown-content" aria-labelledby="dropdownMenuButton">
{% if can_manage_project %}
<button onclick="enableChangeRole('{{ u.id }}')" class="btn btn-xs btn-block">Change Role</button>
{% endif %}
{% if can_manage_project_membership %}
<form role="form" method="post" style="display:inline">
{% csrf_token %}
<input type="hidden" name="user_ref" value="{{ u.username }}">
<button type="submit" class="btn btn-xs btn-danger btn-block" name="del_user">Remove user</button>
</form>
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
</td>
<td>{% if u.daypass %} Daypass: {{ u.daypass }} remain {% endif %}</td>
</tr>
Expand Down
Loading