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 \
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

View file

@ -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

View file

@ -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',
{

View file

@ -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

View file

@ -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

View file

@ -71,34 +71,37 @@
<div class="results-title-name">
<%= t('projects.reports.elements.module.results') %>
</div><br>
<% end %>
<% order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| %>
<div class="result-name">
<%= result.name.presence || I18n.t('projects.reports.unnamed') %>
<% if result.archived? %>
<span class="label label-warning"><%= t('search.index.archived') %></span>
<% end %>
</div>
<% order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| %>
<div class="result-name">
<%= result.name.presence || I18n.t('projects.reports.unnamed') %>
<% if result.archived? %>
<span class="label label-warning"><%= t('search.index.archived') %></span>
<% end %>
</div>
<% result.result_orderable_elements.each do |element| %>
<% if element.orderable_type == "ResultTable" %>
<%= render partial: 'reports/elements/my_module_result_table_element', locals: { result: result, export_all: export_all, element: element} %>
<% elsif element.orderable_type == "ResultText" %>
<%= render partial: 'reports/elements/my_module_result_text_element', locals: { result: result, export_all: export_all, element: element } %>
<% result.result_orderable_elements.each do |element| %>
<% 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} %>
<% 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 } %>
<% 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 %>
<%= 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 %>
</div><br>