-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Epic/49688 custom set of project attributes grouped in sections #14525
Merged
dombesz
merged 218 commits into
dev
from
epic/49688-custom-set-of-project-attributes-grouped-in-sections
Mar 25, 2024
Merged
Changes from all commits
Commits
Show all changes
218 commits
Select commit
Hold shift + click to select a range
a372071
[#49688] Individuelle Gruppen für Projektattribute
jjabari-op 2a90598
WIP: first steps introducing project attributes on project overview p…
jjabari-op cc886f2
introduce project custom field sections and project mapping
jjabari-op 7d83ab0
introducing project attributes management with generic drag and drop …
jjabari-op a7a3f98
introducing project custom field create and edit
jjabari-op 029c655
refactored datamodeling, reuse custom field forms in new project attr…
jjabari-op 7d56b2a
fixed active menu item
jjabari-op f7f3b2b
disable project custom field management through custom fields UI
jjabari-op 2901b47
refactored project attributes sidebar and dialog following previous r…
jjabari-op 396f9e2
introduce project custom field mapping UI
jjabari-op 703c446
disable auto enabling of new project custom fields
jjabari-op 358e77e
minor cleanup
jjabari-op a01a6b5
Merge branch 'dev' into epic/49688-individuelle-gruppen-für-projektat…
jjabari-op f3b0460
quick fix issue when no custom field is enabled for a project
jjabari-op 15048a0
setup auto-scroller for project custom field admin page as suggested …
jjabari-op 458cffa
added client side project custom field mapping filter via stimulus
jjabari-op 566d71a
added missing format display to project custom field mapping
jjabari-op 84dd14d
temporary fix of overview page width issue seen in firefox
jjabari-op e1c9266
fixed responsive behavior and non-sidebar support
jjabari-op 8c65e24
enable reverting of elements if they are dropped outside of a valid t…
jjabari-op fe77f6b
refined empty section behavior as requested
jjabari-op 5a4a756
edit project attribute via click on name in row
jjabari-op 2184c2a
fixed translation for section edit action
jjabari-op 3959ab3
Merge branch 'dev' into epic/49688-individuelle-gruppen-für-projektat…
jjabari-op 9e859cb
add bulk actions to project custom field mapping UI
jjabari-op 5d97caf
added project count on global project attributes settings page
jjabari-op ce8a66e
minor refactoring
jjabari-op 2eb825e
switched to whole button instead of icon_button for toggling project …
jjabari-op ea80fa9
enable status code usage when responding with turbo streams
jjabari-op 390d1be
refactored project attributes update via project overview page dialog…
jjabari-op 6209f12
fixed single user select list input scope
jjabari-op 134d3b5
WIP: fixing user and multi value inputs
jjabari-op d38f22c
fixed redirect issue when deleting custom options
jjabari-op 06bff13
reworked custom field form due to renderig errors when using rails pa…
jjabari-op ed4d105
Merge remote-tracking branch 'origin/dev' into epic/49688-individuell…
ulferts 4cdd1fe
increase pp instance size
ulferts bc14022
Merge remote-tracking branch 'origin/dev' into epic/49688-individuell…
ulferts 66d6089
remove file with commented out code tripping up Zeitwerk
ulferts 5b79645
added feature flag and fixed minor bugs
jjabari-op e7922b7
introducing capybara specs for overview and project settings page
jjabari-op afa13fc
Merge branch 'dev' into epic/49688-individuelle-gruppen-für-projektat…
jjabari-op 55e6dea
updated Gemfile.lock
jjabari-op d7b8dc7
enabling project attributes feature for pullpreview env
jjabari-op 8a6068f
adding more specs for project custom fields on overview page
jjabari-op b1dcfb7
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 1044033
Merge branch 'epic/49688-individuelle-gruppen-für-projektattribute' i…
jjabari-op f20f5ba
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op cca82ec
added specs for project custom field edit dialog, refactored form inp…
jjabari-op d529ee8
hiding more parts of the new concept behind the feature flag
jjabari-op 8ac7c64
refactored form implementations
jjabari-op 82c2209
disable editing for project members without editing permission
jjabari-op 83dc6e5
started to add validation specs
jjabari-op 22309ce
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 49480c4
Merge remote-tracking branch 'origin/dev' into epic/49688-custom-set-…
oliverguenther 57a5403
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
oliverguenther 8f64885
Linting drag & drop controller
oliverguenther 5721538
WIP: refactoring of prototypical code as discussed
jjabari-op 9e23d43
fixed resetting of list fields
jjabari-op 8ec7010
WIP: generalize custom field inputs a bit more, support single custom…
jjabari-op 77008c5
fixed form input name nesting
jjabari-op 670dbfa
fixed dialog specs and boolean input
jjabari-op 3de8c22
support rich text input
jjabari-op 9e6a725
fixed dialog validation specs
jjabari-op c98ddc1
refactored custom value update to contract/service based approach
jjabari-op 0648e5d
add permission checks for overview page requests and added related specs
jjabari-op d568b5c
refactoring and name fixes
jjabari-op 56af7b6
added basic permission spec for project custom field mapping UI
jjabari-op dcde93a
refactored project custom field mapping controller
jjabari-op 8e37370
include the acts_as_customizable patch only if project attributes fea…
jjabari-op 87c7979
switched to primer's toggle component on mapping UI
jjabari-op 74a30e2
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op f3c474f
adjust toggle switch based on feedback
jjabari-op 8eb4c15
cleanup
jjabari-op 99dbfce
switch to op_primer header component
jjabari-op fdf08ef
WIP: enable required custom fields automatically in all projects and …
jjabari-op 4b3fb79
force all required project custom fields to be enabled in all projects
jjabari-op 26c9167
adjusted toggle switch position according to feedback
jjabari-op fca8781
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 0facd6f
disable custom fields with default values when user explicitly provid…
jjabari-op 2e54aa0
added project creation feature specs around project custom fields and…
jjabari-op 5101a41
added project creation and copy feature specs around project custom f…
jjabari-op 95242af
fixed default value display approach
jjabari-op 8475f22
added model specs for project custom field model hooks
jjabari-op c06fb41
preview long text values truncated and expand via dialog
jjabari-op 0a4ed90
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op e00030b
show users with avatar component in sidebar
jjabari-op 96a0c13
Set appendTo=body to fix position
oliverguenther 69bd7aa
quick fixing multi user submission
jjabari-op 8098807
added dialog update specs and split spec file for better oversight
jjabari-op d584f09
fixed icon only async dialog trigger button paddings
jjabari-op 8224044
adjusted switch positions as requested
jjabari-op 8685d3e
removed feature flag as discussed with @oliverguenther
jjabari-op 42f0cfe
fixed breadcrumb navigation
jjabari-op 9dfac6e
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 7f19330
fixed sidebar display condition
jjabari-op 0f39f02
switched to op header component
jjabari-op c095526
Merge remote-tracking branch 'origin/dev' into epic/49688-custom-set-…
oliverguenther 3f3ffb7
Fix selection of principal users
oliverguenther 35c7379
Base values on input so it's easier to pass custom options
oliverguenther c54f1a5
Allow loading multiple resources
oliverguenther 22def47
Fix multiple values being joined in a single input
oliverguenther 2ae7719
Fix edit label
oliverguenther b2bba8e
Remove user_autocompleter input in favor of just the one autocompleter
oliverguenther 644e25b
fixed decorated select fields visibility and user select field multi …
jjabari-op 00841be
fixed specs due to primer updates
jjabari-op 82cbacd
fixing multi turbo-frame tags after stream update discovered while de…
jjabari-op fc179ad
hide toggle switch loading indicator as requested by product team
jjabari-op 91b7cd3
adjusted descriptions as requested
jjabari-op 376159c
use op header component
jjabari-op 0789cbc
Fix detection of selected items
oliverguenther 4caefe8
Fix min-height of autocompleter
oliverguenther da2c3a9
added specs for project custom field administration, fixed minor bugs
jjabari-op 004accf
Merge remote-tracking branch 'origin/dev' into epic/49688-custom-set-…
oliverguenther 1a99043
adjusting project model customizable specs
jjabari-op efb30cd
added more project model customizable specs
jjabari-op 3902dfb
fixed naming
jjabari-op 0f578f8
fixed and enriched project csv export specs
jjabari-op 190e625
fixed existing project custom field settings page specs
jjabari-op e936250
support easy usage of update method with implicit custom field activa…
jjabari-op 96f112e
support implicit activation of custom fields when using custom_field_…
jjabari-op da8be06
fixed project index specs
jjabari-op 5071959
fixing custom field scope after validation
jjabari-op 1bfadbc
addings spec for after validation state of dialog
jjabari-op 5c5aae1
added missing validation specs
jjabari-op 34a4640
adding more validation specs and fixing selected values state after v…
jjabari-op 972fe3f
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 8610e76
fixing project API
jjabari-op 33e40b3
fixed not desired reactivation of custom fields which have been disab…
jjabari-op 10bab96
Make the project attributes rich text display "Expand" link inline.
dombesz 14f2bcd
Format code
dombesz 4c9ceb3
Fix validation messages not being displayed when a previous section w…
dombesz a1b612d
Respect allow_non_open_versions setting on the version input, do not …
dombesz 7e05278
Filter out projects with disabled custom fields on the projects index…
dombesz 18b2ed0
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 696735a
fixes XLS export specs
jjabari-op a67359f
fixed custom value specs
jjabari-op 83afa78
fixing unit tests, mark last failing one as pending
jjabari-op b9ea488
Rename "Custom field section" to "Section" on attribute form
dombesz 0ea5c3f
Replace the Project details widget with deprecation message
dombesz 5ed38ee
Refactoring on the project act_as_customizable_patch
dombesz 336d3ef
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 5753baf
fix empty project attributes issue seen in specs
jjabari-op 6d8fd7f
fixed and enriched project settings page specs
jjabari-op 809f9c2
fixed dialog specs
jjabari-op 8bc5c13
changed n/a text
jjabari-op 9775cc8
adde required label for global project attributes overview
jjabari-op d74232f
added parent link for mobile views
jjabari-op 9330fec
respect visible setting and enriched specs
jjabari-op 228e0db
revert temporary change
jjabari-op aeba290
fixed custom value specs
jjabari-op 782038b
fixed dialog specs
jjabari-op dfb3635
fixed eslint issues
jjabari-op 7071b5e
fixing admin menu specs
jjabari-op 3e22803
trying to resolve issues only seen in CI
jjabari-op a63fb13
remove project custom field specs from other custom field feature spe…
jjabari-op 887d65b
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 7a9daf1
fix CI issues due to render error in sidebar when no section was assi…
jjabari-op 0c3db8a
adjusted copy service to not activate project custom fields with defa…
jjabari-op c2480a1
added specs for invisible custom fields for project creation
jjabari-op a00a44a
fixed and finetuned project custom field activation for create, updat…
jjabari-op a91d0ef
adjusted custom value specs
jjabari-op 7a7c079
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op b870ab9
Added uniqueness validation as suggested by @dombesz
jjabari-op 30e8462
Cleanup as suggested by @dombesz
jjabari-op 0abd390
Minor cleanups
jjabari-op ee291e2
Rename service as suggested by @dombesz
jjabari-op e89446e
Refactored controller as suggested by @dombesz
jjabari-op 442eb03
Refactoring as suggested by @dombesz
jjabari-op 77094a5
Cleanup as suggested by @dombesz
jjabari-op 981bf76
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op ffa99e4
Fix trackBy function receiving item as first argument
oliverguenther 098654d
Update project details widget deprecation message.
dombesz 3b0c995
Respect closed version setting in multi select version fields
dombesz 7693bd2
Refactored prototypical implementation as suggested by @dombesz
jjabari-op b8a07a9
Refactored to a service based approach as suggested by @dombesz
jjabari-op a83dad0
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op e93e39e
fixing last CI errors, mostly related to adjusted behaviour of the an…
jjabari-op 74cae4c
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 89f2d09
Update modules/xls_export/spec/models/xls_export/project/exporter/xls…
jjabari-op 006ab51
Update spec/features/admin/project_custom_fields/create_spec.rb
jjabari-op 613c7c9
Update spec/features/admin/project_custom_fields/create_spec.rb
jjabari-op 944a3fe
Update spec/features/admin/project_custom_fields/edit_spec.rb
jjabari-op 9cf5af6
Update spec/features/admin/project_custom_fields/edit_spec.rb
jjabari-op 772f0e7
Update spec/services/project_custom_field_project_mappings/toggle_ser…
jjabari-op 71cd1d7
Fix invitation spec
oliverguenther 7911553
Rename project custom field project mappings contract validation meth…
dombesz 89ce735
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
dombesz b144442
Avoid N+1 queries on the ProjectCustomFieldSections
dombesz 5415efb
checking for correct handling of invisible fields in export specs as …
jjabari-op 37f2b9c
cleanup resolved comment
jjabari-op 552c1c4
cleanup
jjabari-op 3304f54
Fixed model relation definitions
jjabari-op 0932dc5
Fixed specs
jjabari-op 1a49d54
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op bfd695b
Fixed customizable spec
jjabari-op ad8d2d5
Update app/services/projects/copy_service.rb
jjabari-op 855e1b3
Update db/migrate/20240208100316_enable_required_project_custom_field…
jjabari-op fac00bb
validate presence of custom_field_section as suggested by @dombesz
jjabari-op 4913e4d
Spec adjustments as suggested by @dombesz
jjabari-op a48248b
Adjusted filter approach as suggested by @dombesz
jjabari-op 2ace828
Move ProjectCustomField section validation to the object instead of t…
dombesz 451df6b
quick fix failing spec due to changed error message
jjabari-op 66e48a9
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op 4d93ce9
Display error messages for missing custom field section on creating p…
dombesz abbaa50
Remove N+1 queries from CustomFieldSection rendering
dombesz c68d1a5
Remove N+1 queries from the ProjectCustomFields rendering inside the …
dombesz 15132d0
fixed spec due to changed validation approach
jjabari-op b4590b4
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op beed93d
Simplify the Project settings project custom fields page.
dombesz 4d96b77
Add visible scope
dombesz b5866a6
Simplify the project acts as customizable patch, load all the field d…
dombesz 9b3b5e1
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
dombesz d05351b
Do not pass down the project.project_custom_field_project_mappings to…
dombesz 3f72301
Fix typo
dombesz 2fb9791
Use translation to count projects on admin project custom field row
dombesz c82de78
Fix comment typo
dombesz 485b6e0
Use hidden by filter class on the batch actions too
dombesz 32dcd9f
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
dombesz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...nents/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<%= | ||
component_wrapper do | ||
flex_layout(align_items: :center, justify_content: :space_between, classes: 'op-project-custom-field', data: { | ||
qa_selector: "project-custom-field-#{@project_custom_field.id}" | ||
}) do |custom_field_container| | ||
custom_field_container.with_column(flex_layout: true) do |title_container| | ||
title_container.with_column(pt: 1, mr: 2) do | ||
render(Primer::Beta::Text.new) do | ||
@project_custom_field.name | ||
end | ||
end | ||
title_container.with_column(pt: 1, mr: 2, data: { qa_selector: "custom-field-type" } ) do | ||
render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do | ||
@project_custom_field.field_format.capitalize | ||
end | ||
end | ||
if @project_custom_field.required? | ||
title_container.with_column(pt: 1) do | ||
render(Primer::Beta::Label.new(scheme: :attention, size: :medium)) do | ||
t("label_required") | ||
end | ||
end | ||
end | ||
end | ||
# py: 1 quick fix: prevents the row from bouncing as the toggle switch currently changes height while toggling | ||
custom_field_container.with_column(py: 1, mr: 2) do | ||
# buggy currently: | ||
# small variant + status_label_position: :start leads to a small bounce while toggling | ||
# behavior can be seen on primer's viewbook as well -> https://view-components-storybook.eastus.cloudapp.azure.com/view-components/lookbook/inspect/primer/alpha/toggle_switch/small | ||
# quick fix: don't display loading indicator which is causing the bounce | ||
render(Primer::Alpha::ToggleSwitch.new( | ||
src: toggle_project_settings_project_custom_fields_path( | ||
project_custom_field_project_mapping: { | ||
project_id: @project.id, | ||
custom_field_id: @project_custom_field.id | ||
} | ||
), | ||
csrf_token: form_authenticity_token, | ||
data: { 'turbo-method': :put, 'turbo-stream': true, | ||
qa_selector: "toggle-project-custom-field-mapping-#{@project_custom_field.id}" }, | ||
checked: active_in_project?, | ||
enabled: !@project_custom_field.required?, # required fields cannot be disabled | ||
size: :small, | ||
status_label_position: :start, | ||
classes: "op-primer-adjustments__toggle-switch--hidden-loading-indicator", | ||
)) | ||
end | ||
end | ||
end | ||
%> |
59 changes: 59 additions & 0 deletions
59
app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2012-2023 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 Projects | ||
module Settings | ||
module ProjectCustomFieldSections | ||
class CustomFieldRowComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
include OpTurbo::Streamable | ||
|
||
def initialize(project:, project_custom_field:) | ||
super | ||
|
||
@project = project | ||
@project_custom_field = project_custom_field | ||
@project_custom_field_project_mappings = project.project_custom_field_project_mappings | ||
end | ||
|
||
private | ||
|
||
def wrapper_uniq_by | ||
@project_custom_field.id | ||
end | ||
|
||
def active_in_project? | ||
@project_custom_field_project_mappings.any? do |mapping| | ||
mapping.custom_field_id == @project_custom_field.id | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
app/components/projects/settings/project_custom_field_sections/index_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<%= | ||
component_wrapper(data: wrapper_data_attributes) do | ||
flex_layout do |flex| | ||
flex.with_row(mt: 3) do | ||
render(Primer::Alpha::TextField.new( | ||
name: "project-custom-fields-mapping-filter", | ||
label: t('projects.settings.project_custom_fields.filter.label'), | ||
visually_hide_label: true, | ||
placeholder: t('projects.settings.project_custom_fields.filter.label'), | ||
leading_visual: { | ||
icon: :search, | ||
size: :small | ||
}, | ||
show_clear_button: true, | ||
clear_button_id: "project-custom-fields-mapping-filter-clear-button", | ||
data: { | ||
action: "input->projects--settings--project-custom-fields-mapping-filter#filterLists", | ||
"projects--settings--project-custom-fields-mapping-filter-target": "filter" | ||
} | ||
)) | ||
end | ||
|
||
@project_custom_field_sections.each do |project_custom_field_section| | ||
flex.with_row do | ||
render(Projects::Settings::ProjectCustomFieldSections::ShowComponent.new( | ||
project: @project, | ||
project_custom_field_section: | ||
)) | ||
end | ||
end | ||
end | ||
end | ||
%> |
55 changes: 55 additions & 0 deletions
55
app/components/projects/settings/project_custom_field_sections/index_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) 2012-2023 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 Projects | ||
module Settings | ||
module ProjectCustomFieldSections | ||
class IndexComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
include OpTurbo::Streamable | ||
|
||
def initialize(project:, project_custom_field_sections:) | ||
super | ||
|
||
@project = project | ||
@project_custom_field_sections = project_custom_field_sections | ||
end | ||
|
||
private | ||
|
||
def wrapper_data_attributes | ||
{ | ||
controller: 'projects--settings--project-custom-fields-mapping-filter', | ||
'application-target': 'dynamic' | ||
} | ||
end | ||
end | ||
end | ||
end | ||
end |
3 changes: 3 additions & 0 deletions
3
app/components/projects/settings/project_custom_field_sections/index_component.sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.Box | ||
.hidden-by-filter | ||
display: none |
73 changes: 73 additions & 0 deletions
73
app/components/projects/settings/project_custom_field_sections/show_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<%= | ||
component_wrapper do | ||
render(Primer::Beta::BorderBox.new(mt: 3, classes: 'op-project-custom-field-section', data: { | ||
qa_selector: "project-custom-field-section-#{@project_custom_field_section.id}" | ||
})) do |component| | ||
component.with_header(font_weight: :bold, py: 2) do | ||
flex_layout(justify_content: :space_between, align_items: :center) do |section_header_container| | ||
section_header_container.with_column(py: 2) do |content_container| | ||
# adding py: 2 here to match the padding of the actions_container | ||
# otherwise the header height changes when the actions gets hidden when filtering | ||
render(Primer::Beta::Text.new(font_weight: :bold)) do | ||
@project_custom_field_section.name | ||
end | ||
end | ||
section_header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container| | ||
actions_container.with_column(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'bulkActionContainer' }) do | ||
render(Primer::Beta::Button.new( | ||
tag: :a, | ||
href: enable_all_of_section_project_settings_project_custom_fields_path( | ||
project_custom_field_project_mapping: { | ||
project_id: @project.id, | ||
custom_field_section_id: @project_custom_field_section.id | ||
} | ||
), | ||
scheme: :invisible, | ||
font_weight: :bold, | ||
color: :subtle, | ||
'aria-label': t('projects.settings.project_custom_fields.actions.label_enable_all'), | ||
data: { 'turbo-method': :put, 'turbo-stream': true, qa_selector: "enable-all-project-custom-field-mappings-#{@project_custom_field_section.id}" } | ||
)) do |button| | ||
button.with_leading_visual_icon(icon: 'check-circle', color: :subtle) | ||
t('projects.settings.project_custom_fields.actions.label_enable_all') | ||
end | ||
end | ||
actions_container.with_column(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'bulkActionContainer' }) do | ||
render(Primer::Beta::Button.new( | ||
tag: :a, | ||
href: disable_all_of_section_project_settings_project_custom_fields_path( | ||
project_custom_field_project_mapping: { | ||
project_id: @project.id, | ||
custom_field_section_id: @project_custom_field_section.id | ||
} | ||
), | ||
scheme: :invisible, | ||
font_weight: :bold, | ||
color: :subtle, | ||
'aria-label': t('projects.settings.project_custom_fields.actions.label_disable_all'), | ||
data: { 'turbo-method': :put, 'turbo-stream': true, qa_selector: "disable-all-project-custom-field-mappings-#{@project_custom_field_section.id}" } | ||
)) do |button| | ||
button.with_leading_visual_icon(icon: 'x-circle', color: :subtle) | ||
t('projects.settings.project_custom_fields.actions.label_disable_all') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
if @project_custom_fields.empty? | ||
component.with_row do | ||
render(Primer::Beta::Text.new(color: :subtle)) { t("settings.project_attributes.label_no_project_custom_fields") } | ||
end | ||
else | ||
@project_custom_fields.each do |project_custom_field| | ||
component.with_row(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'searchItem' }) do | ||
render(Projects::Settings::ProjectCustomFieldSections::CustomFieldRowComponent.new( | ||
project: @project, | ||
project_custom_field:, | ||
)) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
%> |
53 changes: 53 additions & 0 deletions
53
app/components/projects/settings/project_custom_field_sections/show_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2012-2023 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 Projects | ||
module Settings | ||
module ProjectCustomFieldSections | ||
class ShowComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
include OpTurbo::Streamable | ||
|
||
def initialize(project:, project_custom_field_section:) | ||
super | ||
|
||
@project = project | ||
@project_custom_field_section = project_custom_field_section | ||
@project_custom_fields = project_custom_field_section.custom_fields | ||
end | ||
|
||
private | ||
|
||
def wrapper_uniq_by | ||
@project_custom_field_section.id | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! @ulferts increased the size, but I don't know if it was just meant for this pullpreview instance...