summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/avatars_helper.rb1
-rw-r--r--app/helpers/reactions_helper.rb14
-rw-r--r--app/helpers/settings_helper.rb3
3 files changed, 10 insertions, 8 deletions
diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb
index b39427bda..88a571b62 100644
--- a/app/helpers/avatars_helper.rb
+++ b/app/helpers/avatars_helper.rb
@@ -44,6 +44,7 @@ module AvatarsHelper
if user.respond_to?(:mail)
email = user.mail
options[:title] = user.name unless options[:title]
+ options[:initials] = user.initials if options[:default] == "initials"
elsif user.to_s =~ %r{<(.+?)>}
email = $1
end
diff --git a/app/helpers/reactions_helper.rb b/app/helpers/reactions_helper.rb
index 911da7127..88d7f5c35 100644
--- a/app/helpers/reactions_helper.rb
+++ b/app/helpers/reactions_helper.rb
@@ -26,15 +26,15 @@ module ReactionsHelper
detail = object.reaction_detail
- reaction = detail.user_reaction
+ user_reaction = detail.user_reaction
count = detail.reaction_count
visible_user_names = detail.visible_users.take(DISPLAY_REACTION_USERS_LIMIT).map(&:name)
tooltip = build_reaction_tooltip(visible_user_names, count)
- if Redmine::Reaction.writable?(object, User.current)
- if reaction&.persisted?
- reaction_button_reacted(object, reaction, count, tooltip)
+ if Redmine::Reaction.editable?(object, User.current)
+ if user_reaction.present?
+ reaction_button_reacted(object, user_reaction, count, tooltip)
else
reaction_button_not_reacted(object, count, tooltip)
end
@@ -52,7 +52,7 @@ module ReactionsHelper
def reaction_button_reacted(object, reaction, count, tooltip)
reaction_button_wrapper object do
link_to(
- sprite_icon('thumb-up-filled', count),
+ sprite_icon('thumb-up-filled', count.nonzero?),
reaction_path(reaction, object_type: object.class.name, object_id: object),
remote: true, method: :delete,
class: ['icon', 'reaction-button', 'reacted'],
@@ -64,7 +64,7 @@ module ReactionsHelper
def reaction_button_not_reacted(object, count, tooltip)
reaction_button_wrapper object do
link_to(
- sprite_icon('thumb-up', count),
+ sprite_icon('thumb-up', count.nonzero?),
reactions_path(object_type: object.class.name, object_id: object),
remote: true, method: :post,
class: 'icon reaction-button',
@@ -76,7 +76,7 @@ module ReactionsHelper
def reaction_button_readonly(object, count, tooltip)
reaction_button_wrapper object do
tag.span(class: 'icon reaction-button readonly', title: tooltip) do
- sprite_icon('thumb-up', count)
+ sprite_icon('thumb-up', count.nonzero?)
end
end
end
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 39a836a03..c1f989805 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -244,6 +244,7 @@ module SettingsHelper
['Mystery man', 'mm'],
['Retro', 'retro'],
['Robohash', 'robohash'],
- ['Wavatars', 'wavatar']]
+ ['Wavatars', 'wavatar'],
+ ['Initials', 'initials']]
end
end