2017-01-25 19:01:23 +08:00
|
|
|
<% if user_team.user == user %>
|
|
|
|
<div class="btn btn-default btn-xs" type="button" disabled="disabled">
|
2018-05-22 22:55:58 +08:00
|
|
|
<span class="fas fa-user-cog"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<span class="caret"></span>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<% id = "user-#{user_team.user.id}-dropdown" %>
|
|
|
|
<div class="dropdown dropdown-teams-user">
|
|
|
|
<div class="btn btn-default btn-xs"
|
|
|
|
type="button"
|
|
|
|
id="<%= id %>"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="true">
|
2018-05-22 22:55:58 +08:00
|
|
|
<span class="fas fa-user-cog"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<span class="caret"></span>
|
|
|
|
</div>
|
2018-05-15 00:33:57 +08:00
|
|
|
<ul class="dropdown-menu custom-dropdown-menu dropdown-menu-right" aria-labelledby="<%= id %>">
|
2017-01-25 19:01:23 +08:00
|
|
|
<li class="dropdown-header">
|
|
|
|
<%= t("users.settings.teams.edit.user_dropdown.role_label") %>
|
|
|
|
</li>
|
|
|
|
<%= bootstrap_form_for user_team,
|
|
|
|
url: update_role_path,
|
|
|
|
method: :put,
|
|
|
|
remote: true,
|
|
|
|
data: { id: 'update-role-form' } do |f| %>
|
|
|
|
<input type="hidden" name="user_team[role]" data-field="role" value="" %>
|
|
|
|
<% end %>
|
|
|
|
<li class="user-team-role <%= 'disabled' if user_team.guest? %>">
|
|
|
|
<% if user_team.guest? %>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= UserTeam.new(role: 0).role_str %>
|
|
|
|
<% else %>
|
|
|
|
<a href="#" data-action="submit-role" data-value="guest">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= UserTeam.new(role: 0).role_str %>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
<li class="user-team-role <%= 'disabled' if user_team.normal_user? %>">
|
|
|
|
<% if user_team.normal_user? %>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= UserTeam.new(role: 1).role_str %>
|
|
|
|
<% else %>
|
|
|
|
<a href="#" data-action="submit-role" data-value="normal_user">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= UserTeam.new(role: 1).role_str %>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
<li class="user-team-role <%= 'disabled' if user_team.admin? %>">
|
|
|
|
<% if user_team.admin? %>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= UserTeam.new(role: 2).role_str %>
|
|
|
|
<% else %>
|
|
|
|
<a href="#" data-action="submit-role" data-value="admin">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= UserTeam.new(role: 2).role_str %>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
<li role="separator" class="divider"></li>
|
|
|
|
<li>
|
|
|
|
<%= destroy_uo_link %>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<% end %>
|