add permissions in views

This commit is contained in:
zmagod 2018-01-24 13:59:57 +01:00
parent 9b836d04fa
commit 76b08e6ac9
2 changed files with 34 additions and 31 deletions

View file

@ -116,17 +116,16 @@
</li>
<% end %>
<% end %>
<% if current_user.teams.length > 1 %>
<li data-hook="new-team-btn"
role="separator"
class="divider"></li>
<% if current_user.teams.length > 1 && can_create_teams? %>
<li role="separator"
class="divider"></li>
<li>
<%= link_to new_team_path do %>
<span class="glyphicon glyphicon-plus"></span>
<%= t('users.settings.teams.index.new_team') %>
<% end %>
</li>
<% end %>
<li data-hook="new-team-btn">
<%= link_to new_team_path do %>
<span class="glyphicon glyphicon-plus"></span>
<%= t('users.settings.teams.index.new_team') %>
<% end %>
</li>
</ul>
</li>
<% end %>
@ -258,19 +257,21 @@
<%= image_tag avatar_path(current_user, :icon_small),
class: "avatar" %>
</a>
<ul class="dropdown-menu" data-hook="navigation-user-menu">
<li>
<%= link_to t('nav.user.settings'),
'/settings',
data: { turbolinks: false } %>
</li>
<li role="separator" class="divider"></li>
<li>
<%= link_to t('nav.user.logout'),
destroy_user_session_path,
method: :delete %>
</li>
</ul>
<% if current_user.teams.length > 1 || can_create_teams? %>
<ul class="dropdown-menu">
<li>
<%= link_to t('nav.user.settings'),
'/settings',
data: { turbolinks: false } %>
</li>
<li role="separator" class="divider"></li>
<li>
<%= link_to t('nav.user.logout'),
destroy_user_session_path,
method: :delete %>
</li>
</ul>
<% end %>
</li>
</ul>
</div>

View file

@ -13,14 +13,16 @@
<% else %>
<em><%= t("users.settings.teams.index.no_teams") %></em>
<% end %>
<span id="new-team-button">
<%= link_to new_team_path, class: "btn btn-default", style: "margin-left: 30px;" do %>
<span class="glyphicon glyphicon-plus"></span>
<span class="hidden-xs">
<%= t("users.settings.teams.index.new_team") %>
</span>
<% end %>
</span>
<% if can_create_teams? %>
<span id="new-team-button">
<%= link_to new_team_path, class: "btn btn-default", style: "margin-left: 30px;" do %>
<span class="glyphicon glyphicon-plus"></span>
<span class="hidden-xs">
<%= t("users.settings.teams.index.new_team") %>
</span>
<% end %>
</span>
<% end %>
</div>
<% if @member_of > 0 %>