mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Merge branch 'dev' into code-maintenance/74088-backlog-sprints-component-renaming
# Conflicts: # modules/backlogs/app/components/backlogs/backlog_bucket_item_component.rb # modules/backlogs/app/components/backlogs/inbox_item_component.rb # modules/backlogs/app/components/backlogs/sprint_component.rb # modules/backlogs/spec/components/backlogs/backlog_bucket_item_component_spec.rb # modules/backlogs/spec/components/backlogs/inbox_item_component_spec.rb # modules/backlogs/spec/components/backlogs/sprint_component_spec.rb
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
A `SelectPanel` is used when the user needs to select one or more items from a list. It combines a trigger button with a dropdown panel containing searchable, selectable items.
|
||||
The ability to search for items is what mainly separates this from the `ActionMenu` in our usage.
|
||||
|
||||
For details on the component, please see the [Primer documentation](https://primer.style/product/components/select-panel/).
|
||||
|
||||
## With footer button
|
||||
|
||||
When selections need to be explicitly confirmed before taking effect, add a footer with an action button.
|
||||
The button should ideally be named "Apply".
|
||||
|
||||
<%= embed Patterns::SelectPanelPreview, :footer_buttons, panels: %i[source] %>
|
||||
|
||||
## Examples
|
||||
|
||||
For detailed examples have a look at the other [preview examples](/lookbook/inspect/primer/alpha/select_panel/default) of the component.
|
||||
@@ -0,0 +1,39 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License version 3.
|
||||
#
|
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
# Copyright (C) 2010-2013 the ChiliProject Team
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
module Patterns
|
||||
# @hidden
|
||||
class SelectPanelPreview < ViewComponent::Preview
|
||||
# @display min_height 400px
|
||||
def footer_buttons
|
||||
render_with_template
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
<%=
|
||||
render(
|
||||
Primer::Alpha::SelectPanel.new(
|
||||
select_variant: :multiple,
|
||||
fetch_strategy: :local,
|
||||
title: "Select roles",
|
||||
open_on_load: true
|
||||
)
|
||||
) do |panel|
|
||||
panel.with_show_button(scheme: :secondary) do |button|
|
||||
button.with_trailing_visual_icon(icon: :"triangle-down")
|
||||
"3 roles selected"
|
||||
end
|
||||
panel.with_item(label: "Admin", active: true, item_id: "1")
|
||||
panel.with_item(label: "Developer", active: true, item_id: "2")
|
||||
panel.with_item(label: "Designer", active: true, item_id: "3")
|
||||
panel.with_item(label: "Viewer", item_id: "4")
|
||||
panel.with_item(label: "Copy project", item_id: "5")
|
||||
panel.with_footer(show_divider: true) do
|
||||
render(
|
||||
Primer::Beta::Button.new(scheme: :primary)
|
||||
) { t(:button_apply) }
|
||||
end
|
||||
end
|
||||
%>
|
||||
Reference in New Issue
Block a user