Move assigned to button to assigned to attribute

This commit is contained in:
Alexander Meindl 2024-10-10 16:42:53 +02:00
parent 7910ce50a6
commit 097198e741
8 changed files with 54 additions and 9 deletions

View File

@ -1,5 +1,8 @@
# Changelog
- Move assign to me button to assign to block
- svg icons support for Redmine 6
## 3.4.0
## 3.3.2

View File

@ -50,18 +50,28 @@ module AdditionalsIconsHelper
:svg,
content_tag(:use,
'',
{ 'href' => "#{additionals_image_path}/#{sprite_path}#icon--#{icon_name}" }),
{ 'href' => additionals_asset_path("#{sprite_path}#icon--#{icon_name}") }),
class: css_classes,
title: title.presence,
aria: { hidden: true }
)
end
def additionals_image_path
def additionals_asset_path(file)
plugin_id = 'additionals'
if Additionals.redmine6?
asset_path "plugin_assets/#{plugin_id}/#{file}"
else
"#{additionals_image_path plugin_id}/#{file}"
end
end
def additionals_image_path(plugin_id)
return asset_path if Additionals.redmine6?
return @additionals_image_path if defined? @additionals_image_path
relative_url = Redmine::Utils.relative_url_root
plugin_id = 'additionals'
@additionals_image_path = "#{relative_url}/plugin_assets/#{plugin_id}/images"
end

View File

@ -32,4 +32,21 @@ module AdditionalsIssuesHelper
issue.new_record? && User.current.allowed_to?(:change_new_issue_author, issue.project) ||
issue.persisted? && User.current.allowed_to?(:edit_issue_author, issue.project)
end
def render_assign_to_me_button(issue)
link_to svg_icon_tag('assign'),
issue_assign_to_me_path(issue),
method: :put,
class: 'a-icon assign-to-me',
title: l(:button_assign_to_me)
end
def show_render_assign_to_me_button(issue)
User.current.logged? &&
Additionals.setting?(:issue_assign_to_me) &&
issue.editable? &&
issue.safe_attribute?('assigned_to_id') &&
issue.assigned_to_id != User.current.id &&
issue.project.assignable_users.detect { |u| u.id == User.current.id }
end
end

View File

@ -3,7 +3,5 @@
issue.editable? && \
issue.safe_attribute?('assigned_to_id') && \
issue.assigned_to_id != User.current.id && \
project.assignable_users.detect { |u| u.id == User.current.id }
= link_to font_awesome_icon('far_user-circle', post_text: l(:button_assign_to_me)),
issue_assign_to_me_path(issue), method: :put,
class: 'assign-to-me'
issue.project.assignable_users.detect { |u| u.id == User.current.id }
= render_assign_to_me_button issue, label: :button_assign_to_me

View File

@ -12,3 +12,8 @@
return false;
});
});
- if show_render_assign_to_me_button @issue
javascript:
$('.issue .assigned-to.attribute>.value')
.append("#{escape_javascript render_assign_to_me_button(@issue)} ");

View File

@ -831,7 +831,16 @@
<path d="M15 3l6 6" />
</g>
</symbol>
<symbol viewBox="0 0 24 24" id="icon--settings">
<symbol viewBox="0 0 24 24" id="icon--assign">
<!-- arrow-right-dashed -->
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M12 5v.5m0 3v1.5m0 3v6" />
<path d="M18 13l-6 6" />
<path d="M6 13l6 6" />
</g>
</symbol>
<symbol viewBox="0 0 24 24" id="icon--settings">
<!-- settings -->
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z" />

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -14,6 +14,10 @@
padding-bottom: 10px;
}
.assigned-to.attribute a.a-icon.assign-to-me {
margin-left: 5px;
}
.query-description,
.dashboard-description {
color: #666;

View File

@ -12,7 +12,6 @@ module Additionals
render_on :view_layouts_base_body_bottom, partial: 'additionals/body_bottom'
render_on :view_account_login_bottom, partial: 'login_text'
render_on :view_issue_action_menu, partial: 'issues/additionals_action_menu'
render_on :view_issues_show_description_bottom, partial: 'issues/additionals_show_description_bottom'
render_on :view_issues_context_menu_start, partial: 'additionals_closed_issues'
render_on :view_issues_bulk_edit_details_bottom, partial: 'change_author_bulk'