Add empty repositories index page [SCI-5248]

This commit is contained in:
Oleksii Kriuchykhin 2020-12-22 12:08:13 +01:00
parent 324c268594
commit 6b2a94f045
3 changed files with 35 additions and 1 deletions

View file

@ -26,7 +26,9 @@ class RepositoriesController < ApplicationController
def index
respond_to do |format|
format.html do; end
format.html do
render 'empty_index' if @repositories.blank?
end
format.json do
render json: prepare_repositories_datatable(@repositories, current_team, params)
end

View file

@ -0,0 +1,29 @@
<% provide(:head_title, t('libraries.index.head_title')) %>
<% provide(:container_class, 'no-second-nav-container') %>
<%= render partial: 'sidebar', locals: { repositories: @repositories, archived: false } %>
<div class="content-pane flexible repositories-index" data-readonly="<%= !current_user.is_admin_of_team?(current_team) %>">
<div class="content-header">
<h1 data-view-mode="active"><%= t('libraries.index.head_title') %></h1>
</div>
<div class="content-body">
<h1>
<%= t('repositories.index.empty_title') %>
</h1>
<% if can_create_repositories?(current_team) %>
<h5>
<%= t('repositories.index.empty_description_with_create') %>
</h5>
<a id="createRepoBtn" class="btn btn-primary create-new-repository" data-remote="true" href="<%= create_modal_team_repositories_path(current_team) %>">
<span class="fas fa-plus"></span>
<span class="hidden-xs"><%= t('libraries.index.no_libraries.create_new_button') %></span>
</a>
<% else %>
<h5>
<%= t('repositories.index.empty_description_no_create') %>
</h5>
<% end %>
</div>
</div>
<%= javascript_include_tag 'repositories/index' %>

View file

@ -1188,6 +1188,9 @@ en:
index:
head_title: "Inventories"
title: "Inventories"
empty_title: "Your team has no inventories yet"
empty_description_no_create: "It would be a shame to waste all this space. Sadly you dont have permission to add inventories. You can ask your team admin to grant you that permission."
empty_description_with_create: "It would be a shame to waste all this space. Create your first inventory now"
add_new_repository_tab: "Add inventory"
delete_flash: "\"%{name}\" inventory was successfully deleted!"
rename_flash: "\"%{old_name}\" inventory was successfully renamed to \"%{new_name}\"!"