diff --git a/app/assets/javascripts/my_modules/repositories.js b/app/assets/javascripts/my_modules/repositories.js index 5cadda99d..77d10347f 100644 --- a/app/assets/javascripts/my_modules/repositories.js +++ b/app/assets/javascripts/my_modules/repositories.js @@ -1,6 +1,6 @@ /* eslint-disable no-param-reassign, no-use-before-define */ /* global DataTableHelpers PerfectScrollbar FilePreviewModal animateSpinner HelperModule -initAssignedTasksDropdown */ +initAssignedTasksDropdown I18n */ var MyModuleRepositories = (function() { const FULL_VIEW_MODAL = $('#myModuleRepositoryFullViewModal'); @@ -173,6 +173,11 @@ var MyModuleRepositories = (function() { drawCallback: function() { FULL_VIEW_TABLE.columns.adjust(); FilePreviewModal.init(); + renderFullViewRepositoryName( + tableContainer.attr('data-repository-name'), + tableContainer.attr('data-repository-snapshot-created') + ); + updateFullViewRowsCount(tableContainer.attr('data-assigned-items-count')); if (FULL_VIEW_TABLE_SCROLLBAR) { FULL_VIEW_TABLE_SCROLLBAR.update(); } else { @@ -397,10 +402,10 @@ var MyModuleRepositories = (function() { function initRepositoryFullView() { $('#assigned-items-container').on('click', '.action-buttons .full-screen', function(e) { var repositoryNameObject = $(this).closest('.assigned-repository-caret') - .find('.assigned-repository-title') - .clone(); + .find('.assigned-repository-title'); - FULL_VIEW_MODAL.find('.repository-name').html(repositoryNameObject); + + renderFullViewRepositoryName(repositoryNameObject.text()); FULL_VIEW_MODAL.modal('show'); $.getJSON($(this).data('table-url'), (data) => { FULL_VIEW_MODAL.find('.table-container').html(data.html); @@ -454,17 +459,31 @@ var MyModuleRepositories = (function() { function updateFullViewRowsCount(value) { FULL_VIEW_MODAL.data('rows-count', value); - FULL_VIEW_MODAL.find('.assigned-repository-title').attr('data-rows-count', `[${value}]`); + FULL_VIEW_MODAL.find('.repository-name').attr('data-rows-count', value); + } + + function renderFullViewRepositoryName(name, snapshotDate) { + var title; + var repositoryName = name || FULL_VIEW_MODAL.find('.repository-name').data('repository-name'); + + if (snapshotDate) { + title = I18n.t('my_modules.repository.full_view.modal_snapshot_header', { + repository_name: repositoryName, + snaphot_date: snapshotDate + }); + } else { + title = I18n.t('my_modules.repository.full_view.modal_live_header', { + repository_name: repositoryName + }); + } + FULL_VIEW_MODAL.find('.repository-name').data('repository-name', repositoryName); + FULL_VIEW_MODAL.find('.repository-name').html(title); } function initRepoistoryAssignView() { $('.repositories-dropdown-menu').on('click', '.repository', function(e) { var assignUrlModal = $(this).data('assign-url-modal'); var updateUrlModal = $(this).data('update-url-modal'); - var repositoryNameObject = $(this).find('.name').clone().addClass('assigned-repository-title'); - - FULL_VIEW_MODAL.find('.repository-name').html(repositoryNameObject); - FULL_VIEW_MODAL.data('rows-count', $(this).data('rows-count')); FULL_VIEW_MODAL.modal('show'); $.get($(this).data('table-url'), (data) => { FULL_VIEW_MODAL.find('.table-container').html(data.html); @@ -546,9 +565,10 @@ var MyModuleRepositories = (function() { UPDATE_REPOSITORY_MODAL.modal('hide'); HelperModule.flashAlertMsg(data.flash, 'success'); SELECTED_ROWS = {}; + $(FULL_VIEW_TABLE.table().container()).find('.dataTable') + .attr('data-assigned-items-count', data.rows_count) FULL_VIEW_TABLE.ajax.reload(null, false); reloadRepositoriesList(); - updateFullViewRowsCount(data.rows_count); renderFullViewAssignButtons(); }, error: function(data) { diff --git a/app/assets/javascripts/sitewide/dropdown_selector.js b/app/assets/javascripts/sitewide/dropdown_selector.js index 0986e4006..0f6f82cb9 100644 --- a/app/assets/javascripts/sitewide/dropdown_selector.js +++ b/app/assets/javascripts/sitewide/dropdown_selector.js @@ -63,10 +63,11 @@ var dropdownSelector = (function() { var modalContainerBottom = 0; var maxHeight = 0; - if (modalContainer.length) { - windowHeight = modalContainer.height() + modalContainer[0].getBoundingClientRect().top; - containerPositionLeft -= modalContainer[0].getBoundingClientRect().left; - modalContainerBottom = windowHeight - modalContainer[0].getBoundingClientRect().bottom; + if (modalContainer.length && windowHeight - modalContainer.height() > 100) { + let modalClientRect = modalContainer[0].getBoundingClientRect(); + windowHeight = modalContainer.height() + modalClientRect.top; + containerPositionLeft -= modalClientRect.left; + modalContainerBottom = windowHeight + modalClientRect.bottom; maxHeight += modalContainerBottom; } bottomSpace = windowHeight - containerPosition - containerHeight; diff --git a/app/assets/stylesheets/my_modules/repositories.scss b/app/assets/stylesheets/my_modules/repositories.scss index 06f05a0e3..80fef6af4 100644 --- a/app/assets/stylesheets/my_modules/repositories.scss +++ b/app/assets/stylesheets/my_modules/repositories.scss @@ -12,7 +12,7 @@ &::after { color: $color-alto; - content: attr(data-rows-count); + content: '[' attr(data-rows-count) ']'; display: inline-block; line-height: 22px; padding-left: 5px; @@ -211,16 +211,16 @@ flex-grow: 1; max-width: calc(100% - 20px); - .assigned-repository-title { + .repository-name { @include my-module-repository-title; @include font-h2; } .breadcrumbs { - @include font-small; align-items: center; color: $color-silver-chalice; display: flex; + font-size: 10px; height: 20px; width: 90%; @@ -367,6 +367,7 @@ .list-group-item-text { + @include font-small; color: $color-silver-chalice; } diff --git a/app/assets/stylesheets/shared_styles/constants/colors.scss b/app/assets/stylesheets/shared_styles/constants/colors.scss index d8cab82b5..d5d69dfd7 100644 --- a/app/assets/stylesheets/shared_styles/constants/colors.scss +++ b/app/assets/stylesheets/shared_styles/constants/colors.scss @@ -45,7 +45,7 @@ $color-alabaster: $color-concrete; $color-gainsboro: $color-concrete; $color-silver: $color-alto; $color-dove-gray: $color-volcano; -$color-emperor: $color-volcano; +$color-emperor: $color-black; $brand-default: $color-white; $brand-info: $brand-focus; $brand-other: $brand-success; diff --git a/app/views/my_modules/repositories/_full_view_modal.html.erb b/app/views/my_modules/repositories/_full_view_modal.html.erb index a5c4d3ffd..89292e0aa 100644 --- a/app/views/my_modules/repositories/_full_view_modal.html.erb +++ b/app/views/my_modules/repositories/_full_view_modal.html.erb @@ -10,7 +10,8 @@ / <%= @my_module.name %> -