Skip to content

Commit

Permalink
wip index
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Dec 11, 2024
1 parent 6d93667 commit 799692d
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<%#-- 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.
++#%>

<%=
flex_layout(data: wrapper_data_attributes) do |flex|
flex.with_row do
render(Primer::OpenProject::SubHeader.new) do |subheader|
subheader.with_filter_input(
name: "border-box-filter",
label: t("settings.project_life_cycle_step_definitions.filter.label"),
visually_hide_label: true,
placeholder: t("settings.project_life_cycle_step_definitions.filter.label"),
leading_visual: {
icon: :search,
size: :small
},
show_clear_button: true,
data: {
action: "input->projects--settings--border-box-filter#filterLists",
"projects--settings--border-box-filter-target": "filter"
}
)
end
end

flex.with_row do
render(border_box_container(mb: 3)) do |component|
component.with_header(font_weight: :bold, py: 2) do
flex_layout(justify_content: :space_between, align_items: :center) do |header_container|
header_container.with_column do
render(Primer::Beta::Text.new(font_weight: :bold)) do
I18n.t("settings.project_life_cycle_step_definitions.section_header")
end
end
end
end
if definitions.empty?
component.with_row do
render(Primer::Beta::Text.new(color: :subtle)) { t("settings.project_life_cycle_step_definitions.non_defined") }
end
else
definitions.each do |definition|
component.with_row(data: { "projects--settings--border-box-filter-target": "searchItem" }) do
render(Settings::ProjectLifeCycleStepDefinitions::RowComponent.new(definition))
end
end
end
end
end
flex.with_row do
render Primer::Beta::Text.new(
display: :none,
data: {
"projects--settings--border-box-filter-target": "noResultsText",
}
) do
I18n.t("js.autocompleter.notFoundText")
end
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#-- 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 Settings
module ProjectLifeCycleStepDefinitions
class IndexComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

options :definitions

private

def wrapper_data_attributes
{
controller: "projects--settings--border-box-filter",
"application-target": "dynamic"
}
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<%#-- 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.
++#%>

<%=
flex_layout(align_items: :center,
justify_content: :space_between) do |step_container|
step_container.with_column(flex_layout: true) do |title_container|
title_container.with_column(pt: 1, mr: 3) do
render(Primer::Beta::Link.new(
classes: 'filter-target-visible-text',
href: edit_admin_settings_project_life_cycle_step_definition_path(definition),
font_weight: :bold
)) do
definition.name
end
end
title_container.with_column(pt: 1) do
render(Projects::LifeCycleTypeComponent.new(definition))
end
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#-- 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 Settings
module ProjectLifeCycleStepDefinitions
class RowComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

alias_method :definition, :model
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ class ProjectLifeCycleStepDefinitionsController < ::Admin::SettingsController

before_action :check_feature_flag

before_action :find_definitions, only: %i[index]
before_action :find_definition, only: %i[edit update]

def index; end

def new_stage
@definition = Project::StageDefinition.new

Expand Down Expand Up @@ -76,6 +79,10 @@ def check_feature_flag
render_404 unless OpenProject::FeatureDecisions.stages_and_gates_active?
end

def find_definitions
@definitions = Project::LifeCycleStepDefinition.all
end

def find_definition
@definition = Project::LifeCycleStepDefinition.find(params[:id])
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t("settings.project_life_cycle_step_definitions.heading") %>

<%= render Settings::ProjectLifeCycleStepDefinitions::IndexHeaderComponent.new %>
<%= render Settings::ProjectLifeCycleStepDefinitions::IndexComponent.new(definitions: @definitions) %>
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3707,6 +3707,10 @@ en:
label_add_description: "Add lifecycle definition"
label_add_stage: "Stage"
label_add_gate: "Gate"
filter:
label: "Search project stage or gate"
section_header: "Stages and gates"
non_defined: "Neither stages nor gates are currently defined."
new:
description: "Changes to this project step will be reflected in all projects where it is enabled."
new_stage:
Expand Down

0 comments on commit 799692d

Please sign in to comment.