diff --git a/Dockerfile b/Dockerfile index 82c960073..4dc87507a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ RUN apt-get update -qq && \ libjemalloc2 \ libssl-dev \ nodejs \ - npm \ postgresql-client \ default-jre-headless \ poppler-utils \ @@ -21,12 +20,15 @@ RUN apt-get update -qq && \ fonts-wqy-microhei \ fonts-wqy-zenhei \ libfile-mimeinfo-perl \ - chromium-driver && \ - npm install -g yarn && \ - yarn add puppeteer@npm:puppeteer-core && \ + chromium-driver \ + yarnpkg && \ ln -s /usr/lib/x86_64-linux-gnu/libvips.so.42 /usr/lib/x86_64-linux-gnu/libvips.so && \ rm -rf /var/lib/apt/lists/* +ENV PATH=/usr/share/nodejs/yarn/bin:$PATH + +RUN yarn add puppeteer@npm:puppeteer-core + ENV BUNDLE_PATH /usr/local/bundle/ # create app directory diff --git a/Dockerfile.production b/Dockerfile.production index 8384a8c79..b5a7a99fb 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -9,14 +9,13 @@ RUN \ apt-get install -y --no-install-recommends \ libssl-dev \ nodejs \ - npm \ - postgresql-client && \ - npm install -g yarn + yarnpkg \ + postgresql-client ENV APP_HOME /usr/src/app ENV RAILS_ENV=production ENV GEM_HOME=$APP_HOME/vendor/bundle/ruby/3.2.0 -ENV PATH=$GEM_HOME/bin:$PATH +ENV PATH=$GEM_HOME/bin:/usr/share/nodejs/yarn/bin:$PATH ENV BUNDLE_APP_CONFIG=.bundle ENV BUNDLE_BUILD__SASSC=--disable-march-tune-native @@ -69,7 +68,7 @@ RUN \ libjemalloc2 \ groff-base \ postgresql-client \ - npm \ + nodejs \ awscli \ netcat-openbsd \ poppler-utils \ @@ -77,9 +76,9 @@ RUN \ libvips42 \ graphviz \ chromium \ - libfile-mimeinfo-perl && \ - npm install -g yarn && \ - yarn add puppeteer@npm:puppeteer-core && \ + libfile-mimeinfo-perl \ + yarnpkg && \ + /usr/share/nodejs/yarn/bin/yarn add puppeteer@npm:puppeteer-core && \ apt-get install -y libreoffice && \ ln -s /usr/lib/x86_64-linux-gnu/libvips.so.42 /usr/lib/x86_64-linux-gnu/libvips.so diff --git a/app/assets/javascripts/my_modules/protocols.js b/app/assets/javascripts/my_modules/protocols.js index b294dec22..97f9d581a 100644 --- a/app/assets/javascripts/my_modules/protocols.js +++ b/app/assets/javascripts/my_modules/protocols.js @@ -12,7 +12,12 @@ var selectedRow = null; function initEditMyModuleDescription() { var viewObject = $('#my_module_description_view'); viewObject.on('click', function(e) { - if ($(e.target).hasClass('record-info-link') || $(e.target).parent().hasClass('record-info-link')) return; + if (e && $(e.target).prop("tagName") === 'A') return; + if (e && $(e.target).hasClass('atwho-user-popover')) return; + if (e && $(e.target).hasClass('record-info-link')) return; + if (e && $(e.target).parent().hasClass('record-info-link')) return; + if (e && $(e.target).parent().hasClass('atwho-inserted')) return; + TinyMCE.init( '#my_module_description_textarea', { diff --git a/app/controllers/repository_rows_controller.rb b/app/controllers/repository_rows_controller.rb index df30b23fe..a73c96396 100644 --- a/app/controllers/repository_rows_controller.rb +++ b/app/controllers/repository_rows_controller.rb @@ -46,27 +46,35 @@ class RepositoryRowsController < ApplicationController @repository_row = @repository.repository_rows.find_by(id: params[:id]) return render_404 unless @repository_row - @my_module = if params[:my_module_id].present? - MyModule.repository_row_assignable_by_user(current_user).find_by(id: params[:my_module_id]) - end - return render_403 if @my_module && !can_read_my_module?(@my_module) + respond_to do |format| + format.html do + redirect_to repository_path(@repository) + end - if @my_module - @my_module_assign_error = if !can_assign_my_module_repository_rows?(@my_module) - I18n.t('repository_row.modal_info.assign_to_task_error.no_access') - elsif @repository_row.my_modules.where(id: @my_module.id).any? - I18n.t('repository_row.modal_info.assign_to_task_error.already_assigned') - end + format.json do + @my_module = if params[:my_module_id].present? + MyModule.repository_row_assignable_by_user(current_user).find_by(id: params[:my_module_id]) + end + return render_403 if @my_module && !can_read_my_module?(@my_module) + + if @my_module + @my_module_assign_error = if !can_assign_my_module_repository_rows?(@my_module) + I18n.t('repository_row.modal_info.assign_to_task_error.no_access') + elsif @repository_row.my_modules.where(id: @my_module.id).any? + I18n.t('repository_row.modal_info.assign_to_task_error.already_assigned') + end + end + + @assigned_modules = @repository_row.my_modules + .joins(experiment: :project) + .joins(:my_module_repository_rows) + .select('my_module_repository_rows.created_at, my_modules.*') + .order('my_module_repository_rows.created_at': :desc) + .distinct + @viewable_modules = @assigned_modules.viewable_by_user(current_user, current_user.teams) + @reminders_present = @repository_row.repository_cells.with_active_reminder(@current_user).any? + end end - - @assigned_modules = @repository_row.my_modules - .joins(experiment: :project) - .joins(:my_module_repository_rows) - .select('my_module_repository_rows.created_at, my_modules.*') - .order('my_module_repository_rows.created_at': :desc) - .distinct - @viewable_modules = @assigned_modules.viewable_by_user(current_user, current_user.teams) - @reminders_present = @repository_row.repository_cells.with_active_reminder(@current_user).any? end def create diff --git a/app/jobs/reports/pdf_job.rb b/app/jobs/reports/pdf_job.rb index 86c166794..e14c83a2b 100644 --- a/app/jobs/reports/pdf_job.rb +++ b/app/jobs/reports/pdf_job.rb @@ -144,8 +144,7 @@ module Reports script_tag_options: @script_tag_options, page_ranges: "#{cover_pages_shift}-999999", emulate_media: 'screen', - display_url: "#{Rails.application.config.force_ssl ? 'https' : 'http'}://" \ - "#{Rails.application.routes.default_url_options[:host]}" + display_url: Rails.application.routes.default_url_options[:host] ).to_pdf(@file.path) end @@ -249,8 +248,7 @@ module Reports script_tag_options: @script_tag_options, emulate_media: 'screen', print_background: true, - display_url: "#{Rails.application.config.force_ssl ? 'https' : 'http'}://" \ - "#{Rails.application.routes.default_url_options[:host]}" + display_url: Rails.application.routes.default_url_options[:host] ).to_pdf(title_page.path) title_page.rewind diff --git a/app/views/reports/elements/_my_module_element.html.erb b/app/views/reports/elements/_my_module_element.html.erb index 5d91b2d0a..e3504a250 100644 --- a/app/views/reports/elements/_my_module_element.html.erb +++ b/app/views/reports/elements/_my_module_element.html.erb @@ -71,34 +71,37 @@