hides the create new inventory button for non admin users [fixes SCI-2296]

This commit is contained in:
zmagod 2018-04-13 13:39:58 +02:00
parent 0815111cae
commit bef166ff30
3 changed files with 14 additions and 9 deletions

View file

@ -9,7 +9,7 @@ class RepositoriesController < ApplicationController
before_action :check_manage_permissions, only: before_action :check_manage_permissions, only:
%i(destroy destroy_modal rename_modal update) %i(destroy destroy_modal rename_modal update)
before_action :check_create_permissions, only: before_action :check_create_permissions, only:
%i(create_new_modal create copy_modal copy) %i(create_modal create copy_modal copy)
layout 'fluid' layout 'fluid'

View file

@ -6,15 +6,19 @@
# show only if no repositories present. If the team will have them we will # show only if no repositories present. If the team will have them we will
# handle this in left side navigation bar # handle this in left side navigation bar
%> %>
<div class="jumbotron text-center" style="margin-top:25%"> <div class="jumbotron text-center" style="margin-top:18%">
<strong><%=t 'libraries.index.no_libraries.text' %></strong> <strong><%=t 'libraries.index.no_libraries.text' %></strong>
<h2><strong><%=t 'libraries.index.no_libraries.title' %><strong></h2> <% if can_create_repositories?(current_team) %>
<br /> <h2><strong><%=t 'libraries.index.no_libraries.title' %><strong></h2>
<%= link_to t('libraries.index.no_libraries.create_new_button'), <br />
create_modal_team_repositories_path(current_team), <%= link_to t('libraries.index.no_libraries.create_new_button'),
class: "btn btn-primary btn-lg", create_modal_team_repositories_path(current_team),
id: "create-new-repository", class: "btn btn-primary btn-lg",
remote: true %> id: "create-new-repository",
remote: true %>
<% else %>
<h2><strong><%=t 'libraries.index.no_libraries.no_permission_title' %><strong></h2>
<% end %>
</div> </div>
<% else %> <% else %>
<!-- If member of no teams --> <!-- If member of no teams -->

View file

@ -1026,6 +1026,7 @@ en:
index: index:
head_title: "Inventories" head_title: "Inventories"
no_libraries: no_libraries:
no_permission_title: "You don't have permission to create new inventory. Please contact your team administrator."
text: "You don't have any inventories." text: "You don't have any inventories."
title: "Please create your first Inventory" title: "Please create your first Inventory"
create_new_button: "Create New Inventory" create_new_button: "Create New Inventory"