mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Update role selector
This commit is contained in:
@@ -29,12 +29,31 @@ See COPYRIGHT and LICENSE files for more details.
|
||||
|
||||
<%=
|
||||
render Primer::OpenProject::SubHeader.new do |subheader|
|
||||
if @type && @available_roles.any?
|
||||
subheader.with_filter_component do
|
||||
render(Primer::Alpha::ActionMenu.new(select_variant: :single)) do |menu|
|
||||
menu.with_show_button(scheme: :secondary) do |button|
|
||||
button.with_trailing_visual_icon(icon: :"triangle-down")
|
||||
@current_role ? t("admin.workflows.role_selector.label", role: @current_role.name) : t("admin.workflows.role_selector.no_role")
|
||||
end
|
||||
@available_roles.each do |role|
|
||||
menu.with_item(
|
||||
label: role.name,
|
||||
tag: :a,
|
||||
href: helpers.edit_workflow_path(@type, role_id: role.id, tab: @tab || "always"),
|
||||
active: role == @current_role
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
subheader.with_action_button(
|
||||
tag: :a,
|
||||
scheme: :secondary,
|
||||
leading_icon: :plus,
|
||||
label: t("admin.workflows.status_button"),
|
||||
href: helpers.status_dialog_workflows_path(role_id: @role&.id, type_id: @type&.id, tab: @tab),
|
||||
href: helpers.status_dialog_workflows_path(role_id: @current_role&.id, type_id: @type&.id, tab: @tab),
|
||||
data: { controller: "async-dialog" }
|
||||
) do
|
||||
t("admin.workflows.status_button")
|
||||
|
||||
@@ -32,11 +32,12 @@ module Workflows
|
||||
class EditSubHeaderComponent < ApplicationComponent
|
||||
include OpPrimer::ComponentHelpers
|
||||
|
||||
def initialize(tab:, role: nil, type: nil)
|
||||
def initialize(tab:, current_role: nil, type: nil, available_roles: [])
|
||||
super
|
||||
@tab = tab
|
||||
@role = role
|
||||
@current_role = current_role
|
||||
@type = type
|
||||
@available_roles = available_roles
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,34 +32,7 @@ See COPYRIGHT and LICENSE files for more details.
|
||||
<%= render Workflows::EditPageHeaderComponent.new(@type, tabs: workflow_tabs(@type)) %>
|
||||
<% end %>
|
||||
|
||||
<%= styled_form_tag({}, method: "get") do %>
|
||||
<%= hidden_field_tag "tab", params[:tab] || "always" %>
|
||||
|
||||
<fieldset class="simple-filters--container">
|
||||
<legend><%= t(:text_workflow_edit) %></legend>
|
||||
<ul class="simple-filters--filters">
|
||||
<li class="simple-filters--filter">
|
||||
<%= styled_label_tag :role_id, Role.model_name.human, class: "simple-filters--filter-name" %>
|
||||
<div class="simple-filters--filter-value">
|
||||
<%= styled_select_tag "role_id", options_from_collection_for_select(@roles, "id", "name", @role && @role.id) %>
|
||||
</div>
|
||||
</li>
|
||||
<li class="simple-filters--controls">
|
||||
<%= render(
|
||||
Primer::Beta::Button.new(
|
||||
scheme: :primary,
|
||||
type: :submit,
|
||||
name: nil,
|
||||
accesskey: accesskey(:edit),
|
||||
size: :small
|
||||
)
|
||||
) { t(:button_edit) } %>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%= render Workflows::EditSubHeaderComponent.new(tab: params[:tab], role: @role, type: @type) %>
|
||||
<%= render Workflows::EditSubHeaderComponent.new(tab: params[:tab], current_role: @role, type: @type, available_roles: @roles) %>
|
||||
|
||||
<% if @type && @role %>
|
||||
<%= turbo_frame_tag "workflow-table" do %>
|
||||
|
||||
@@ -415,6 +415,9 @@ en:
|
||||
other: "Remove %{count} statuses?"
|
||||
description: "Removing these statuses will make them unavailable to this type and delete existing workflows. Are you sure you want to proceed?"
|
||||
confirm: "Remove"
|
||||
role_selector:
|
||||
label: "Role: %{role}"
|
||||
no_role: "Select role"
|
||||
|
||||
authentication:
|
||||
login_and_registration: "Login and registration"
|
||||
|
||||
Reference in New Issue
Block a user