OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Show the actionmenu and a hint about why you are not able to change
Klaus Zanders9e26d806c904
diff --git a/app/components/shares/invite_user_form_component.html.erb b/app/components/shares/invite_user_form_component.html.erbindex 94f43792589..90f0458b448 100644--- a/app/components/shares/invite_user_form_component.html.erb+++ b/app/components/shares/invite_user_form_component.html.erb@@ -1,7 +1,6 @@<%=component_wrapper do- if strategy.manageable?- primer_form_with(+ primer_form_with(model: new_share,url: url_for([entity, Member]),data: { controller: 'user-limit shares--user-selected',@@ -17,7 +16,7 @@invite_form.with_area('permission') dorender(Shares::PermissionButtonComponent.new(share: new_share,- available_roles: strategy.available_roles,+ strategy: strategy,form_arguments: { builder: form, name: "role_id" },data: { 'test-selector': 'op-share-dialog-invite-role' }))@@ -92,7 +91,6 @@endendend- endendend%>diff --git a/app/components/shares/modal_body_component.html.erb b/app/components/shares/modal_body_component.html.erbindex a4cf6c39cb9..aaa239c859b 100644--- a/app/components/shares/modal_body_component.html.erb+++ b/app/components/shares/modal_body_component.html.erb@@ -8,8 +8,10 @@endend- modal_content.with_row do- render(Shares::InviteUserFormComponent.new(strategy:, errors: errors))+ if strategy.manageable?+ modal_content.with_row do+ render(Shares::InviteUserFormComponent.new(strategy:, errors: errors))+ endendmodal_content.with_row(data: { 'test-selector': 'op-share-dialog-active-list',diff --git a/app/components/shares/modal_body_component.sass b/app/components/shares/modal_body_component.sassindex 44f6e8260e2..1deaf6e981e 100644--- a/app/components/shares/modal_body_component.sass+++ b/app/components/shares/modal_body_component.sass@@ -4,8 +4,8 @@&--user-rowdisplay: grid- grid-template-columns: minmax(31px, auto) 1fr // 31px is the width needed to display a group avatar- grid-template-areas: "avatar user_details"+ grid-template-columns: minmax(31px, auto) 1fr auto // 31px is the width needed to display a group avatar+ grid-template-areas: "avatar user_details button"grid-column-gap: 10px&_manageablediff --git a/app/components/shares/permission_button_component.html.erb b/app/components/shares/permission_button_component.html.erbindex 24a63a92b6d..133373a5578 100644--- a/app/components/shares/permission_button_component.html.erb+++ b/app/components/shares/permission_button_component.html.erb@@ -1,28 +1,30 @@<%=component_wrapper do- render(Primer::Alpha::ActionMenu.new(**{ select_variant: :single,- size: :small,- dynamic_label: true,- anchor_align: :end,- color: :subtle }.deep_merge(@system_arguments))) do |menu|- menu.with_show_button(data: { 'shares--bulk-selection-target': 'userRowRole',- 'share-id': share.id,- 'active-role-name': permission_name(active_role.id)}) do |button|- button.with_trailing_action_icon(icon: :"triangle-down")- permission_name(active_role.id)- end+ content_tag(:div, class: tooltip_wrapper_classes, data: { tooltip: tooltip_message }) do+ render(Primer::Alpha::ActionMenu.new(**{ select_variant: :single,+ size: :small,+ dynamic_label: true,+ anchor_align: :end,+ color: :subtle }.deep_merge(@system_arguments))) do |menu|+ menu.with_show_button(disabled: !strategy.manageable?, data: { 'shares--bulk-selection-target': 'userRowRole',+ 'share-id': share.id,+ 'active-role-name': permission_name(active_role.id)}) do |button|+ button.with_trailing_action_icon(icon: :"triangle-down")+ permission_name(active_role.id)+ end- @available_roles.each do |role_hash|- menu.with_item(label: role_hash[:label],- href: update_path,- method: :patch,- active: role_active?(role_hash),- data: { value: role_hash[:value] },- form_arguments: {- method: :patch,- inputs: form_inputs(role_hash[:value])- }) do |item|- item.with_description.with_content(role_hash[:description])+ strategy.available_roles.each do |role_hash|+ menu.with_item(label: role_hash[:label],+ href: update_path,+ method: :patch,+ active: role_active?(role_hash),+ data: { value: role_hash[:value] },+ form_arguments: {+ method: :patch,+ inputs: form_inputs(role_hash[:value])+ }) do |item|+ item.with_description.with_content(role_hash[:description])+ endendendenddiff --git a/app/components/shares/permission_button_component.rb b/app/components/shares/permission_button_component.rbindex 2746241a157..6c0527cf178 100644--- a/app/components/shares/permission_button_component.rb+++ b/app/components/shares/permission_button_component.rb@@ -32,10 +32,10 @@ module Sharesinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- def initialize(share:, available_roles:, **system_arguments)+ def initialize(share:, strategy:, **system_arguments)super- @available_roles = available_roles+ @strategy = strategy@share = share@system_arguments = system_argumentsend@@ -58,7 +58,7 @@ module Sharesprivate- attr_reader :share, :available_roles+ attr_reader :share, :strategydef active_roleif share.persisted?@@ -71,7 +71,7 @@ module Sharesenddef permission_name(value)- available_roles.find { |role_hash| role_hash[:value] == value }[:label]+ strategy.available_roles.find { |role_hash| role_hash[:value] == value }[:label]enddef form_inputs(role_id)@@ -80,5 +80,17 @@ module Sharesinputs << { name: "filters", value: params[:filters] } if params[:filters]endend++ def tooltip_message+ return if strategy.manageable?++ I18n.t("sharing.denied", entities: strategy.entity.class.model_name.human(count: 2))+ end++ def tooltip_wrapper_classes+ return [] if strategy.manageable?++ ["tooltip--left"]+ endendenddiff --git a/app/components/shares/project_queries/public_flag_component.html.erb b/app/components/shares/project_queries/public_flag_component.html.erbindex d166d2999bc..ca74841f1a3 100644--- a/app/components/shares/project_queries/public_flag_component.html.erb+++ b/app/components/shares/project_queries/public_flag_component.html.erb@@ -1,6 +1,6 @@<%=container.with_row do- content_tag(:div, class: wrapper_classes, data: { tooltip: tooltip }) do+ content_tag(:div, class: tooltip_wrapper_classes, data: { tooltip: tooltip_message }) dorender(Primer::Forms::ToggleSwitchForm.new(name: "publish_project_query",label: t("sharing.project_queries.public_flag.label", instance_name: Setting.app_title),diff --git a/app/components/shares/project_queries/public_flag_component.rb b/app/components/shares/project_queries/public_flag_component.rbindex 36154bcf0b0..5c7a208a7a7 100644--- a/app/components/shares/project_queries/public_flag_component.rb+++ b/app/components/shares/project_queries/public_flag_component.rb@@ -57,13 +57,13 @@ module SharesUser.current.allowed_globally?(:manage_public_project_queries)end- def tooltip+ def tooltip_messagereturn if can_publish?I18n.t("sharing.project_queries.publishing_denied")end- def wrapper_classes+ def tooltip_wrapper_classesreturn ["d-flex", "flex-column"] if can_publish?["tooltip--bottom", "d-flex", "flex-column"]diff --git a/app/components/shares/share_row_component.html.erb b/app/components/shares/share_row_component.html.erbindex f633f52876b..8663e29e3b8 100644--- a/app/components/shares/share_row_component.html.erb+++ b/app/components/shares/share_row_component.html.erb@@ -20,13 +20,13 @@render(Shares::UserDetailsComponent.new(share:, manager_mode: share_editable?))end- if share_editable?- user_row_grid.with_area(:button, tag: :div, color: :subtle) do- render(Shares::PermissionButtonComponent.new(share:,- available_roles: @available_roles,- data: { 'test-selector': 'op-share-dialog-update-role' }))- end+ user_row_grid.with_area(:button, tag: :div, color: :subtle) do+ render(Shares::PermissionButtonComponent.new(share:,+ strategy: strategy,+ data: { 'test-selector': 'op-share-dialog-update-role' }))+ end+ if share_editable?user_row_grid.with_area(:remove, tag: :div) doform_with url: url_for([entity, share]), method: :delete dorender(Primer::Beta::IconButton.new(icon: "trash",diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rbindex 5eebc6cef77..4402c5e7bd6 100644--- a/app/controllers/shares_controller.rb+++ b/app/controllers/shares_controller.rb@@ -223,7 +223,7 @@ class SharesController < ApplicationControllerreplace_via_turbo_stream(component: Shares::PermissionButtonComponent.new(share: @share,- available_roles: sharing_strategy.available_roles,+ strategy: sharing_strategy,data: { "test-selector": "op-share-dialog-update-role" }))@@ -265,7 +265,7 @@ class SharesController < ApplicationControllerreplace_via_turbo_stream(component: Shares::PermissionButtonComponent.new(share:,- available_roles: sharing_strategy.available_roles,+ strategy: sharing_strategy,data: { "test-selector": "op-share-dialog-update-role" }))diff --git a/app/models/queries/base_query.rb b/app/models/queries/base_query.rbindex 48bb38fc16d..bcb74ac05a3 100644--- a/app/models/queries/base_query.rb+++ b/app/models/queries/base_query.rb@@ -51,14 +51,13 @@ module Queries::BaseQuery:activerecordend- # Use the Query class' error messages.- # So everything under+ # Also use the Query class' as a lookup ancestor so that error messages, etc can be shared.+ # So if nothing is defined for the specific query class, we fall back to the generic query class.#+ # This is useful for error messages, because we can fall back to error messages, etc in# activerecord.errors.models.query- #- # is found.def lookup_ancestors- [Query]+ super + [Query]endend