Show selected snapshot in sidebar

This commit is contained in:
aignatov-bio 2020-05-28 15:18:26 +02:00
parent 183f5af7de
commit 368ee8a689
3 changed files with 24 additions and 4 deletions
app
assets
javascripts/my_modules
stylesheets/my_modules
views/my_modules/repositories

View file

@ -221,7 +221,7 @@ var MyModuleRepositories = (function() {
versionsSidebar.find('.list-group-item').removeClass('active');
versionsSidebar.find(`[data-id="${currentId}"]`).addClass('active');
if (!versionsSidebar.find(`[data-id="${currentId}"]`).data('selected')) {
if (versionsSidebar.find(`[data-id="${currentId}"]`).attr('data-selected') == 'false') {
$('#setDefaultVersionButton').parent().removeClass('hidden');
} else {
$('#setDefaultVersionButton').parent().addClass('hidden');
@ -419,8 +419,8 @@ var MyModuleRepositories = (function() {
data: data,
success: function() {
let versionsList = FULL_VIEW_MODAL.find('.repository-versions-list');
versionsList.find('.list-group-item').data('selected', false);
versionsList.find('.list-group-item.active').data('selected', true);
versionsList.find('.list-group-item').attr('data-selected', false);
versionsList.find('.list-group-item.active').attr('data-selected', true);
$('#setDefaultVersionButton').parent().addClass('hidden');
animateSpinner(null, false);
}

View file

@ -392,6 +392,26 @@
background-color: $color-concrete;
border: 0;
border-radius: 0;
margin: .5em 0;
position: relative;
&[data-selected="true"] {
&::after {
background-color: $brand-primary;
content: '';
height: 100%;
position: absolute;
right: 0;
top: 0;
width: .25em;
}
&.active {
&::after {
background-color: $color-black;
}
}
}
.list-group-item-text {

View file

@ -1,6 +1,6 @@
<div class="list-group-item repository-snapshot-item <%= repository_snapshot.status %>"
data-id="<%= repository_snapshot.id %>"
data-selected="<%= repository_snapshot.selected %>"
data-selected="<%= repository_snapshot.selected ? 'true' : 'false' %>"
data-status-url="<%= status_my_module_repository_snapshot_path(@my_module, repository_snapshot) %>"
data-version-item-url="<%= my_module_repository_snapshot_path(@my_module, repository_snapshot) %>">
<div class="row">