Merge branch 'develop' into features/datetime-picker

This commit is contained in:
Anton 2023-11-14 18:08:03 +01:00
commit 6abc643aec
6 changed files with 75 additions and 60 deletions

View file

@ -8,7 +8,6 @@ RUN apt-get update -qq && \
libjemalloc2 \ libjemalloc2 \
libssl-dev \ libssl-dev \
nodejs \ nodejs \
npm \
postgresql-client \ postgresql-client \
default-jre-headless \ default-jre-headless \
poppler-utils \ poppler-utils \
@ -21,12 +20,15 @@ RUN apt-get update -qq && \
fonts-wqy-microhei \ fonts-wqy-microhei \
fonts-wqy-zenhei \ fonts-wqy-zenhei \
libfile-mimeinfo-perl \ libfile-mimeinfo-perl \
chromium-driver && \ chromium-driver \
npm install -g yarn && \ yarnpkg && \
yarn add puppeteer@npm:puppeteer-core && \
ln -s /usr/lib/x86_64-linux-gnu/libvips.so.42 /usr/lib/x86_64-linux-gnu/libvips.so && \ 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/* 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/ ENV BUNDLE_PATH /usr/local/bundle/
# create app directory # create app directory

View file

@ -9,14 +9,13 @@ RUN \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
libssl-dev \ libssl-dev \
nodejs \ nodejs \
npm \ yarnpkg \
postgresql-client && \ postgresql-client
npm install -g yarn
ENV APP_HOME /usr/src/app ENV APP_HOME /usr/src/app
ENV RAILS_ENV=production ENV RAILS_ENV=production
ENV GEM_HOME=$APP_HOME/vendor/bundle/ruby/3.2.0 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_APP_CONFIG=.bundle
ENV BUNDLE_BUILD__SASSC=--disable-march-tune-native ENV BUNDLE_BUILD__SASSC=--disable-march-tune-native
@ -69,7 +68,7 @@ RUN \
libjemalloc2 \ libjemalloc2 \
groff-base \ groff-base \
postgresql-client \ postgresql-client \
npm \ nodejs \
awscli \ awscli \
netcat-openbsd \ netcat-openbsd \
poppler-utils \ poppler-utils \
@ -77,9 +76,9 @@ RUN \
libvips42 \ libvips42 \
graphviz \ graphviz \
chromium \ chromium \
libfile-mimeinfo-perl && \ libfile-mimeinfo-perl \
npm install -g yarn && \ yarnpkg && \
yarn add puppeteer@npm:puppeteer-core && \ /usr/share/nodejs/yarn/bin/yarn add puppeteer@npm:puppeteer-core && \
apt-get install -y libreoffice && \ apt-get install -y libreoffice && \
ln -s /usr/lib/x86_64-linux-gnu/libvips.so.42 /usr/lib/x86_64-linux-gnu/libvips.so ln -s /usr/lib/x86_64-linux-gnu/libvips.so.42 /usr/lib/x86_64-linux-gnu/libvips.so

View file

@ -12,7 +12,12 @@ var selectedRow = null;
function initEditMyModuleDescription() { function initEditMyModuleDescription() {
var viewObject = $('#my_module_description_view'); var viewObject = $('#my_module_description_view');
viewObject.on('click', function(e) { 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( TinyMCE.init(
'#my_module_description_textarea', '#my_module_description_textarea',
{ {

View file

@ -46,27 +46,35 @@ class RepositoryRowsController < ApplicationController
@repository_row = @repository.repository_rows.find_by(id: params[:id]) @repository_row = @repository.repository_rows.find_by(id: params[:id])
return render_404 unless @repository_row return render_404 unless @repository_row
@my_module = if params[:my_module_id].present? respond_to do |format|
MyModule.repository_row_assignable_by_user(current_user).find_by(id: params[:my_module_id]) format.html do
end redirect_to repository_path(@repository)
return render_403 if @my_module && !can_read_my_module?(@my_module) end
if @my_module format.json do
@my_module_assign_error = if !can_assign_my_module_repository_rows?(@my_module) @my_module = if params[:my_module_id].present?
I18n.t('repository_row.modal_info.assign_to_task_error.no_access') MyModule.repository_row_assignable_by_user(current_user).find_by(id: params[:my_module_id])
elsif @repository_row.my_modules.where(id: @my_module.id).any? end
I18n.t('repository_row.modal_info.assign_to_task_error.already_assigned') return render_403 if @my_module && !can_read_my_module?(@my_module)
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
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 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
def create def create

View file

@ -144,8 +144,7 @@ module Reports
script_tag_options: @script_tag_options, script_tag_options: @script_tag_options,
page_ranges: "#{cover_pages_shift}-999999", page_ranges: "#{cover_pages_shift}-999999",
emulate_media: 'screen', emulate_media: 'screen',
display_url: "#{Rails.application.config.force_ssl ? 'https' : 'http'}://" \ display_url: Rails.application.routes.default_url_options[:host]
"#{Rails.application.routes.default_url_options[:host]}"
).to_pdf(@file.path) ).to_pdf(@file.path)
end end
@ -249,8 +248,7 @@ module Reports
script_tag_options: @script_tag_options, script_tag_options: @script_tag_options,
emulate_media: 'screen', emulate_media: 'screen',
print_background: true, print_background: true,
display_url: "#{Rails.application.config.force_ssl ? 'https' : 'http'}://" \ display_url: Rails.application.routes.default_url_options[:host]
"#{Rails.application.routes.default_url_options[:host]}"
).to_pdf(title_page.path) ).to_pdf(title_page.path)
title_page.rewind title_page.rewind

View file

@ -71,34 +71,37 @@
<div class="results-title-name"> <div class="results-title-name">
<%= t('projects.reports.elements.module.results') %> <%= t('projects.reports.elements.module.results') %>
</div><br> </div><br>
<% end %>
<% order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| %> <% order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| %>
<div class="result-name"> <div class="result-name">
<%= result.name.presence || I18n.t('projects.reports.unnamed') %> <%= result.name.presence || I18n.t('projects.reports.unnamed') %>
<% if result.archived? %> <% if result.archived? %>
<span class="label label-warning"><%= t('search.index.archived') %></span> <span class="label label-warning"><%= t('search.index.archived') %></span>
<% end %> <% end %>
</div> </div>
<% result.result_orderable_elements.each do |element| %> <% result.result_orderable_elements.each do |element| %>
<% if element.orderable_type == "ResultTable" %> <% if element.orderable_type == "ResultTable" && @settings.dig('task', 'table_results') %>
<%= render partial: 'reports/elements/my_module_result_table_element', locals: { result: result, export_all: export_all, element: element} %> <%= render partial: 'reports/elements/my_module_result_table_element', locals: { result: result, export_all: export_all, element: element} %>
<% elsif element.orderable_type == "ResultText" %> <% elsif element.orderable_type == "ResultText" && @settings.dig('task', 'text_results') %>
<%= render partial: 'reports/elements/my_module_result_text_element', locals: { result: result, export_all: export_all, element: element } %> <%= render partial: 'reports/elements/my_module_result_text_element', locals: { result: result, export_all: export_all, element: element } %>
<% end %>
<% end %> <% end %>
<% if @settings.dig('task', 'file_results') %>
<%= render partial: 'reports/elements/my_module_result_asset_element', locals: { result: result, report: report, export_all: export_all } %>
<% end %>
<div class="user-time">
<%= t('projects.reports.elements.result.user_time', user: result.user.full_name, timestamp: l(result.created_at, format: :full)) %>
</div>
<div class="report-element-children">
<% if @settings.dig('task', 'result_comments') %>
<%= render partial: 'reports/elements/result_comments_element', locals: { result: result } %>
<% end %>
</div>
<% end %> <% end %>
<%= render partial: 'reports/elements/my_module_result_asset_element', locals: { result: result, report: report, export_all: export_all } %>
<div class="user-time">
<%= t('projects.reports.elements.result.user_time', user: result.user.full_name, timestamp: l(result.created_at, format: :full)) %>
</div>
<div class="report-element-children">
<% if @settings.dig('task', 'result_comments') %>
<%= render partial: 'reports/elements/result_comments_element', locals: { result: result } %>
<% end %>
</div>
<% end %> <% end %>
</div><br> </div><br>