Hide checkbox column when user is not admin

This commit is contained in:
Urban Rotnik 2020-07-02 14:29:18 +02:00
parent 876cfada9a
commit 1bf8198129
3 changed files with 18 additions and 6 deletions

View file

@ -47,7 +47,7 @@
destroy: true,
columnDefs: [{
targets: 0,
visible: true,
visible: !$('.repositories-index').data('readonly'),
searchable: false,
orderable: false,
render: function() {

View file

@ -1,13 +1,25 @@
.repositories-index {
&.active {
[data-view-mode="archived"] {
display: none
display: none;
}
}
&.archived {
[data-view-mode="active"] {
display: none
display: none;
}
}
&[data-readonly="true"] {
.main-actions {
.toolbar {
display: none;
}
.filter-container {
margin-left: auto;
}
}
}
}

View file

@ -3,7 +3,8 @@
<% if current_team %>
<%= render partial: "sidebar", locals: { repositories: @repositories, archived: params[:archived] } %>
<div class="content-pane flexible <%= params[:archived] ? :archived : :active %> repositories-index">
<div class="content-pane flexible <%= params[:archived] ? :archived : :active %> 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>
<h1 data-view-mode="archived"><%= t('libraries.index.head_title_archived') %></h1>
@ -26,8 +27,7 @@
<!-- Active table template -->
<template id="activeRepositoriesListTable">
<table id="repositoriesList" class="table"
data-source="<%= team_repositories_path(current_team, format: :json) %>"
>
data-source="<%= team_repositories_path(current_team, format: :json) %>">
<thead>
<tr>
<th>