Skip to content

Commit

Permalink
Merge branch 'develop' into features/custom-docx-reports
Browse files Browse the repository at this point in the history
  • Loading branch information
aignatov-bio committed Aug 13, 2024
2 parents 2f9bd1f + 257ae02 commit 6d76966
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ RUN \
chromium \
libfile-mimeinfo-perl \
yarnpkg && \
/usr/share/nodejs/yarn/bin/yarn add puppeteer@npm:puppeteer-core && \
/usr/share/nodejs/yarn/bin/yarn add puppeteer@npm:puppeteer-core@^22.15.0 && \
apt-get install -y libreoffice && \
ln -s /usr/lib/x86_64-linux-gnu/libvips.so.42 /usr/lib/x86_64-linux-gnu/libvips.so

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/vue/protocol/step.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
@attachment:viewMode="updateAttachmentViewMode"/>
</div>
<ContentToolbar
v-if="orderedElements.length > 2"
v-if="orderedElements.length > 2 && insertMenu.length > 0"
:insertMenu="insertMenu"
@create:table="(...args) => this.createElement('table', ...args)"
@create:checklist="createElement('checklist')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export default {
},
methods: {
enableEditing() {
if (!this.values.stock_url) return;
this.isEditing = true;
const $this = this;
// disable edit
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/vue/results/result.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
@attachments:viewMode="changeAttachmentsViewMode"
@attachment:viewMode="updateAttachmentViewMode"/>
<ContentToolbar
v-if="orderedElements.length > 2"
v-if="orderedElements.length > 2 && insertMenu.length > 0"
:insertMenu="insertMenu"
@create:table="(...args) => this.createElement('table', ...args)"
@create:text="createElement('text')"
Expand Down
23 changes: 14 additions & 9 deletions app/models/concerns/tiny_mce_images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,24 @@ def prepare_for_report(field, export_all: false)
)[0]
next unless tm_asset_to_update

variant = tm_asset.image.variant(resize_to_limit: Constants::LARGE_PIC_FORMAT)
resized_asset = ActiveStorage::Variant.new(variant.blob, variant.variation).processed
begin
variant = tm_asset.image.variant(resize_to_limit: Constants::LARGE_PIC_FORMAT)
resized_asset = ActiveStorage::Variant.new(variant.blob, variant.variation).processed

width_attr = tm_asset_to_update.attributes['width']
height_attr = tm_asset_to_update.attributes['height']
width_attr = tm_asset_to_update.attributes['width']
height_attr = tm_asset_to_update.attributes['height']

if width_attr && height_attr && (width_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[0] ||
height_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[1])
width_attr.value = resized_asset.image.blob.metadata['width'].to_s
height_attr.value = resized_asset.image.blob.metadata['height'].to_s
if width_attr && height_attr && (width_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[0] ||
height_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[1])
width_attr.value = resized_asset.image.blob.metadata['width'].to_s
height_attr.value = resized_asset.image.blob.metadata['height'].to_s
end

tm_asset_to_update.attributes['src'].value = convert_to_base64(resized_asset)
rescue StandardError => e
Rails.logger.error(e)
end

tm_asset_to_update.attributes['src'].value = convert_to_base64(resized_asset)
description = html_description.css('body').inner_html.to_s
end
description
Expand Down
2 changes: 1 addition & 1 deletion app/views/repository_rows/show.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ json.actions do
end
end
json.direct_file_upload_path rails_direct_uploads_url
if @repository_row.has_stock?
if @repository_row.has_stock? && @repository.has_stock_management?
json.stock_value_url edit_repository_stock_repository_repository_row_url(@repository, @repository_row)
elsif @repository.has_stock_management?
json.stock_value_url new_repository_stock_repository_repository_row_url(@repository, @repository_row)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"pdfjs-dist": "^2.5.207",
"postcss": "8.4.32",
"postcss-loader": "5.3.0",
"puppeteer": "npm:puppeteer-core",
"puppeteer": "npm:puppeteer-core@^22.15.0",
"puppeteer-core": "^21.3.8",
"raw-loader": "^4.0.2",
"sass": "^1.63.6",
Expand Down
Loading

0 comments on commit 6d76966

Please sign in to comment.