diff --git a/VERSION b/VERSION index 5edffce6d..f1e40e814 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.39.0 +1.39.1.1 diff --git a/app/assets/javascripts/experiments/show.js b/app/assets/javascripts/experiments/show.js index 56f152720..26e18c699 100644 --- a/app/assets/javascripts/experiments/show.js +++ b/app/assets/javascripts/experiments/show.js @@ -81,16 +81,19 @@ dropdownSelector.init(myModuleUserSelector, { closeOnSelect: true, labelHTML: true, - tagClass: 'my-module-user-tags', tagLabel: (data) => { - return `${data.label} - ${data.label}`; + return `
+ ${data.label} + ${data.label} +
`; }, optionLabel: (data) => { if (data.params.avatar_url) { - return ` - ${data.label} - ${data.label}`; + return `
+ + ${data.label} + ${data.label} +
`; } return data.label; diff --git a/app/assets/javascripts/my_modules/repositories.js b/app/assets/javascripts/my_modules/repositories.js index 1906247d5..e834e93be 100644 --- a/app/assets/javascripts/my_modules/repositories.js +++ b/app/assets/javascripts/my_modules/repositories.js @@ -747,7 +747,7 @@ var MyModuleRepositories = (function() { function openUpdateRecordsModal(downstream) { var updateUrl = FULL_VIEW_MODAL.data('update-url-modal'); - $.get(updateUrl, { selected_rows: SELECTED_ROWS, downstream: downstream }, function(data) { + $.post(updateUrl, { selected_rows: SELECTED_ROWS, downstream: downstream }, function(data) { var assignList; var assignListScrollbar; var unassignList; @@ -766,7 +766,7 @@ var MyModuleRepositories = (function() { function openAssignRecordsModal(downstream) { var assignUrl = FULL_VIEW_MODAL.data('assign-url-modal'); - $.get(assignUrl, { selected_rows: Object.keys(SELECTED_ROWS), downstream: downstream }, function(data) { + $.post(assignUrl, { selected_rows: Object.keys(SELECTED_ROWS), downstream: downstream }, function(data) { UPDATE_REPOSITORY_MODAL.find('.modal-content').html(data.html); UPDATE_REPOSITORY_MODAL.data('update-url', data.update_url); UPDATE_REPOSITORY_MODAL.modal('show'); diff --git a/app/assets/javascripts/sitewide/constants.js.erb b/app/assets/javascripts/sitewide/constants.js.erb deleted file mode 100644 index bcbd62513..000000000 --- a/app/assets/javascripts/sitewide/constants.js.erb +++ /dev/null @@ -1,24 +0,0 @@ -const GLOBAL_CONSTANTS = { - NAME_TRUNCATION_LENGTH: <%= Constants::NAME_TRUNCATION_LENGTH %>, - NAME_MAX_LENGTH: <%= Constants::NAME_MAX_LENGTH %>, - NAME_MIN_LENGTH: <%= Constants::NAME_MIN_LENGTH %>, - TEXT_MAX_LENGTH: <%= Constants::TEXT_MAX_LENGTH %>, - TABLE_CARD_MIN_WIDTH: 340, <%# pixels %> - TABLE_CARD_GAP: 16, <%# pixels %> - FILENAME_TRUNCATION_LENGTH: <%= Constants::FILENAME_TRUNCATION_LENGTH %>, - FILE_MAX_SIZE_MB: parseInt($('meta[name="max-file-size"]').attr('content'), 10), - IS_SAFARI: /^((?!chrome|android).)*safari/i.test(navigator.userAgent), - REPOSITORY_LIST_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_LIST_ITEMS_PER_COLUMN %>, - REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN %>, - REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN %>, - HAS_UNSAVED_DATA_CLASS_NAME: 'has-unsaved-data', - DEFAULT_ELEMENTS_PER_PAGE: <%= Constants::DEFAULT_ELEMENTS_PER_PAGE %>, - FILENAME_MAX_LENGTH: <%= Constants::FILENAME_MAX_LENGTH %>, - FAST_STATUS_POLLING_INTERVAL: <%= Constants::FAST_STATUS_POLLING_INTERVAL %>, - SLOW_STATUS_POLLING_INTERVAL: <%= Constants::SLOW_STATUS_POLLING_INTERVAL %>, - ASSET_POLLING_INTERVAL: <%= Constants::ASSET_POLLING_INTERVAL %>, - ASSET_SYNC_URL: '<%= Constants::ASSET_SYNC_URL %>', - GLOBAL_SEARCH_PREVIEW_LIMIT: <%= Constants::GLOBAL_SEARCH_PREVIEW_LIMIT %>, - SEARCH_LIMIT: <%= Constants::SEARCH_LIMIT %>, - SCINOTE_EDIT_RESTRICTED_EXTENSIONS: <%= Constants::SCINOTE_EDIT_RESTRICTED_EXTENSIONS %> -}; diff --git a/app/assets/javascripts/sitewide/zebra_print.js b/app/assets/javascripts/sitewide/zebra_print.js index aacd4be0e..82f668c27 100644 --- a/app/assets/javascripts/sitewide/zebra_print.js +++ b/app/assets/javascripts/sitewide/zebra_print.js @@ -182,7 +182,7 @@ var zebraPrint = (function() { repository_id: int } */ - print: function(modalUrl, progressModal, printModal, printData) { + print: function(modalUrl, progressModal, printModal, printData, finishedCallback = null) { var modal = $(progressModal); $.ajax({ method: 'GET', @@ -224,7 +224,7 @@ var zebraPrint = (function() { } }).fail(() => { HelperModule.flashAlertMsg(I18n.t('repository_row.modal_print_label.general_error'), 'danger'); - }); + }).always(() => { if (finishedCallback) finishedCallback(); }); } }; }()); diff --git a/app/assets/stylesheets/shared/datatables.scss b/app/assets/stylesheets/shared/datatables.scss index aea870e4c..10ab47ae3 100644 --- a/app/assets/stylesheets/shared/datatables.scss +++ b/app/assets/stylesheets/shared/datatables.scss @@ -36,3 +36,9 @@ table.dataTable.table--resizable-columns { } } } + +div.dataTables_wrapper div.dataTables_processing { + // This overrides default library behaviour, where the 'Processing' element + // can go off-screen on large tables due to top: 50% positioning. + top: 150px !important; +} diff --git a/app/controllers/global_constants_controller.rb b/app/controllers/global_constants_controller.rb new file mode 100644 index 000000000..6ca95b4c5 --- /dev/null +++ b/app/controllers/global_constants_controller.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class GlobalConstantsController < ApplicationController + before_action :load_global_constants + skip_before_action :authenticate_user!, only: :index + skip_before_action :verify_authenticity_token, only: :index + + def index; end + + private + + def load_global_constants + @global_constants = { + NAME_TRUNCATION_LENGTH: Constants::NAME_TRUNCATION_LENGTH, + NAME_MAX_LENGTH: Constants::NAME_MAX_LENGTH, + NAME_MIN_LENGTH: Constants::NAME_MIN_LENGTH, + TEXT_MAX_LENGTH: Constants::TEXT_MAX_LENGTH, + TABLE_CARD_MIN_WIDTH: 340, + TABLE_CARD_GAP: 16, + FILENAME_TRUNCATION_LENGTH: Constants::FILENAME_TRUNCATION_LENGTH, + FILE_MAX_SIZE_MB: Rails.configuration.x.file_max_size_mb, + REPOSITORY_LIST_ITEMS_PER_COLUMN: Constants::REPOSITORY_LIST_ITEMS_PER_COLUMN, + REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN: Constants::REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN, + REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN: Constants::REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN, + HAS_UNSAVED_DATA_CLASS_NAME: 'has-unsaved-data', + DEFAULT_ELEMENTS_PER_PAGE: Constants::DEFAULT_ELEMENTS_PER_PAGE, + FILENAME_MAX_LENGTH: Constants::FILENAME_MAX_LENGTH, + FAST_STATUS_POLLING_INTERVAL: Constants::FAST_STATUS_POLLING_INTERVAL, + SLOW_STATUS_POLLING_INTERVAL: Constants::SLOW_STATUS_POLLING_INTERVAL, + ASSET_POLLING_INTERVAL: Constants::ASSET_POLLING_INTERVAL, + ASSET_SYNC_URL: Constants::ASSET_SYNC_URL, + GLOBAL_SEARCH_PREVIEW_LIMIT: Constants::GLOBAL_SEARCH_PREVIEW_LIMIT, + SEARCH_LIMIT: Constants::SEARCH_LIMIT, + SCINOTE_EDIT_RESTRICTED_EXTENSIONS: Constants::SCINOTE_EDIT_RESTRICTED_EXTENSIONS, + SCINOTE_EDIT_LATEST_JSON_URL: Constants::SCINOTE_EDIT_LATEST_JSON_URL + } + end +end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e17486afc..da30ee736 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -9,15 +9,16 @@ class RepositoriesController < ApplicationController include RepositoriesDatatableHelper include MyModulesHelper + before_action :switch_team_with_param, only: %i(index) before_action :load_repository, except: %i(index create create_modal sidebar archive restore actions_toolbar - export_modal export_repositories list) + export_repositories list) before_action :load_repositories, only: %i(index list) before_action :load_repositories_for_archiving, only: :archive before_action :load_repositories_for_restoring, only: :restore before_action :check_view_all_permissions, only: %i(index sidebar list) before_action :check_view_permissions, except: %i(index create_modal create update destroy parse_sheet import_records sidebar archive restore actions_toolbar - export_modal export_repositories list) + export_repositories list) before_action :check_manage_permissions, only: %i(rename_modal update) before_action :check_delete_permissions, only: %i(destroy destroy_modal) before_action :check_archive_permissions, only: %i(archive restore) @@ -83,7 +84,6 @@ class RepositoriesController < ApplicationController def show respond_to do |format| format.html do - current_team_switch(@repository.team) unless @repository.shared_with?(current_team) @display_edit_button = can_create_repository_rows?(@repository) @display_delete_button = can_delete_repository_rows?(@repository) @display_duplicate_button = can_create_repository_rows?(@repository) @@ -470,7 +470,7 @@ class RepositoriesController < ApplicationController def load_repository repository_id = params[:id] || params[:repository_id] - @repository = Repository.viewable_by_user(current_user).find_by(id: repository_id) + @repository = Repository.viewable_by_user(current_user, current_user.teams).find_by(id: repository_id) render_404 unless @repository end @@ -515,6 +515,7 @@ class RepositoriesController < ApplicationController end def check_view_permissions + current_team_switch(@repository.team) unless @repository.shared_with?(current_team) render_403 unless can_read_repository?(@repository) end diff --git a/app/controllers/results_controller.rb b/app/controllers/results_controller.rb index fe7d81484..36ba9ff91 100644 --- a/app/controllers/results_controller.rb +++ b/app/controllers/results_controller.rb @@ -3,6 +3,7 @@ class ResultsController < ApplicationController include Breadcrumbs include TeamsHelper + before_action :load_my_module before_action :load_vars, only: %i(destroy elements assets upload_attachment archive restore destroy update_view_state update_asset_view_mode update duplicate) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 8280193e0..5623e71cc 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -114,7 +114,7 @@ class SearchController < ApplicationController return when 'repository_rows' @model = RepositoryRow - search_by_name(RepositoryRow) + search_by_name render json: @records, each_serializer: GlobalSearch::RepositoryRowSerializer, diff --git a/app/javascript/vue/components/action_toolbar.vue b/app/javascript/vue/components/action_toolbar.vue index ea4678416..f0957ab4b 100644 --- a/app/javascript/vue/components/action_toolbar.vue +++ b/app/javascript/vue/components/action_toolbar.vue @@ -11,7 +11,7 @@
{{ i18n.t('action_toolbar.no_actions') }}
-
+