Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/components/_index.sass
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "admin/settings_search_component"
@import "ai/text_transforms/result_pane_component"
@import "colors/swatch_component"
@import "enterprise_edition/banner_component"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
flex_layout(align_items: :center, justify_content: :space_between) do |container|
container.with_column do
render(Primer::Beta::Link.new(href: admin_departments_path, underline: false, color: :default)) do
render(Primer::Beta::Heading.new(tag: :h4)) { organization_name }
render(Primer::Beta::Heading.new(tag: :h4, data: { setting_name: "organization_name" })) { organization_name }
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def initialize(name:, columns:, selected:, protected:)
def call
helpers.angular_component_tag(
"opce-draggable-autocompleter",
data: { setting_name: name },
inputs: {
autofocus: false,
options: columns,
Expand Down
56 changes: 56 additions & 0 deletions app/components/admin/settings_search/filter_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 Admin
module SettingsSearch
class FilterComponent < ApplicationComponent
def call
helpers.turbo_frame_tag(Admin::SettingsSearchComponent::FRAME_ID, class: "op-admin-settings-search--frame") do
render(
Primer::OpenProject::FilterableTreeView.new(
src: helpers.tree_admin_settings_search_path,
classes: "op-admin-settings-search--tree",
show_search_highlighting: false,
include_sub_items_check_box_arguments: { hidden: true },
filter_mode_control_arguments: { hidden: true },
filter_input_arguments: {
autofocus: true,
autocomplete: "off",
placeholder: t("admin.settings_search.filter_placeholder"),
data: { test_selector: "op-admin-settings-search--filter" }
},
no_results_node_arguments: { label: t("admin.settings_search.no_results") }
)
)
end
end
end
end
end
41 changes: 41 additions & 0 deletions app/components/admin/settings_search/tree_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<%#-- 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.

++#%>

<%= render(
Primer::Alpha::TreeView.new(
node_variant: :anchor,
data: { target: "filterable-tree-view.treeViewList" }
)
) do |tree_view| %>
<% if @tree.nodes.empty? %>
<% tree_view.with_leaf(label: t("admin.settings_search.no_results"), disabled: true) %>
<% else %>
<% @tree.nodes.each { add_node(tree_view, it) } %>
<% end %>
<% end %>
67 changes: 67 additions & 0 deletions app/components/admin/settings_search/tree_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 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 Admin
module SettingsSearch
class TreeComponent < ApplicationComponent
include SearchHighlightingHelper

def initialize(tree:)
super()
@tree = tree
end

private

def add_node(parent, node)
if node.children.any?
parent.with_sub_tree(label: label(node), href: node.href, expanded: searching?, select_variant: :none,
data: node_data(node)) do |sub_tree|
node.children.each { add_node(sub_tree, it) }
end
else
parent.with_leaf(label: label(node), href: node.href, select_variant: :none, data: node_data(node))
end
end

def label(node)
searching? ? highlight_text_by_terms(node.label, @tree.query_words) : node.label
end

def searching?
@tree.query_words.any?
end

def node_data(node)
{ node_id: node.key, test_selector: "op-admin-settings-search--node" }
end
end
end
end
55 changes: 55 additions & 0 deletions app/components/admin/settings_search_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<%#-- 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.

++#%>

<%= render(Primer::Box.new(px: 2, pb: 2, data: { test_selector: "op-admin-settings-search" })) do %>
<%= render(
Primer::Alpha::Overlay.new(
title: t("admin.settings_search.title"),
visually_hide_title: true,
anchor_side: :outside_bottom,
anchor_align: :start,
size: :large,
padding: :none,
role: :dialog
)
) do |overlay| %>
<% overlay.with_show_button(block: true, data: { test_selector: "op-admin-settings-search--button" }) do |button| %>
<% button.with_leading_visual_icon(icon: :search) %>
<%= t("admin.settings_search.button") %>
<% end %>

<% overlay.with_body(classes: "op-admin-settings-search--body") do %>
<%= helpers.turbo_frame_tag FRAME_ID,
src: helpers.admin_settings_search_path,
loading: :lazy,
target: "_top",
class: "op-admin-settings-search--frame" %>
<% end %>
<% end %>
<% end %>
39 changes: 39 additions & 0 deletions app/components/admin/settings_search_component.rb
Original file line number Diff line number Diff line change
@@ -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 Admin
class SettingsSearchComponent < ApplicationComponent
FRAME_ID = "op-admin-settings-search-frame"

def render?
User.current.admin?
end
end
end
55 changes: 55 additions & 0 deletions app/components/admin/settings_search_component.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//-- 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.
//++

.op-admin-settings-search
&--body
display: flex
max-height: 75dvh
overflow: hidden
margin: var(--base-size-16)
margin-right: 0

&--frame
display: flex
max-height: 100%
flex-basis: 100%

&--tree
flex-grow: 1
min-width: 0

@keyframes op-setting-highlight-fade
to
background-color: transparent
box-shadow: none

.op-setting--highlighted
border-radius: var(--borderRadius-medium)
background-color: var(--bgColor-attention-muted)
box-shadow: 0 0 0 var(--base-size-8) var(--bgColor-attention-muted)
animation: op-setting-highlight-fade 1s ease-out 3s forwards
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ See COPYRIGHT and LICENSE files for more details.
status_label_position: :start,
checked: enabled?,
enabled: writable?,
data: { turbo: true },
data: { turbo: true, setting_name: SETTING_NAME },
test_selector: "toggle-ai-text-transform-actions-enabled",
mb: 3
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ See COPYRIGHT and LICENSE files for more details.
<% box.with_row(icon: :info) { scoped_t(:"planned_changes.single_value") } %>
<% end %>

<%= render(WorkPackages::Admin::Settings::NoticeBoxComponent.new(heading: scoped_t(:"action_required.heading"), mt: 3)) do |box| %>
<%= render(
WorkPackages::Admin::Settings::NoticeBoxComponent.new(
heading: scoped_t(:"action_required.heading"),
mt: 3,
data: { setting_name: "work_package_multiple_versions" }
)
) do |box| %>
<% if multiple_versions_writable? %>
<% box.with_row(icon: :tools) { scoped_t(:"action_required.manual_conversion_hint") } %>
<% else %>
Expand Down
Loading
Loading