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 %> -
+
+
diff --git a/app/views/my_modules/repositories/_full_view_snapshot_table.html.erb b/app/views/my_modules/repositories/_full_view_snapshot_table.html.erb index 2f234a907..f39e6cefc 100644 --- a/app/views/my_modules/repositories/_full_view_snapshot_table.html.erb +++ b/app/views/my_modules/repositories/_full_view_snapshot_table.html.erb @@ -2,6 +2,9 @@ data-id="<%= @repository_snapshot.id %>" data-type="snapshot" data-source="<%= index_dt_my_module_repository_snapshot_path(@my_module, @repository_snapshot) %>" + data-repository-name="<%= @repository_snapshot.name %>" + data-repository-snapshot-created="<%= l(@repository_snapshot.updated_at, format: :full) %>" + data-assigned-items-count="<%= @repository_snapshot.repository_rows.count %>" data-default-order="<%= default_snapshot_table_order_as_js_array %>" data-default-table-columns="<%= default_snapshot_table_columns %>" data-load-state-url="<%= repository_load_table_state_path(@repository_snapshot) %>" diff --git a/app/views/my_modules/repositories/_full_view_table.html.erb b/app/views/my_modules/repositories/_full_view_table.html.erb index aca0e185b..bc0cc541c 100644 --- a/app/views/my_modules/repositories/_full_view_table.html.erb +++ b/app/views/my_modules/repositories/_full_view_table.html.erb @@ -4,6 +4,8 @@ data-source="<%= index_dt_my_module_repository_path(@my_module, @repository) %>" data-default-order="<%= default_table_order_as_js_array %>" data-default-table-columns="<%= default_table_columns %>" + data-repository-name="<%= @repository.name %>" + data-assigned-items-count="<%= @my_module.repository_rows_count(@repository) %>" data-load-state-url="<%= repository_load_table_state_path(@repository) %>" data-versions-sidebar-url="<%= full_view_sidebar_my_module_repository_snapshots_path(@my_module, @repository) %>" > diff --git a/app/views/my_modules/repositories/_repositories_dropdown_list.html.erb b/app/views/my_modules/repositories/_repositories_dropdown_list.html.erb index b225ba70b..456ecb05a 100644 --- a/app/views/my_modules/repositories/_repositories_dropdown_list.html.erb +++ b/app/views/my_modules/repositories/_repositories_dropdown_list.html.erb @@ -10,7 +10,7 @@ <% end %> - <%= repository.name %> + <%= repository.name %> <% if assigned_items_count.positive? %> diff --git a/app/views/my_modules/repositories/_repositories_list.html.erb b/app/views/my_modules/repositories/_repositories_list.html.erb index 907c64664..c809099a0 100644 --- a/app/views/my_modules/repositories/_repositories_list.html.erb +++ b/app/views/my_modules/repositories/_repositories_list.html.erb @@ -7,7 +7,8 @@ data-parent="#assigned-items-container" > - + + <%= repository.name %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index f26382ce3..387d8e57b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -791,6 +791,9 @@ en: repository: head_title: "%{project} | %{module} | Inventory %{repository}" export: 'Export' + full_view: + modal_live_header: '%{repository_name}: Live version' + modal_snapshot_header: '%{repository_name}: Snapshot of %{snaphot_date}' snapshots: simple_view: live_bottom_label: 'Live version' @@ -1067,7 +1070,7 @@ en: share_inventory: "Share" view_only_permission_label: "You have veiw-only permission" show_per_page: "Show %{number} per page" - filter_inventory: "Filter inventory" + filter_inventory: "Filter inventory item" options_dropdown: import_items: 'Import items'