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"
<% if current_user.teams.length > 1 && can_create_teams? %>
<li role="separator"
class="divider"></li>
<% end %>
<li data-hook="new-team-btn">
<li>
<%= link_to new_team_path do %>
<span class="glyphicon glyphicon-plus"></span>
<%= t('users.settings.teams.index.new_team') %>
<% end %>
</li>
<% end %>
</ul>
</li>
<% end %>
@ -258,7 +257,8 @@
<%= image_tag avatar_path(current_user, :icon_small),
class: "avatar" %>
</a>
<ul class="dropdown-menu" data-hook="navigation-user-menu">
<% if current_user.teams.length > 1 || can_create_teams? %>
<ul class="dropdown-menu">
<li>
<%= link_to t('nav.user.settings'),
'/settings',
@ -271,6 +271,7 @@
method: :delete %>
</li>
</ul>
<% end %>
</li>
</ul>
</div>

View file

@ -13,6 +13,7 @@
<% else %>
<em><%= t("users.settings.teams.index.no_teams") %></em>
<% end %>
<% 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>
@ -21,6 +22,7 @@
</span>
<% end %>
</span>
<% end %>
</div>
<% if @member_of > 0 %>