scinote-web/app/views/users/settings/organizations/_user_dropdown.html.erb
2016-02-12 16:52:43 +01:00

62 lines
No EOL
2.7 KiB
Text

<% if user_organization.user == user %>
<div class="btn btn-default btn-xs" type="button" disabled="disabled">
<span class="glyphicon glyphicon-cog"></span>
<%= t("users.settings.organizations.edit.user_dropdown.btn_label") %>&nbsp;
<span class="caret"></span>
</div>
<% else %>
<% id = "user-#{user_organization.user.id}-dropdown" %>
<div class="dropdown dropdown-organizations-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>
<%= t("users.settings.organizations.edit.user_dropdown.btn_label") %>&nbsp;
<span class="caret"></span>
</div>
<ul class="dropdown-menu" aria-labelledby="<%= id %>">
<li class="dropdown-header">
<%= t("users.settings.organizations.edit.user_dropdown.role_label") %>
</li>
<%= bootstrap_form_for user_organization, url: update_role_path, method: :put, remote: true, data: { id: "update-role-form" } do |f| %>
<input type="hidden" name="user_organization[role]" data-field="role" value="" %>
<% end %>
<li class="user-organization-role <%= "disabled" if user_organization.guest? %>">
<% if user_organization.guest? %>
<span class="glyphicon glyphicon-ok"></span>
<%= UserOrganization.new(role: 0).role_str %>
<% else %>
<a href="#" data-action="submit-role" data-value="guest">
<span class="glyphicon glyphicon-ok"></span>
<%= UserOrganization.new(role: 0).role_str %>
</a>
<% end %>
</li>
<li class="user-organization-role <%= "disabled" if user_organization.normal_user? %>">
<% if user_organization.normal_user? %>
<span class="glyphicon glyphicon-ok"></span>
<%= UserOrganization.new(role: 1).role_str %>
<% else %>
<a href="#" data-action="submit-role" data-value="normal_user">
<span class="glyphicon glyphicon-ok"></span>
<%= UserOrganization.new(role: 1).role_str %>
</a>
<% end %>
</li>
<li class="user-organization-role <%= "disabled" if user_organization.admin? %>">
<% if user_organization.admin? %>
<span class="glyphicon glyphicon-ok"></span>
<%= UserOrganization.new(role: 2).role_str %>
<% else %>
<a href="#" data-action="submit-role" data-value="admin">
<span class="glyphicon glyphicon-ok"></span>
<%= UserOrganization.new(role: 2).role_str %>
</a>
<% end %>
</li>
<li role="separator" class="divider"></li>
<li>
<%= destroy_uo_link %>
</a>
</li>
</ul>
</div>
<% end %>