diff --git a/Dockerfile b/Dockerfile index 2fa0a78d8..c991986ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM ruby:2.4.4 +FROM ruby:2.4.5 MAINTAINER BioSistemika # additional dependecies RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ apt-get update -qq && \ apt-get install -y \ + libjemalloc1 \ nodejs \ postgresql-client \ default-jre-headless \ diff --git a/Dockerfile.production b/Dockerfile.production index 9bdbb4fea..61efe3707 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -1,10 +1,11 @@ -FROM ruby:2.4.4 +FROM ruby:2.4.5 MAINTAINER BioSistemika # additional dependecies RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ apt-get update -qq && \ apt-get install -y \ + libjemalloc1 \ nodejs \ groff-base \ awscli \ diff --git a/Gemfile b/Gemfile index 00ff3ff12..72e09a076 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'http://rubygems.org' -ruby '2.4.4' +ruby '2.4.5' gem 'rails', '5.1.6' gem 'webpacker', '~> 2.0' diff --git a/VERSION b/VERSION index 42cf0675c..f2380cc7a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.15.2 +1.15.3 diff --git a/app/assets/javascripts/projects/canvas.js.erb b/app/assets/javascripts/projects/canvas.js.erb index 6c007e782..d4f524071 100644 --- a/app/assets/javascripts/projects/canvas.js.erb +++ b/app/assets/javascripts/projects/canvas.js.erb @@ -873,18 +873,21 @@ function bindEditTagsAjax(elements) { manageTagsModalBody = manageTagsModal.find(".modal-body"); // Reload tags HTML element when modal is closed - manageTagsModal.on("hide.bs.modal", function(){ + manageTagsModal.off().on("hide.bs.modal", function(){ var task = $("div.panel[data-module-id='" + manageTagsModal.data('module-id') + "']"); // Load HTML $.ajax({ - url: task.attr("data-module-tags-url"), + url: $('#canvas-container').attr('data-module-tags-url'), type: "GET", dataType: "json", - success: function(data){ - task.find(".edit-tags-link") - .html(data.html_canvas); + success: function(data) { + $.each(data.my_modules, function(index, my_module){ + $('div.panel[data-module-id=' + my_module.id + ']') + .find(".edit-tags-link") + .html(my_module.tags_html); + }); // initialize tooltips again $.initTooltips(); }, diff --git a/app/assets/javascripts/secondary_navigation.js b/app/assets/javascripts/secondary_navigation.js new file mode 100644 index 000000000..9da8f176b --- /dev/null +++ b/app/assets/javascripts/secondary_navigation.js @@ -0,0 +1,27 @@ +(function() { + 'use strict'; + + function initRepositoriesDropDown() { + var dropDown = $('.repositories-dropdown'); + var dropDownMenu = $('.repositories-dropdown-menu'); + dropDown.on('show.bs.dropdown', function() { + dropDownMenu + .find('.assigned-items-counter') + .html(''); + $.ajax({ + url: dropDown.data('url'), + type: 'GET', + dataType: 'json', + success: function(data) { + dropDownMenu.html(data.html); + }, + error: function() { + dropDownMenu.find('.assigned-items-counter').html(''); + } + }); + }); + } + + // init + initRepositoriesDropDown(); +}()); diff --git a/app/assets/javascripts/sitewide/file_preview.js.erb b/app/assets/javascripts/sitewide/file_preview.js.erb index 58597fe05..a12963c76 100644 --- a/app/assets/javascripts/sitewide/file_preview.js.erb +++ b/app/assets/javascripts/sitewide/file_preview.js.erb @@ -56,6 +56,9 @@ modal.modal('hide'); }); modal.modal(); + modal.find('a[disabled=disabled]').click(function(ev){ + ev.preventDefault(); + }); $('.modal-backdrop').last().css('z-index', modal.css('z-index') - 1); }, error: function(ev) { diff --git a/app/assets/stylesheets/reports.scss b/app/assets/stylesheets/reports.scss index a1efb5700..9752b1f84 100644 --- a/app/assets/stylesheets/reports.scss +++ b/app/assets/stylesheets/reports.scss @@ -206,6 +206,11 @@ label { padding-top: 10px; padding-left: 15px; padding-right: 15px; + + .report-export-img { + max-height: 300px; + max-width: 300px; + } } .report-element-children { diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index d9e5a715c..4eca577ba 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -1945,10 +1945,6 @@ a.disabled-with-click-events { padding-bottom: 60px; } -.tiny-mce-pdf-ready { - max-width: 100%; -} - .doorkeeper-authorization { margin-bottom: 45px; diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index f4bf73b9c..eadff61ec 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -78,9 +78,28 @@ class AssetsController < ApplicationController elsif @assoc.class == RepositoryCell can_manage_repository_rows?(@repository.team) end + file_ext = @asset.file_file_name.split('.').last + if Constants::WOPI_EDITABLE_FORMATS.include?(file_ext) + edit_supported = true + title = '' + else + edit_supported = false + title = if Constants::FILE_TEXT_FORMATS.include?(file_ext) + I18n.t('assets.wopi_supported_text_formats_title') + elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) + I18n.t('assets.wopi_supported_table_formats_title') + else + I18n.t('assets.wopi_supported_presentation_formats_title') + end + end response_json['wopi-controls'] = render_to_string( partial: 'shared/file_wopi_controlls.html.erb', - locals: { asset: @asset, can_edit: can_edit } + locals: { + asset: @asset, + can_edit: can_edit, + edit_supported: edit_supported, + title: title + } ) end respond_to do |format| diff --git a/app/controllers/my_module_tags_controller.rb b/app/controllers/my_module_tags_controller.rb index 79ff20cb5..b40673108 100644 --- a/app/controllers/my_module_tags_controller.rb +++ b/app/controllers/my_module_tags_controller.rb @@ -1,5 +1,5 @@ class MyModuleTagsController < ApplicationController - before_action :load_vars + before_action :load_vars, except: :canvas_index before_action :check_view_permissions, only: :index before_action :check_manage_permissions, only: %i(create index_edit destroy) @@ -25,10 +25,6 @@ class MyModuleTagsController < ApplicationController respond_to do |format| format.json do render json: { - html_canvas: render_to_string( - partial: 'canvas/tags.html.erb', - locals: { my_module: @my_module } - ), html_module_header: render_to_string( partial: 'my_modules/tags.html.erb', locals: { my_module: @my_module } @@ -38,6 +34,26 @@ class MyModuleTagsController < ApplicationController end end + def canvas_index + experiment = Experiment.find(params[:id]) + render_403 unless can_read_experiment?(experiment) + res = [] + experiment.active_my_modules.each do |my_module| + res << { + id: my_module.id, + tags_html: render_to_string( + partial: 'canvas/tags.html.erb', + locals: { my_module: my_module } + ) + } + end + respond_to do |format| + format.json do + render json: { my_modules: res } + end + end + end + def create @mt = MyModuleTag.new(mt_params.merge(my_module: @my_module)) @mt.created_by = current_user diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index f525f1165..3a2123332 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -14,7 +14,8 @@ class MyModulesController < ApplicationController complete_my_module repository repository_index assign_repository_records unassign_repository_records unassign_repository_records_modal - assign_repository_records_modal) + assign_repository_records_modal + repositories_dropdown) before_action :load_vars_nested, only: %i(new create) before_action :load_repository, only: %i(assign_repository_records unassign_repository_records @@ -27,7 +28,7 @@ class MyModulesController < ApplicationController before_action :check_manage_permissions, only: %i(description due_date) before_action :check_view_permissions, only: %i(show activities activities_tab protocols results samples samples_index - archive) + archive repositories_dropdown) before_action :check_complete_module_permission, only: :complete_my_module before_action :check_assign_repository_records_permissions, only: %i(unassign_repository_records_modal @@ -403,6 +404,20 @@ class MyModulesController < ApplicationController render 'repository_rows/index.json' end + def repositories_dropdown + load_repository if params[:repository_id].present? + respond_to do |format| + format.json do + render json: { + html: render_to_string( + partial: 'repositories_dropdown.html.erb', + locals: { enable_counters: true } + ) + } + end + end + end + # Submit actions def assign_repository_records if params[:selected_rows].present? && params[:repository_id].present? diff --git a/app/helpers/file_icons_helper.rb b/app/helpers/file_icons_helper.rb index 1bed35a35..f531363f9 100644 --- a/app/helpers/file_icons_helper.rb +++ b/app/helpers/file_icons_helper.rb @@ -7,11 +7,11 @@ module FileIconsHelper # For showing next to file def file_fa_icon_class(asset) file_ext = asset.file_file_name.split('.').last - if %w(doc docm docx dot dotm dotx odt rtf).include?(file_ext) + if Constants::FILE_TEXT_FORMATS.include?(file_ext) fa_class = 'fa-file-word' - elsif %w(ods xls xlsb xlsm xlsx).include?(file_ext) + elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) fa_class = 'fa-file-excel' - elsif %w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).include?(file_ext) + elsif Constants::FILE_PRESENTATION_FORMATS.include?(file_ext) fa_class = 'fa-file-powerpoint' elsif %w(pdf).include?(file_ext) fa_class = 'fa-file-pdf' @@ -31,11 +31,11 @@ module FileIconsHelper # For showing next to file def file_extension_icon(asset) file_ext = asset.file_file_name.split('.').last - if %w(doc docm docx dot dotm dotx odt rtf).include?(file_ext) + if Constants::FILE_TEXT_FORMATS.include?(file_ext) image_link = 'office/Word-docx_20x20x32.png' - elsif %w(csv ods xls xlsb xlsm xlsx).include?(file_ext) + elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) image_link = 'office/Excel-xlsx_20x20x32.png' - elsif %w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).include?(file_ext) + elsif Constants::FILE_PRESENTATION_FORMATS.include?(file_ext) image_link = 'office/PowerPoint-pptx_20x20x32.png' end @@ -54,11 +54,11 @@ module FileIconsHelper # For showing in view/edit buttons (WOPI) def file_application_icon(asset) file_ext = asset.file_file_name.split('.').last - if %w(doc docm docx dot dotm dotx odt rtf).include?(file_ext) + if Constants::FILE_TEXT_FORMATS.include?(file_ext) image_link = 'office/Word-color_16x16x32.png' - elsif %w(csv ods xls xlsb xlsm xlsx).include?(file_ext) + elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) image_link = 'office/Excel-color_16x16x32.png' - elsif %w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).include?(file_ext) + elsif Constants::FILE_PRESENTATION_FORMATS.include?(file_ext) image_link = 'office/PowerPoint-Color_16x16x32.png' end @@ -72,11 +72,11 @@ module FileIconsHelper # Shows correct WOPI application text (Word Online/Excel ..) def wopi_button_text(asset, action) file_ext = asset.file_file_name.split('.').last - if %w(doc docm docx dot dotm dotx odt rtf).include?(file_ext) + if Constants::FILE_TEXT_FORMATS.include?(file_ext) app = 'Word Online' - elsif %w(csv ods xls xlsb xlsm xlsx).include?(file_ext) + elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) app = 'Excel Online' - elsif %w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).include?(file_ext) + elsif Constants::FILE_PRESENTATION_FORMATS.include?(file_ext) app = 'PowerPoint Online' end diff --git a/app/helpers/tiny_mce_helper.rb b/app/helpers/tiny_mce_helper.rb index 091c586c1..809a5655d 100644 --- a/app/helpers/tiny_mce_helper.rb +++ b/app/helpers/tiny_mce_helper.rb @@ -26,7 +26,15 @@ module TinyMceHelper img = TinyMceAsset.find_by_id(match[1]) next unless img && check_image_permissions(obj, img) if pdf_export_ready - report_image_asset_url(img, :tiny_mce_asset, 'tiny-mce-pdf-ready') + tmp_f = Tempfile.open(img.image_file_name, Rails.root.join('tmp')) + begin + img.image.copy_to_local_file(:large, tmp_f.path) + encoded_image = Base64.strict_encode64(tmp_f.read) + "" + ensure + tmp_f.close + tmp_f.unlink + end else image_tag(img.url, class: 'img-responsive', diff --git a/app/models/my_module.rb b/app/models/my_module.rb index c96de8944..28936dc8f 100644 --- a/app/models/my_module.rb +++ b/app/models/my_module.rb @@ -174,6 +174,12 @@ class MyModule < ApplicationRecord restored end + def repository_rows_count(repository) + my_module_repository_rows.joins(repository_row: :repository) + .where('repositories.id': repository.id) + .count + end + def unassigned_users User.find_by_sql( "SELECT DISTINCT users.id, users.full_name FROM users " + diff --git a/app/models/my_module_repository_row.rb b/app/models/my_module_repository_row.rb index f17cc8743..c28ce10a0 100644 --- a/app/models/my_module_repository_row.rb +++ b/app/models/my_module_repository_row.rb @@ -6,7 +6,10 @@ class MyModuleRepositoryRow < ApplicationRecord belongs_to :repository_row, optional: true, inverse_of: :my_module_repository_rows - belongs_to :my_module, optional: true, inverse_of: :my_module_repository_rows + belongs_to :my_module, + optional: true, + touch: true, + inverse_of: :my_module_repository_rows validates :repository_row, :my_module, presence: true validates :repository_row, uniqueness: { scope: :my_module } diff --git a/app/models/team_zip_export.rb b/app/models/team_zip_export.rb index a87dc11d5..a3c03464c 100644 --- a/app/models/team_zip_export.rb +++ b/app/models/team_zip_export.rb @@ -193,12 +193,7 @@ class TeamZipExport < ZipExport name = "#{directory}/#{append_file_suffix(asset.file_file_name, "_#{i}")}" end - file = FileUtils.touch(name).first - if asset.file.exists? - File.open(file, 'wb') do |f| - f.write(Paperclip.io_adapters.for(asset.file).read) - end - end + asset.file.copy_to_local_file(:original, name) if asset.file.exists? asset_indexes[asset.id] = name end @@ -266,8 +261,7 @@ class TeamZipExport < ZipExport # Save all attachments (it doesn't work directly in callback function assets.each do |asset, asset_path| - file = FileUtils.touch(asset_path).first - File.open(file, 'wb') { |f| f.write asset.open.read } + asset.file.copy_to_local_file(:original, asset_path) end csv_file_path @@ -301,7 +295,7 @@ class TeamZipExport < ZipExport write_entries(input_dir, subdir, zip_file_path, io) else io.get_output_stream(zip_file_path) do |f| - f.puts File.open(disk_file_path, 'rb').read + f.write(File.open(disk_file_path, 'rb').read) end end end diff --git a/app/services/api.rb b/app/services/api.rb index 3dd4a5f52..322d01e26 100644 --- a/app/services/api.rb +++ b/app/services/api.rb @@ -16,7 +16,7 @@ module Api attr_accessor :core_api_token_ttl attr_accessor :core_api_token_iss attr_accessor :azure_ad_apps - attr_accessor :core_api_v1_preview + attr_accessor :core_api_v1_enabled attr_accessor :core_api_rate_limit def initialize @@ -24,7 +24,7 @@ module Api @core_api_token_ttl = 30.minutes @core_api_token_iss = 'SciNote' @azure_ad_apps = {} - @core_api_v1_preview = false + @core_api_v1_enabled = false @core_api_rate_limit = 1000 end end diff --git a/app/views/canvas/full_zoom/_my_module.html.erb b/app/views/canvas/full_zoom/_my_module.html.erb index a01666266..1b3663781 100644 --- a/app/views/canvas/full_zoom/_my_module.html.erb +++ b/app/views/canvas/full_zoom/_my_module.html.erb @@ -9,8 +9,7 @@ data-module-x="<%= my_module.x %>" data-module-y="<%= my_module.y %>" data-module-conns="<%= construct_module_connections(my_module) %>" - data-module-tags-url="<%= my_module_my_module_tags_url(my_module, format: :json) %>" - data-module-users-tab-url="<%= my_module_user_my_modules_url(my_module_id: my_module.id, format: :json) %>"> + data-module-tags-url="<%= my_module_tags_experiment_path(my_module.experiment, format: :json) %>"> <% if can_manage_module?(my_module) %> diff --git a/app/views/canvas/medium_zoom/_my_module.html.erb b/app/views/canvas/medium_zoom/_my_module.html.erb index 3ffe35842..2ef03b8ff 100644 --- a/app/views/canvas/medium_zoom/_my_module.html.erb +++ b/app/views/canvas/medium_zoom/_my_module.html.erb @@ -8,8 +8,7 @@ <% end %> data-module-x="<%= my_module.x %>" data-module-y="<%= my_module.y %>" - data-module-conns="<%= construct_module_connections(my_module) %>" - data-module-tags-url="<%= my_module_my_module_tags_url(my_module, format: :json) %>"> + data-module-conns="<%= construct_module_connections(my_module) %>"> <% if can_manage_module?(my_module) %> diff --git a/app/views/experiments/canvas.html.erb b/app/views/experiments/canvas.html.erb index a9c7d008f..2769de66f 100644 --- a/app/views/experiments/canvas.html.erb +++ b/app/views/experiments/canvas.html.erb @@ -45,7 +45,7 @@ -
+
<%= render partial: 'canvas/full_zoom', locals: { experiment: @experiment, my_modules: @active_modules } %>
diff --git a/app/views/my_modules/_repositories_dropdown.html.erb b/app/views/my_modules/_repositories_dropdown.html.erb new file mode 100644 index 000000000..46e4cbf3b --- /dev/null +++ b/app/views/my_modules/_repositories_dropdown.html.erb @@ -0,0 +1,22 @@ +<% @my_module.experiment.project.team.repositories.order(created_at: :asc).each do |repository| %> +
  • + help_tooltips" + data-tooltiplink="<%= I18n.t('tooltips.link.protocol.inventories') %>" + data-tooltipcontent="<%= I18n.t('tooltips.text.protocol.inventories') %>" + href="<%= repository_my_module_url(id: @my_module, repository_id: repository) %>" + title="<%= repository.name %>"> + <% if enable_counters %> + <% cache [repository, @my_module] do %> + <%= truncate(repository.name) %> + <%= "(#{@my_module.repository_rows_count(repository)})" %> + <% end %> + <% else %> + <%= truncate(repository.name) %> + + <% end %> + +
  • + <% unless @my_module.experiment.project.team.repositories.last == repository %> +
  • + <% end %> +<% end %> diff --git a/app/views/projects/export/_modal.html.erb b/app/views/projects/export/_modal.html.erb index 02a119c04..3dfc75ac4 100644 --- a/app/views/projects/export/_modal.html.erb +++ b/app/views/projects/export/_modal.html.erb @@ -1,5 +1,7 @@

    <%=t 'projects.export_projects.modal_text_p1_html', num_projects: num_projects, team: @team.name %>

    <%=t 'projects.export_projects.modal_text_p2_html' %>

    -

    - <%=t 'projects.export_projects.modal_text_p3_html', limit: limit, num: num_of_requests_left %> -

    +<% unless limit.zero? %> +

    + <%=t 'projects.export_projects.modal_text_p3_html', limit: limit, num: num_of_requests_left %> +

    +<% end %> diff --git a/app/views/reports/elements/_my_module_result_asset_element.html.erb b/app/views/reports/elements/_my_module_result_asset_element.html.erb index 84f341a44..62cc048c3 100644 --- a/app/views/reports/elements/_my_module_result_asset_element.html.erb +++ b/app/views/reports/elements/_my_module_result_asset_element.html.erb @@ -38,7 +38,11 @@
    - <%= report_image_asset_url(asset) %> + <% if defined?(export_all) && export_all %> + + <% else %> + <%= report_image_asset_url(asset) %> + <% end %>
    diff --git a/app/views/reports/elements/_my_module_result_text_element.html.erb b/app/views/reports/elements/_my_module_result_text_element.html.erb index 69c452a37..9159f7c78 100644 --- a/app/views/reports/elements/_my_module_result_text_element.html.erb +++ b/app/views/reports/elements/_my_module_result_text_element.html.erb @@ -3,6 +3,7 @@ <% comments = result.result_comments %> <% timestamp = result.created_at %> <% name = result.name %> +<% pdf_export_ready = defined?(export_all) && export_all %>
    " data-name="<%= name %>" data-icon-class="fas fa-asterisk">
    @@ -23,7 +24,7 @@
    - <%= custom_auto_link(generate_image_tag_from_token(result_text.text, result_text, true), + <%= custom_auto_link(generate_image_tag_from_token(result_text.text, result_text, pdf_export_ready), team: current_team, simple_format: false, tags: %w(img)) %> diff --git a/app/views/reports/elements/_my_module_step_element.html.erb b/app/views/reports/elements/_my_module_step_element.html.erb index 6490d4c23..b6c602d0c 100644 --- a/app/views/reports/elements/_my_module_step_element.html.erb +++ b/app/views/reports/elements/_my_module_step_element.html.erb @@ -6,6 +6,7 @@ <% assets = step.assets %> <% checklists = step.checklists %> <% comments = step.step_comments %> +<% pdf_export_ready = defined?(export_all) && export_all %>
    " data-name="<%=t "projects.reports.elements.step.sidebar_name", pos: (step.position + 1), name: step.name %>" data-icon-class="fas fa-arrow-circle-right">
    @@ -30,7 +31,7 @@
    <% if strip_tags(step.description).present? %> - <%= custom_auto_link(generate_image_tag_from_token(step.description, step, true), + <%= custom_auto_link(generate_image_tag_from_token(step.description, step, pdf_export_ready), team: current_team, simple_format: false, tags: %w(img)) %> diff --git a/app/views/reports/elements/_step_asset_element.html.erb b/app/views/reports/elements/_step_asset_element.html.erb index fb09808ca..f9bbcde53 100644 --- a/app/views/reports/elements/_step_asset_element.html.erb +++ b/app/views/reports/elements/_step_asset_element.html.erb @@ -32,7 +32,11 @@ <% if is_image %>
    - <%= report_image_asset_url(asset) %> + <% if defined?(export_all) && export_all %> + + <% else %> + <%= report_image_asset_url(asset) %> + <% end %>
    <% end %> diff --git a/app/views/shared/_file_wopi_controlls.html.erb b/app/views/shared/_file_wopi_controlls.html.erb index cfd80c8dc..07762f7d7 100644 --- a/app/views/shared/_file_wopi_controlls.html.erb +++ b/app/views/shared/_file_wopi_controlls.html.erb @@ -5,7 +5,7 @@ <%= file_application_icon(asset) %> <%= wopi_button_text(asset, 'view') %> <% end %> -<% if can_edit %> +<% if can_edit && edit_supported %> <%= link_to edit_asset_url(id: asset), class: 'btn btn-default btn-sm', target: '_blank', @@ -13,4 +13,14 @@ <%= file_application_icon(asset) %> <%= wopi_button_text(asset, 'edit') %> <% end %> +<% elsif can_edit %> + <%= link_to edit_asset_url(id: asset), + class: 'btn btn-default btn-sm', + target: '_blank', + title: title, + disabled: true, + style: 'display: inline-block' do %> + <%= file_application_icon(asset) %> + <%= wopi_button_text(asset, 'edit') %> + <% end %> <% end %> diff --git a/app/views/shared/_secondary_navigation.html.erb b/app/views/shared/_secondary_navigation.html.erb index fc9cdd311..3ff0a346d 100644 --- a/app/views/shared/_secondary_navigation.html.erb +++ b/app/views/shared/_secondary_navigation.html.erb @@ -123,27 +123,16 @@
  • <% if can_read_team?(@my_module.experiment.project.team) && @my_module.experiment.project.team.repositories.exists? %> -
  • "> +
  • dropdown repositories-dropdown" + data-url="<%= module_repository_page? ? repositories_dropdown_repository_tab_my_module_path(repository: @repository) : repositories_dropdown_my_module_path %>"> " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  • <% end %> @@ -168,4 +157,7 @@
    + +<%= javascript_include_tag('secondary_navigation') %> + <% end %> diff --git a/config/initializers/api.rb b/config/initializers/api.rb index 7113a7618..c17574a93 100644 --- a/config/initializers/api.rb +++ b/config/initializers/api.rb @@ -12,9 +12,9 @@ Api.configure do |config| config.core_api_rate_limit = ENV['CORE_API_RATE_LIMIT'] ? ENV['CORE_API_RATE_LIMIT'].to_i : 1000 - config.core_api_v1_preview = true if ENV['CORE_API_V1_PREVIEW'] + config.core_api_v1_enabled = true if ENV['CORE_API_V1_ENABLED'] - Paperclip::DataUriAdapter.register if ENV['CORE_API_V1_PREVIEW'] + Paperclip::DataUriAdapter.register if ENV['CORE_API_V1_ENABLED'] vars = ENV.select { |name, _| name =~ /^[[:alnum:]]*_AZURE_AD_APP_ID/ } vars.each do |name, value| diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index f5fc0767e..d610a3859 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -66,6 +66,7 @@ Rails.application.config.assets.precompile += Rails.application.config.assets.precompile += %w(datatables.js) Rails.application.config.assets.precompile += %w(search/index.js) Rails.application.config.assets.precompile += %w(navigation.js) +Rails.application.config.assets.precompile += %w(secondary_navigation.js) Rails.application.config.assets.precompile += %w(datatables.css) Rails.application.config.assets.precompile += %w(my_modules.js) Rails.application.config.assets.precompile += %w(canvas-to-blob.min.js) diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index 5b8f0f5e0..2de7387cb 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -187,6 +187,17 @@ class Constants # Other #============================================================================= + FILE_TEXT_FORMATS = %w(doc docm docx dot dotm dotx odt rtf).freeze + + FILE_TABLE_FORMATS = %w(csv ods xls xlsb xlsm xlsx).freeze + + FILE_PRESENTATION_FORMATS = + %w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).freeze + + WOPI_EDITABLE_FORMATS = %w( + docx docm odt xlsx xlsm xlsb ods pptx ppsx odp + ).freeze + TEXT_EXTRACT_FILE_TYPES = [ 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', diff --git a/config/locales/en.yml b/config/locales/en.yml index 08b2f5a62..191d786ea 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1918,6 +1918,9 @@ en: add_image: 'Add' file_name: 'File name' file_name_placeholder: 'Image' + wopi_supported_text_formats_title: 'Only .docx, .docm, .odt file formats are supported for editing in Word Online.' + wopi_supported_table_formats_title: 'Only .xlsx, .xlsm, .xlsb, .ods file formats are supported for editing in Excel Online.' + wopi_supported_presentation_formats_title: 'Only .pptx, ppsx, .odp file formats are supported for editing in Powerpoint Online.' atwho: no_results: "No results found" users: diff --git a/config/routes.rb b/config/routes.rb index 77462cbe8..5b04ad75e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -311,6 +311,7 @@ Rails.application.routes.draw do get 'canvas/small_zoom', to: 'canvas#small_zoom' # AJAX-loaded canvas zoom post 'canvas', to: 'canvas#update' # Save updated canvas action get 'module_archive' # Module archive for single experiment + get 'my_module_tags', to: 'my_module_tags#canvas_index' get 'archive' # archive experiment get 'clone_modal' # return modal with clone options post 'clone' # clone experiment @@ -374,6 +375,12 @@ Rails.application.routes.draw do get 'archive' # Archive view for single module get 'complete_my_module' post 'toggle_task_state' + get 'repositories_dropdown', + to: 'my_modules#repositories_dropdown', + as: :repositories_dropdown + get 'repositories_dropdown/:repository_id', + to: 'my_modules#repositories_dropdown', + as: :repositories_dropdown_repository_tab # Renders sample datatable for single module (ajax action) # post 'samples_index' # post :assign_samples, @@ -561,7 +568,7 @@ Rails.application.routes.draw do namespace :api, defaults: { format: 'json' } do get 'health', to: 'api#health' get 'status', to: 'api#status' - if Api.configuration.core_api_v1_preview + if Api.configuration.core_api_v1_enabled namespace :v1 do resources :teams, only: %i(index show) do resources :inventories, diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 1f74b4ae3..fa9acd82e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -6,7 +6,7 @@ require 'devise' require_relative 'support/controller_macros' ENV['RAILS_ENV'] = 'test' -ENV['CORE_API_V1_PREVIEW'] = 'true' +ENV['CORE_API_V1_ENABLED'] = 'true' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production