mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 02:04:33 +08:00
add library sidebar and create new library button [fixes SCI-2121]
This commit is contained in:
parent
62858bc14f
commit
81df97f008
7 changed files with 63 additions and 14 deletions
8
app/assets/stylesheets/themes/repositories.scss
Normal file
8
app/assets/stylesheets/themes/repositories.scss
Normal file
|
@ -0,0 +1,8 @@
|
|||
#repository-columns-dropdown {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.new-repository-button {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
@import "mixins";
|
||||
@import "main_navigation";
|
||||
@import "buttons";
|
||||
|
||||
@import "repositories";
|
||||
/** Layout **/
|
||||
|
||||
body,
|
||||
|
|
|
@ -11,6 +11,8 @@ class RepositoriesController < ApplicationController
|
|||
before_action :check_create_permissions, only:
|
||||
%i(create_new_modal create copy_modal copy)
|
||||
|
||||
# layout 'fluid'
|
||||
|
||||
def index
|
||||
unless @repositories.length.zero? && current_team
|
||||
redirect_to repository_path(@repositories.first) and return
|
||||
|
@ -46,7 +48,7 @@ class RepositoriesController < ApplicationController
|
|||
if @repository.save
|
||||
flash[:success] = t('repositories.index.modal_create.success_flash',
|
||||
name: @repository.name)
|
||||
render json: { url: team_repositories_path(repository: @repository) },
|
||||
render json: { url: repository_path(@repository) },
|
||||
status: :ok
|
||||
else
|
||||
render json: @repository.errors,
|
||||
|
|
23
app/views/repositories/_sidebar.html.erb
Normal file
23
app/views/repositories/_sidebar.html.erb
Normal file
|
@ -0,0 +1,23 @@
|
|||
<%= content_for :sidebar do %>
|
||||
<div id="slide-panel" class="visible">
|
||||
<div class="sidebar-header">
|
||||
<div class="sidebar-header-title">
|
||||
<h5><%=t "libraries.sidebar.title" %></h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sidebar-header-toggle">
|
||||
<a href="" id="toggle-sidebar-link">
|
||||
<span class="glyphicon glyphicon-play-circle"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="tree">
|
||||
<ul>
|
||||
<% repositories.each do |repository| %>
|
||||
<% cache repository do %>
|
||||
<li><%= link_to repository.name, repository_path(repository) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,6 +1,7 @@
|
|||
<% provide(:head_title, t("libraries.index.head_title")) %>
|
||||
|
||||
<% if current_team %>
|
||||
<%= render partial: "sidebar", locals: { repositories: @repositories } %>
|
||||
<%
|
||||
# show only if no repositories present. If the team will have them we will
|
||||
# handle this in left side navigation bar
|
||||
|
@ -9,10 +10,11 @@
|
|||
<strong><%=t 'libraries.index.no_libraries.text' %></strong>
|
||||
<h2><strong><%=t 'libraries.index.no_libraries.title' %><strong></h2>
|
||||
<br />
|
||||
<a class="btn btn-info btn-lg"
|
||||
id="create-new-repository"
|
||||
href="<%= create_modal_team_repositories_path(current_team) %>"
|
||||
data-remote="true"><%=t 'libraries.index.no_libraries.create_new_button' %></a>
|
||||
<%= link_to t('libraries.index.no_libraries.create_new_button'),
|
||||
create_modal_team_repositories_path(current_team),
|
||||
class: "btn btn-info btn-lg",
|
||||
id: "create-new-repository",
|
||||
remote: true %>
|
||||
</div>
|
||||
<% else %>
|
||||
<!-- If member of no teams -->
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<% provide(:head_title, t("libraries.show.head_title", library: @repository.name)) %>
|
||||
<%= stylesheet_link_tag 'datatables' %>
|
||||
|
||||
<%= render partial: "repositories/delete_record_modal.html.erb" %>
|
||||
<%= render partial: "repositories/delete_column_modal.html.erb" %>
|
||||
<%= render partial: 'repositories/export_repository_modal.html.erb',
|
||||
locals: { repository: @repository } %>
|
||||
|
||||
<%= render partial: "sidebar", locals: { repositories: @repositories } %>
|
||||
<div id="alert-container"></div>
|
||||
|
||||
<div id="repository-toolbar">
|
||||
|
@ -73,7 +70,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="datatables-buttons" style="display: inline;">
|
||||
<div class="new-repository-button">
|
||||
<% if can_create_repositories?(@repository.team) %>
|
||||
<%= link_to t('libraries.index.no_libraries.create_new_button'),
|
||||
create_modal_team_repositories_path(@repository.team),
|
||||
class: "btn btn-default",
|
||||
id: "create-new-repository",
|
||||
remote: true %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="repository-columns-dropdown" class="dropdown">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
<%= t('repositories.columns') %>
|
||||
|
@ -136,9 +144,13 @@
|
|||
%>
|
||||
<%= render partial: 'repositories/import_repository_records_modal.html.erb',
|
||||
locals: { repository: @repository } %>
|
||||
|
||||
<%= render partial: "repositories/delete_record_modal.html.erb" %>
|
||||
<%= render partial: "repositories/delete_column_modal.html.erb" %>
|
||||
<%= render partial: 'repositories/export_repository_modal.html.erb',
|
||||
locals: { repository: @repository } %>
|
||||
|
||||
<%= javascript_include_tag 'repositories/edit', 'data-turbolinks-track' => true %>
|
||||
|
||||
|
||||
<%= stylesheet_link_tag 'datatables' %>
|
||||
<%= javascript_include_tag 'repositories/repository_datatable' %>
|
||||
<%= javascript_include_tag "repositories/show", "data-turbolinks-track" => true %>
|
||||
<%= javascript_include_tag "repositories/index", "data-turbolinks-track" => true %>
|
||||
|
|
|
@ -986,6 +986,8 @@ en:
|
|||
default_column: 'Name'
|
||||
|
||||
libraries:
|
||||
sidebar:
|
||||
title: "Libraries"
|
||||
index:
|
||||
head_title: "Libraries"
|
||||
no_libraries:
|
||||
|
|
Loading…
Reference in a new issue