scinote-web/app/views/users/settings/teams/_user_dropdown.html.erb
2017-02-01 14:44:47 +01:00

69 lines
2.5 KiB
Text

<% if user_team.user == user %>
<div class="btn btn-default btn-xs" type="button" disabled="disabled">
<span class="glyphicon glyphicon-cog"></span>
<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">
<span class="glyphicon glyphicon-cog"></span>
<span class="caret"></span>
</div>
<ul class="dropdown-menu" aria-labelledby="<%= id %>">
<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? %>
<span class="glyphicon glyphicon-ok"></span>
<%= UserTeam.new(role: 0).role_str %>
<% else %>
<a href="#" data-action="submit-role" data-value="guest">
<span class="glyphicon glyphicon-ok"></span>
<%= 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? %>
<span class="glyphicon glyphicon-ok"></span>
<%= UserTeam.new(role: 1).role_str %>
<% else %>
<a href="#" data-action="submit-role" data-value="normal_user">
<span class="glyphicon glyphicon-ok"></span>
<%= UserTeam.new(role: 1).role_str %>
</a>
<% end %>
</li>
<li class="user-team-role <%= 'disabled' if user_team.admin? %>">
<% if user_team.admin? %>
<span class="glyphicon glyphicon-ok"></span>
<%= UserTeam.new(role: 2).role_str %>
<% else %>
<a href="#" data-action="submit-role" data-value="admin">
<span class="glyphicon glyphicon-ok"></span>
<%= UserTeam.new(role: 2).role_str %>
</a>
<% end %>
</li>
<li role="separator" class="divider"></li>
<li>
<%= destroy_uo_link %>
</a>
</li>
</ul>
</div>
<% end %>