From a490a12fb120bbc1093b1d91bbce0f2d2b00357d Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Mon, 16 Jan 2017 14:49:37 +0100 Subject: [PATCH] Add truncation of image description in the preview [SCI-873] --- app/views/results/_result_asset.html.erb | 3 ++- app/views/steps/_form_assets.html.erb | 3 ++- app/views/steps/_step.html.erb | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/results/_result_asset.html.erb b/app/views/results/_result_asset.html.erb index fc85525b1..b55f33040 100644 --- a/app/views/results/_result_asset.html.erb +++ b/app/views/results/_result_asset.html.erb @@ -9,7 +9,8 @@ <%= link_to download_asset_path(result.asset), class: 'image-preview-link', id: "modal_link#{result.asset.id}", - data: {no_turbolink: true, description: "#{result.name}"} do %> + data: {no_turbolink: true, + description: "#{truncate(result.name, length: Constants::FILENAME_TRUNCATION_LENGTH)}"} do %> <%= image_tag result.asset.url(:medium), data: {'preview-url': large_image_url_asset_path(result.asset)} %>

<%= truncate(result.asset.file_file_name, length: Constants::FILENAME_TRUNCATION_LENGTH) %>

diff --git a/app/views/steps/_form_assets.html.erb b/app/views/steps/_form_assets.html.erb index d3c5b069d..5dd699ee2 100644 --- a/app/views/steps/_form_assets.html.erb +++ b/app/views/steps/_form_assets.html.erb @@ -15,7 +15,8 @@ <%= link_to download_asset_path(ff.object), class: 'image-preview-link', id: "modal_link#{ff.object.id}", - data: {no_turbolink: true, id: true, status: "asset-present", description: "#{step.position + 1}. #{step.name}"} do %> + data: {no_turbolink: true, id: true, status: "asset-present", + description: "#{step.position + 1}. #{truncate(step.name, length: Constants::FILENAME_TRUNCATION_LENGTH)}"} do %> <%= image_tag ff.object.url(:medium), data: {'preview-url': large_image_url_asset_path(ff.object)} %>

<%= truncate(ff.object.file_file_name, length: Constants::FILENAME_TRUNCATION_LENGTH) %>

diff --git a/app/views/steps/_step.html.erb b/app/views/steps/_step.html.erb index 9fd81cb73..48cd22220 100644 --- a/app/views/steps/_step.html.erb +++ b/app/views/steps/_step.html.erb @@ -76,7 +76,8 @@ <%= link_to download_asset_path(asset), class: 'image-preview-link', id: "modal_link#{asset.id}", - data: {no_turbolink: true, id: true, status: "asset-present", description: "#{step.position + 1}. #{step.name}"} do %> + data: {no_turbolink: true, id: true, status: "asset-present", + description: "#{step.position + 1}. #{truncate(step.name, length: Constants::FILENAME_TRUNCATION_LENGTH)}"} do %> <%= image_tag asset.url(:medium), data: {'preview-url': large_image_url_asset_path(asset)} %>

<%= truncate(asset.file_file_name, length: Constants::FILENAME_TRUNCATION_LENGTH) %>