From 7a3eedf461bfce2dd07515f66846491da43b49fb Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Fri, 14 Jun 2019 16:20:13 +0200 Subject: [PATCH 01/11] Adding missing avatars to comments (#1838) --- app/assets/stylesheets/shared/comments.scss | 15 +++++++++++++++ app/helpers/application_helper.rb | 11 +---------- app/models/user.rb | 16 ++++++++++++++++ .../elements/_result_comments_element.html.erb | 15 +++------------ .../elements/_step_comments_element.html.erb | 15 +++------------ app/views/shared/comments/_item.html.erb | 18 ++++++++++++------ 6 files changed, 50 insertions(+), 40 deletions(-) diff --git a/app/assets/stylesheets/shared/comments.scss b/app/assets/stylesheets/shared/comments.scss index b0746a06b..b321ef775 100644 --- a/app/assets/stylesheets/shared/comments.scss +++ b/app/assets/stylesheets/shared/comments.scss @@ -144,6 +144,21 @@ } } + // Looks like PDF has some specail CSS rules, here is some hack + &.report { + display: block; + float: left; + width: 100%; + + .avatar-placehodler { + float: left; + } + + .content-placeholder { + float: left; + } + } + &[data-edit-mode="0"]:hover, &[data-edit-mode="1"] { .comment-right { diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 56ef2b58c..e093d5cdc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -196,16 +196,7 @@ module ApplicationHelper # No more dirty hack def user_avatar_absolute_url(user, style) begin - unless missing_avatar(user, style) - image = if user.avatar.options[:storage].to_sym == :s3 - URI.parse(user.avatar.url(style)).open.to_a.join - else - File.open(user.avatar.path(style)).to_a.join - end - encoded_data = Base64.strict_encode64(image) - avatar_base64 = "data:#{user.avatar_content_type};base64,#{encoded_data}" - return avatar_base64 - end + return user.avatar_base64(style) unless missing_avatar(user, style) rescue StandardError => e Rails.logger.error e.message end diff --git a/app/models/user.rb b/app/models/user.rb index 8228f67e0..6a46a7f47 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -559,6 +559,22 @@ class User < ApplicationRecord .map { |i| { name: escape_input(i[:full_name]), id: i[:id] } } end + def avatar_base64(style) + unless avatar.present? + missing_link = File.open("#{Rails.root}/app/assets/images/#{style}/missing.png").to_a.join + return "data:image/png;base64,#{Base64.strict_encode64(missing_link)}" + end + + avatar_uri = if avatar.options[:storage].to_sym == :s3 + URI.parse(avatar.url(style)).open.to_a.join + else + File.open(avatar.path(style)).to_a.join + end + + encoded_data = Base64.strict_encode64(avatar_uri) + "data:#{avatar_content_type};base64,#{encoded_data}" + end + protected def confirmation_required? diff --git a/app/views/reports/elements/_result_comments_element.html.erb b/app/views/reports/elements/_result_comments_element.html.erb index 68614856f..b6635caef 100644 --- a/app/views/reports/elements/_result_comments_element.html.erb +++ b/app/views/reports/elements/_result_comments_element.html.erb @@ -18,22 +18,13 @@
+
<% comments.each do |comment| %> - <% comment_ts = comment.created_at %> --
-
- <%=t "projects.reports.elements.result_comments.comment_prefix", user: comment.user.full_name, date: l(comment_ts, format: :full_date), time: l(comment_ts, format: :time) %>
-
-
-
+ <%= render partial: 'shared/comments/item.html.erb', locals: { comment: comment, readonly: true, report: true } %>
<% end %>
<% end %> diff --git a/app/views/reports/elements/_step_comments_element.html.erb b/app/views/reports/elements/_step_comments_element.html.erb index 00f279c7a..5bf307378 100644 --- a/app/views/reports/elements/_step_comments_element.html.erb +++ b/app/views/reports/elements/_step_comments_element.html.erb @@ -18,22 +18,13 @@+
-
- <%= image_tag avatar_path(comment.user, :icon_small), class: 'avatar' %>
+
+ <% if report %>
+ <%= image_tag comment.user.avatar_base64(:icon_small), class: 'avatar' %>
+ <% else %>
+ <%= image_tag avatar_path(comment.user, :icon_small), class: 'avatar' %>
+ <% end %>
<%= comment.user.full_name %>
<%= l(comment.created_at, format: :full) %>
- <% if user_comment %>
+ <% if edit_mode %>
<%= t('general.save') %>
@@ -39,7 +45,7 @@
From 68937dd1927db0f84f55ba540136318947b1d788 Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Fri, 14 Jun 2019 16:20:27 +0200
Subject: [PATCH 02/11] Fix RTE import for protocol repository (#1833)
---
app/models/tiny_mce_asset.rb | 5 +++--
app/utilities/protocols_importer.rb | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/models/tiny_mce_asset.rb b/app/models/tiny_mce_asset.rb
index 8e4c0b287..fbb9d305d 100644
--- a/app/models/tiny_mce_asset.rb
+++ b/app/models/tiny_mce_asset.rb
@@ -107,7 +107,7 @@ class TinyMceAsset < ApplicationRecord
asset.destroy if asset && !asset.saved
end
- def self.update_old_tinymce(description, obj = nil)
+ def self.update_old_tinymce(description, obj = nil, import = false)
return description unless description
description.scan(/\[~tiny_mce_id:(\w+)\]/).flatten.each do |token|
@@ -115,7 +115,8 @@ class TinyMceAsset < ApplicationRecord
new_format = ""
asset = find_by_id(token)
- unless asset
+ # impor flag only for import from file cases, because we don't have image in DB
+ unless asset || import
# remove tag if asset deleted
description.sub!(old_format, '')
next
diff --git a/app/utilities/protocols_importer.rb b/app/utilities/protocols_importer.rb
index d095a12d7..ce7b48c03 100644
--- a/app/utilities/protocols_importer.rb
+++ b/app/utilities/protocols_importer.rb
@@ -145,7 +145,7 @@ module ProtocolsImporter
def populate_rte(object_json, object, team)
return populate_rte_legacy(object_json) unless object_json['descriptionAssets']
- description = TinyMceAsset.update_old_tinymce(object_json['description'])
+ description = TinyMceAsset.update_old_tinymce(object_json['description'], nil, true)
object_json['descriptionAssets'].values.each do |tiny_mce_img_json|
tiny_mce_img = TinyMceAsset.new(
object: object,
From da8d748c492d20b20f7cc1356db34054cbdb28cd Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Fri, 14 Jun 2019 16:20:47 +0200
Subject: [PATCH 03/11] Fix small comments bugs (#1832)
---
app/assets/javascripts/shared/inline_editing.js | 1 +
app/assets/javascripts/sitewide/comments.js | 1 +
app/assets/stylesheets/shared/comments.scss | 7 +++++--
app/views/shared/comments/_comments.html.erb | 2 +-
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/assets/javascripts/shared/inline_editing.js b/app/assets/javascripts/shared/inline_editing.js
index 009a38910..650ac64cc 100644
--- a/app/assets/javascripts/shared/inline_editing.js
+++ b/app/assets/javascripts/shared/inline_editing.js
@@ -85,6 +85,7 @@ function initInlineEditing(title) {
if (inputString.disabled) {
saveAllEditFields();
editBlock.dataset.editMode = 1;
+ $editBlock.closest('.inline_scroll_block').scrollTop(editBlock.offsetTop);
inputString.disabled = false;
$inputString.removeClass('hidden');
$editBlock.find('.view-mode').addClass('hidden');
diff --git a/app/assets/javascripts/sitewide/comments.js b/app/assets/javascripts/sitewide/comments.js
index 2127b94a1..415fa2fef 100644
--- a/app/assets/javascripts/sitewide/comments.js
+++ b/app/assets/javascripts/sitewide/comments.js
@@ -76,6 +76,7 @@ var Comments = (function() {
$el.find('#message').val('');
$el.find('.new-comment-button').removeClass('show');
newButton.disable = false;
+ $el.find('textarea').focus().blur();
})
.error((error) => {
errorField.html(error.responseJSON.errors.message);
diff --git a/app/assets/stylesheets/shared/comments.scss b/app/assets/stylesheets/shared/comments.scss
index b321ef775..90e837e25 100644
--- a/app/assets/stylesheets/shared/comments.scss
+++ b/app/assets/stylesheets/shared/comments.scss
@@ -239,13 +239,16 @@
.new-comment-button {
cursor: pointer;
- font-size: 18px;
+ font-size: 14px;
line-height: 18px;
- margin: 8px;
+ margin: 4px;
+ padding: 4px;
position: absolute;
right: -36px;
+ text-align: center;
top: 0;
transition: $md-transaction;
+ width: 26px;
&.show {
right: 0;
diff --git a/app/views/shared/comments/_comments.html.erb b/app/views/shared/comments/_comments.html.erb
index 7168ff3ac..542a41ed5 100644
--- a/app/views/shared/comments/_comments.html.erb
+++ b/app/views/shared/comments/_comments.html.erb
@@ -1,6 +1,6 @@
>
<% per_page = Constants::COMMENTS_SEARCH_LIMIT %>
-
+
<% if comments.size == per_page %>
Date: Fri, 14 Jun 2019 16:21:01 +0200
Subject: [PATCH 04/11] Change restore button background (#1829)
---
app/assets/stylesheets/hooks/tinymce.scss | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/assets/stylesheets/hooks/tinymce.scss b/app/assets/stylesheets/hooks/tinymce.scss
index cb6ad2481..1ebe183c1 100644
--- a/app/assets/stylesheets/hooks/tinymce.scss
+++ b/app/assets/stylesheets/hooks/tinymce.scss
@@ -43,3 +43,22 @@
.mce-top-part {
z-index: 5;
}
+
+.mce-widget.mce-btn[aria-label="Restore last draft"] {
+ background: $brand-primary;
+ border-radius: 4px;
+ transition: $md-transaction;
+
+ i {
+ color: $color-white;
+ transition: $md-transaction;
+ }
+
+ &.mce-disabled {
+ background: transparent;
+
+ i {
+ color: inherit;
+ }
+ }
+}
From fb3b7918afcc136ad9ff56fc4b954edcbfd9b488 Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Fri, 14 Jun 2019 16:21:27 +0200
Subject: [PATCH 05/11] Fix handson table issue (#1827)
---
app/assets/javascripts/reports/new.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/assets/javascripts/reports/new.js b/app/assets/javascripts/reports/new.js
index ee5e9b8a9..8dcfb9326 100644
--- a/app/assets/javascripts/reports/new.js
+++ b/app/assets/javascripts/reports/new.js
@@ -45,7 +45,7 @@ function initializeHandsonTable(el) {
formulas: true
});
el.handsontable("getInstance").loadData(data);
- el.handsontable("getInstance").sort(3, order);
+ el.handsontable('getInstance').getPlugin('columnSorting').sort(3, order);
// "Hack" to disable user sorting rows by clicking on
// header elements
From 81d10c8ce4d256dde7a1dd65be27655f149d1c27 Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Wed, 19 Jun 2019 12:49:22 +0200
Subject: [PATCH 06/11] Remove recent protocol button on new step (#1841)
---
.../javascripts/my_modules/protocols.js | 19 ++++++++++++-------
app/assets/javascripts/protocols/steps.js.erb | 1 +
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/app/assets/javascripts/my_modules/protocols.js b/app/assets/javascripts/my_modules/protocols.js
index 1fefbc59f..fbaa091dc 100644
--- a/app/assets/javascripts/my_modules/protocols.js
+++ b/app/assets/javascripts/my_modules/protocols.js
@@ -452,16 +452,21 @@ function initRecentProtocols() {
// We use here ajax:success, because we want to check any change on this page
$(document).on('ajax:success', () => {
- var steps = $('.step');
- var protocolDescription = $('#protocol_description_view').html();
- if (steps.length === 0 && protocolDescription.length === 0) {
- recentProtocolContainer.css('display', '');
- } else {
- recentProtocolContainer.css('display', 'none');
- }
+ updateRecentProtocolsStatus();
});
}
+function updateRecentProtocolsStatus() {
+ var recentProtocolContainer = $('.my-module-recent-protocols');
+ var steps = $('.step');
+ var protocolDescription = $('#protocol_description_view').html();
+ if (steps.length === 0 && protocolDescription.length === 0) {
+ recentProtocolContainer.css('display', '');
+ } else {
+ recentProtocolContainer.css('display', 'none');
+ }
+}
+
/**
* Initializes page
*/
diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb
index 9fda360dd..f9b9de2b9 100644
--- a/app/assets/javascripts/protocols/steps.js.erb
+++ b/app/assets/javascripts/protocols/steps.js.erb
@@ -614,6 +614,7 @@
FilePreviewModal.init();
$.initTooltips();
if (typeof refreshProtocolStatusBar === 'function') refreshProtocolStatusBar();
+ if (typeof updateRecentProtocolsStatus === 'function') updateRecentProtocolsStatus();
},
error: function(xhr) {
if (xhr.responseJSON['assets.file']) {
From 9653f16196eb8cea588c035b083adf36bef05d11 Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Wed, 19 Jun 2019 13:57:04 +0200
Subject: [PATCH 07/11] Convert image to base64 in PDF reports [SCI-3557]
(#1835)
* Convert image to base64 in PDF reports
* Fix typo error
---
app/helpers/reports_helper.rb | 17 ++---------------
app/models/asset.rb | 10 ++++++++++
db/schema.rb | 12 ++++++------
3 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb
index f6fce8d87..0cae132a5 100644
--- a/app/helpers/reports_helper.rb
+++ b/app/helpers/reports_helper.rb
@@ -97,21 +97,8 @@ module ReportsHelper
end
# "Hack" to omit file preview URL because of WKHTML issues
- def report_image_asset_url(asset, type = :asset, klass = nil)
- prefix = ''
- if ENV['PAPERCLIP_STORAGE'].present? &&
- ENV['MAIL_SERVER_URL'].present? &&
- ENV['PAPERCLIP_STORAGE'] == 'filesystem'
- prefix = ENV['MAIL_SERVER_URL']
- end
- if !prefix.empty? &&
- !prefix.include?('http://') &&
- !prefix.include?('https://')
- prefix = "http://#{prefix}"
- end
- size = type == :tiny_mce_asset ? :large : :medium
- url = prefix + asset.url(size, timeout: Constants::URL_LONG_EXPIRE_TIME)
- image_tag(url, class: klass)
+ def report_image_asset_url(asset, _type = :asset, klass = nil)
+ image_tag(asset.generate_base64(:medium), class: klass)
end
# "Hack" to load Glyphicons css directly from the CDN
diff --git a/app/models/asset.rb b/app/models/asset.rb
index 6d7b332e6..a03a27882 100644
--- a/app/models/asset.rb
+++ b/app/models/asset.rb
@@ -493,6 +493,16 @@ class Asset < ApplicationRecord
!locked? && %r{^image/#{Regexp.union(Constants::WHITELISTED_IMAGE_TYPES_EDITABLE)}} =~ file.content_type
end
+ def generate_base64(style)
+ image = if file.options[:storage].to_sym == :s3
+ URI.parse(url(style)).open.to_a.join
+ else
+ File.open(file.path(style)).to_a.join
+ end
+ encoded_data = Base64.strict_encode64(image)
+ "data:#{file_content_type};base64,#{encoded_data}"
+ end
+
protected
# Checks if attachments is an image (in post processing imagemagick will
diff --git a/db/schema.rb b/db/schema.rb
index 42cf7ba6d..ba5dc8029 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -56,7 +56,7 @@ ActiveRecord::Schema.define(version: 20190520135317) do
t.datetime "updated_at", null: false
t.string "file_file_name"
t.string "file_content_type"
- t.integer "file_file_size"
+ t.bigint "file_file_size"
t.datetime "file_updated_at"
t.bigint "created_by_id"
t.bigint "last_modified_by_id"
@@ -169,7 +169,7 @@ ActiveRecord::Schema.define(version: 20190520135317) do
t.datetime "updated_at", null: false
t.string "workflowimg_file_name"
t.string "workflowimg_content_type"
- t.integer "workflowimg_file_size"
+ t.bigint "workflowimg_file_size"
t.datetime "workflowimg_updated_at"
t.uuid "uuid"
t.index ["archived_by_id"], name: "index_experiments_on_archived_by_id"
@@ -737,14 +737,14 @@ ActiveRecord::Schema.define(version: 20190520135317) do
t.datetime "updated_at", null: false
t.string "file_file_name"
t.string "file_content_type"
- t.integer "file_file_size"
+ t.bigint "file_file_size"
t.datetime "file_updated_at"
end
create_table "tiny_mce_assets", force: :cascade do |t|
t.string "image_file_name"
t.string "image_content_type"
- t.integer "image_file_size"
+ t.bigint "image_file_size"
t.datetime "image_updated_at"
t.integer "estimated_size", default: 0, null: false
t.integer "step_id"
@@ -857,7 +857,7 @@ ActiveRecord::Schema.define(version: 20190520135317) do
t.datetime "updated_at", null: false
t.string "avatar_file_name"
t.string "avatar_content_type"
- t.integer "avatar_file_size"
+ t.bigint "avatar_file_size"
t.datetime "avatar_updated_at"
t.string "confirmation_token"
t.datetime "confirmed_at"
@@ -924,7 +924,7 @@ ActiveRecord::Schema.define(version: 20190520135317) do
t.datetime "updated_at", null: false
t.string "zip_file_file_name"
t.string "zip_file_content_type"
- t.integer "zip_file_file_size"
+ t.bigint "zip_file_file_size"
t.datetime "zip_file_updated_at"
t.string "type"
t.index ["user_id"], name: "index_zip_exports_on_user_id"
From 4ddcbe5d75dee5de169795b3f09a960bd16ab518 Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Wed, 19 Jun 2019 09:56:32 +0200
Subject: [PATCH 08/11] Fix user permission for recent protocols (#1843)
---
app/views/my_modules/protocols.html.erb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/views/my_modules/protocols.html.erb b/app/views/my_modules/protocols.html.erb
index 94d8947e3..1acf4ad13 100644
--- a/app/views/my_modules/protocols.html.erb
+++ b/app/views/my_modules/protocols.html.erb
@@ -18,7 +18,9 @@
<%= render partial: "my_modules/protocols/protocol_status_bar.html.erb" %>
<%= render partial: "my_modules/protocols/protocol_buttons.html.erb" %>
- <%= render partial: "my_modules/recent_protocol_dropdown.html.erb", locals: {protocol: @my_module.protocol}%>
+ <% if can_manage_protocol_in_module?(@protocol) %>
+ <%= render partial: "my_modules/recent_protocol_dropdown.html.erb", locals: {protocol: @my_module.protocol}%>
+ <% end %>
From 5734d0cdd77b4b026fbd7cd85e0da0c6b954a9e9 Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Wed, 19 Jun 2019 09:56:18 +0200
Subject: [PATCH 09/11] Fix TinyMCE field selector for steps (#1844)
---
app/assets/javascripts/protocols/steps.js.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb
index f9b9de2b9..1f7f80a20 100644
--- a/app/assets/javascripts/protocols/steps.js.erb
+++ b/app/assets/javascripts/protocols/steps.js.erb
@@ -538,7 +538,7 @@
var nameValid = textValidator(ev, $nameInput, 1,
<%= Constants::NAME_MAX_LENGTH %>);
var $descrTextarea = $form.find("#step_description_textarea");
- var $tinyMCEInput = TinyMCE.getContent();
+ var $tinyMCEInput = tinyMCE.editors.step_description_textarea.getContent();
var descriptionValid = textValidator(ev, $descrTextarea, 0,
<%= Constants::RICH_TEXT_MAX_LENGTH %>, false, $tinyMCEInput);
var tableNamesValidArray = [];
@@ -579,7 +579,7 @@
animateSpinner(null, true);
var data = DragNDropSteps.appendFilesToForm(ev);
- data.append('step[description]', TinyMCE.getContent());
+ data.append('step[description]', $tinyMCEInput);
$.ajax({
url: $form.attr('action'),
method: 'POST',
From 609c408c77b09c41c2b64a686974cbfa1abe3257 Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Wed, 19 Jun 2019 09:56:00 +0200
Subject: [PATCH 10/11] Fix error on new step saving command (#1845)
---
app/assets/javascripts/protocols/steps.js.erb | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb
index 1f7f80a20..fc7c273af 100644
--- a/app/assets/javascripts/protocols/steps.js.erb
+++ b/app/assets/javascripts/protocols/steps.js.erb
@@ -504,10 +504,9 @@
$('#new-step-main-tab a')
.on('shown.bs.tab', function() {
$('#step_name').focus();
- TinyMCE.init('#step_description_textarea');
- }).on('hidden.bs.tab', function() {
tinyMCE.editors.step_description_textarea.remove();
- });
+ TinyMCE.init('#step_description_textarea');
+ })
TinyMCE.init('#step_description_textarea');
});
From 83b9efd7dd8ad7e56e426a842ac0a05f6641101c Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Wed, 19 Jun 2019 09:55:49 +0200
Subject: [PATCH 11/11] Fix right floating images in RTE editor (#1842)
---
app/assets/stylesheets/tiny_mce.scss | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/assets/stylesheets/tiny_mce.scss b/app/assets/stylesheets/tiny_mce.scss
index f69adf97c..40aa5b53b 100644
--- a/app/assets/stylesheets/tiny_mce.scss
+++ b/app/assets/stylesheets/tiny_mce.scss
@@ -5,8 +5,11 @@
border: solid 1px;
border-color: $color-white;
border-radius: 3px;
+ float: left;
+ margin-bottom: 10px;
min-height: 100px;
padding: 3px;
+ width: 100%;
&:hover {
border-color: $color-gainsboro;
<% comments.each do |comment| %> - <% comment_ts = comment.created_at %> --
-
- <%=t "projects.reports.elements.step_comments.comment_prefix", user: comment.user.full_name, date: l(comment_ts, format: :full_date), time: l(comment_ts, format: :time) %>
-
-
-
+ <%= render partial: 'shared/comments/item.html.erb', locals: { comment: comment, readonly: true, report: true } %>`
<% end %>
<% end %> diff --git a/app/views/shared/comments/_item.html.erb b/app/views/shared/comments/_item.html.erb index a7fd24bc3..2b7b49edc 100644 --- a/app/views/shared/comments/_item.html.erb +++ b/app/views/shared/comments/_item.html.erb @@ -1,6 +1,8 @@ - <% user_comment = comment.user == current_user %> +<% report = false unless defined?(report) %> +<% readonly = false unless defined?(readonly) %> +<% edit_mode = (comment.user == current_user && !readonly) %>