Skip to content
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
Merged
Show file tree
Hide file tree
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 Oct 19, 2023
2a90598
WIP: first steps introducing project attributes on project overview p…
jjabari-op Oct 30, 2023
cc886f2
introduce project custom field sections and project mapping
jjabari-op Oct 31, 2023
7d83ab0
introducing project attributes management with generic drag and drop …
jjabari-op Nov 21, 2023
a7a3f98
introducing project custom field create and edit
jjabari-op Nov 23, 2023
029c655
refactored datamodeling, reuse custom field forms in new project attr…
jjabari-op Nov 24, 2023
7d56b2a
fixed active menu item
jjabari-op Nov 27, 2023
f7f3b2b
disable project custom field management through custom fields UI
jjabari-op Nov 27, 2023
2901b47
refactored project attributes sidebar and dialog following previous r…
jjabari-op Nov 27, 2023
396f9e2
introduce project custom field mapping UI
jjabari-op Nov 28, 2023
703c446
disable auto enabling of new project custom fields
jjabari-op Nov 28, 2023
358e77e
minor cleanup
jjabari-op Nov 28, 2023
a01a6b5
Merge branch 'dev' into epic/49688-individuelle-gruppen-für-projektat…
jjabari-op Nov 28, 2023
f3b0460
quick fix issue when no custom field is enabled for a project
jjabari-op Nov 28, 2023
15048a0
setup auto-scroller for project custom field admin page as suggested …
jjabari-op Nov 29, 2023
458cffa
added client side project custom field mapping filter via stimulus
jjabari-op Nov 29, 2023
566d71a
added missing format display to project custom field mapping
jjabari-op Nov 29, 2023
84dd14d
temporary fix of overview page width issue seen in firefox
jjabari-op Dec 4, 2023
e1c9266
fixed responsive behavior and non-sidebar support
jjabari-op Dec 4, 2023
8c65e24
enable reverting of elements if they are dropped outside of a valid t…
jjabari-op Dec 4, 2023
fe77f6b
refined empty section behavior as requested
jjabari-op Dec 4, 2023
5a4a756
edit project attribute via click on name in row
jjabari-op Dec 4, 2023
2184c2a
fixed translation for section edit action
jjabari-op Dec 4, 2023
3959ab3
Merge branch 'dev' into epic/49688-individuelle-gruppen-für-projektat…
jjabari-op Dec 4, 2023
9e859cb
add bulk actions to project custom field mapping UI
jjabari-op Dec 5, 2023
5d97caf
added project count on global project attributes settings page
jjabari-op Dec 6, 2023
ce8a66e
minor refactoring
jjabari-op Dec 6, 2023
2eb825e
switched to whole button instead of icon_button for toggling project …
jjabari-op Dec 6, 2023
ea80fa9
enable status code usage when responding with turbo streams
jjabari-op Dec 7, 2023
390d1be
refactored project attributes update via project overview page dialog…
jjabari-op Dec 7, 2023
6209f12
fixed single user select list input scope
jjabari-op Dec 8, 2023
134d3b5
WIP: fixing user and multi value inputs
jjabari-op Dec 8, 2023
d38f22c
fixed redirect issue when deleting custom options
jjabari-op Dec 18, 2023
06bff13
reworked custom field form due to renderig errors when using rails pa…
jjabari-op Dec 18, 2023
ed4d105
Merge remote-tracking branch 'origin/dev' into epic/49688-individuell…
ulferts Jan 4, 2024
4cdd1fe
increase pp instance size
ulferts Jan 4, 2024
bc14022
Merge remote-tracking branch 'origin/dev' into epic/49688-individuell…
ulferts Jan 4, 2024
66d6089
remove file with commented out code tripping up Zeitwerk
ulferts Jan 4, 2024
5b79645
added feature flag and fixed minor bugs
jjabari-op Jan 9, 2024
e7922b7
introducing capybara specs for overview and project settings page
jjabari-op Jan 9, 2024
afa13fc
Merge branch 'dev' into epic/49688-individuelle-gruppen-für-projektat…
jjabari-op Jan 9, 2024
55e6dea
updated Gemfile.lock
jjabari-op Jan 9, 2024
d7b8dc7
enabling project attributes feature for pullpreview env
jjabari-op Jan 9, 2024
8a6068f
adding more specs for project custom fields on overview page
jjabari-op Jan 10, 2024
b1dcfb7
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Jan 10, 2024
1044033
Merge branch 'epic/49688-individuelle-gruppen-für-projektattribute' i…
jjabari-op Jan 10, 2024
f20f5ba
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Jan 10, 2024
cca82ec
added specs for project custom field edit dialog, refactored form inp…
jjabari-op Jan 18, 2024
d529ee8
hiding more parts of the new concept behind the feature flag
jjabari-op Jan 18, 2024
8ac7c64
refactored form implementations
jjabari-op Jan 19, 2024
82c2209
disable editing for project members without editing permission
jjabari-op Jan 19, 2024
83dc6e5
started to add validation specs
jjabari-op Jan 19, 2024
22309ce
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Jan 19, 2024
49480c4
Merge remote-tracking branch 'origin/dev' into epic/49688-custom-set-…
oliverguenther Jan 24, 2024
57a5403
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
oliverguenther Jan 25, 2024
8f64885
Linting drag & drop controller
oliverguenther Jan 25, 2024
5721538
WIP: refactoring of prototypical code as discussed
jjabari-op Jan 30, 2024
9e23d43
fixed resetting of list fields
jjabari-op Jan 30, 2024
8ec7010
WIP: generalize custom field inputs a bit more, support single custom…
jjabari-op Feb 1, 2024
77008c5
fixed form input name nesting
jjabari-op Feb 1, 2024
670dbfa
fixed dialog specs and boolean input
jjabari-op Feb 1, 2024
3de8c22
support rich text input
jjabari-op Feb 1, 2024
9e6a725
fixed dialog validation specs
jjabari-op Feb 1, 2024
c98ddc1
refactored custom value update to contract/service based approach
jjabari-op Feb 5, 2024
0648e5d
add permission checks for overview page requests and added related specs
jjabari-op Feb 5, 2024
d568b5c
refactoring and name fixes
jjabari-op Feb 6, 2024
56af7b6
added basic permission spec for project custom field mapping UI
jjabari-op Feb 6, 2024
dcde93a
refactored project custom field mapping controller
jjabari-op Feb 6, 2024
8e37370
include the acts_as_customizable patch only if project attributes fea…
jjabari-op Feb 6, 2024
87c7979
switched to primer's toggle component on mapping UI
jjabari-op Feb 6, 2024
74a30e2
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Feb 6, 2024
f3c474f
adjust toggle switch based on feedback
jjabari-op Feb 7, 2024
8eb4c15
cleanup
jjabari-op Feb 7, 2024
99dbfce
switch to op_primer header component
jjabari-op Feb 7, 2024
fdf08ef
WIP: enable required custom fields automatically in all projects and …
jjabari-op Feb 7, 2024
4b3fb79
force all required project custom fields to be enabled in all projects
jjabari-op Feb 8, 2024
26c9167
adjusted toggle switch position according to feedback
jjabari-op Feb 8, 2024
fca8781
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Feb 8, 2024
0facd6f
disable custom fields with default values when user explicitly provid…
jjabari-op Feb 12, 2024
2e54aa0
added project creation feature specs around project custom fields and…
jjabari-op Feb 12, 2024
5101a41
added project creation and copy feature specs around project custom f…
jjabari-op Feb 13, 2024
95242af
fixed default value display approach
jjabari-op Feb 13, 2024
8475f22
added model specs for project custom field model hooks
jjabari-op Feb 14, 2024
c06fb41
preview long text values truncated and expand via dialog
jjabari-op Feb 15, 2024
0a4ed90
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Feb 15, 2024
e00030b
show users with avatar component in sidebar
jjabari-op Feb 15, 2024
96a0c13
Set appendTo=body to fix position
oliverguenther Feb 15, 2024
69bd7aa
quick fixing multi user submission
jjabari-op Feb 16, 2024
8098807
added dialog update specs and split spec file for better oversight
jjabari-op Feb 16, 2024
d584f09
fixed icon only async dialog trigger button paddings
jjabari-op Feb 19, 2024
8224044
adjusted switch positions as requested
jjabari-op Feb 19, 2024
8685d3e
removed feature flag as discussed with @oliverguenther
jjabari-op Feb 19, 2024
42f0cfe
fixed breadcrumb navigation
jjabari-op Feb 19, 2024
9dfac6e
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Feb 19, 2024
7f19330
fixed sidebar display condition
jjabari-op Feb 19, 2024
0f39f02
switched to op header component
jjabari-op Feb 19, 2024
c095526
Merge remote-tracking branch 'origin/dev' into epic/49688-custom-set-…
oliverguenther Feb 20, 2024
3f3ffb7
Fix selection of principal users
oliverguenther Feb 17, 2024
35c7379
Base values on input so it's easier to pass custom options
oliverguenther Feb 20, 2024
c54f1a5
Allow loading multiple resources
oliverguenther Feb 20, 2024
22def47
Fix multiple values being joined in a single input
oliverguenther Feb 20, 2024
2ae7719
Fix edit label
oliverguenther Feb 20, 2024
b2bba8e
Remove user_autocompleter input in favor of just the one autocompleter
oliverguenther Feb 20, 2024
644e25b
fixed decorated select fields visibility and user select field multi …
jjabari-op Feb 21, 2024
00841be
fixed specs due to primer updates
jjabari-op Feb 21, 2024
82cbacd
fixing multi turbo-frame tags after stream update discovered while de…
jjabari-op Feb 21, 2024
fc179ad
hide toggle switch loading indicator as requested by product team
jjabari-op Feb 21, 2024
91b7cd3
adjusted descriptions as requested
jjabari-op Feb 21, 2024
376159c
use op header component
jjabari-op Feb 21, 2024
0789cbc
Fix detection of selected items
oliverguenther Feb 21, 2024
4caefe8
Fix min-height of autocompleter
oliverguenther Feb 21, 2024
da2c3a9
added specs for project custom field administration, fixed minor bugs
jjabari-op Feb 22, 2024
004accf
Merge remote-tracking branch 'origin/dev' into epic/49688-custom-set-…
oliverguenther Feb 22, 2024
1a99043
adjusting project model customizable specs
jjabari-op Feb 23, 2024
efb30cd
added more project model customizable specs
jjabari-op Feb 26, 2024
3902dfb
fixed naming
jjabari-op Feb 26, 2024
0f578f8
fixed and enriched project csv export specs
jjabari-op Feb 26, 2024
190e625
fixed existing project custom field settings page specs
jjabari-op Feb 26, 2024
e936250
support easy usage of update method with implicit custom field activa…
jjabari-op Feb 26, 2024
96f112e
support implicit activation of custom fields when using custom_field_…
jjabari-op Feb 26, 2024
da8be06
fixed project index specs
jjabari-op Feb 26, 2024
5071959
fixing custom field scope after validation
jjabari-op Feb 27, 2024
1bfadbc
addings spec for after validation state of dialog
jjabari-op Feb 27, 2024
5c5aae1
added missing validation specs
jjabari-op Feb 27, 2024
34a4640
adding more validation specs and fixing selected values state after v…
jjabari-op Feb 27, 2024
972fe3f
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Feb 27, 2024
8610e76
fixing project API
jjabari-op Feb 28, 2024
33e40b3
fixed not desired reactivation of custom fields which have been disab…
jjabari-op Feb 28, 2024
10bab96
Make the project attributes rich text display "Expand" link inline.
dombesz Feb 28, 2024
14f2bcd
Format code
dombesz Feb 29, 2024
4c9ceb3
Fix validation messages not being displayed when a previous section w…
dombesz Feb 29, 2024
a1b612d
Respect allow_non_open_versions setting on the version input, do not …
dombesz Feb 29, 2024
7e05278
Filter out projects with disabled custom fields on the projects index…
dombesz Mar 1, 2024
18b2ed0
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 4, 2024
696735a
fixes XLS export specs
jjabari-op Mar 4, 2024
a67359f
fixed custom value specs
jjabari-op Mar 4, 2024
83afa78
fixing unit tests, mark last failing one as pending
jjabari-op Mar 4, 2024
b9ea488
Rename "Custom field section" to "Section" on attribute form
dombesz Mar 4, 2024
0ea5c3f
Replace the Project details widget with deprecation message
dombesz Mar 4, 2024
5ed38ee
Refactoring on the project act_as_customizable_patch
dombesz Mar 5, 2024
336d3ef
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 7, 2024
5753baf
fix empty project attributes issue seen in specs
jjabari-op Mar 5, 2024
6d8fd7f
fixed and enriched project settings page specs
jjabari-op Mar 5, 2024
809f9c2
fixed dialog specs
jjabari-op Mar 5, 2024
8bc5c13
changed n/a text
jjabari-op Mar 6, 2024
9775cc8
adde required label for global project attributes overview
jjabari-op Mar 6, 2024
d74232f
added parent link for mobile views
jjabari-op Mar 6, 2024
9330fec
respect visible setting and enriched specs
jjabari-op Mar 7, 2024
228e0db
revert temporary change
jjabari-op Mar 7, 2024
aeba290
fixed custom value specs
jjabari-op Mar 7, 2024
782038b
fixed dialog specs
jjabari-op Mar 7, 2024
dfb3635
fixed eslint issues
jjabari-op Mar 7, 2024
7071b5e
fixing admin menu specs
jjabari-op Mar 7, 2024
3e22803
trying to resolve issues only seen in CI
jjabari-op Mar 7, 2024
a63fb13
remove project custom field specs from other custom field feature spe…
jjabari-op Mar 7, 2024
887d65b
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 7, 2024
7a9daf1
fix CI issues due to render error in sidebar when no section was assi…
jjabari-op Mar 7, 2024
0c3db8a
adjusted copy service to not activate project custom fields with defa…
jjabari-op Mar 7, 2024
c2480a1
added specs for invisible custom fields for project creation
jjabari-op Mar 7, 2024
a00a44a
fixed and finetuned project custom field activation for create, updat…
jjabari-op Mar 8, 2024
a91d0ef
adjusted custom value specs
jjabari-op Mar 8, 2024
7a7c079
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 12, 2024
b870ab9
Added uniqueness validation as suggested by @dombesz
jjabari-op Mar 12, 2024
30e8462
Cleanup as suggested by @dombesz
jjabari-op Mar 12, 2024
0abd390
Minor cleanups
jjabari-op Mar 12, 2024
ee291e2
Rename service as suggested by @dombesz
jjabari-op Mar 12, 2024
e89446e
Refactored controller as suggested by @dombesz
jjabari-op Mar 12, 2024
442eb03
Refactoring as suggested by @dombesz
jjabari-op Mar 12, 2024
77094a5
Cleanup as suggested by @dombesz
jjabari-op Mar 12, 2024
981bf76
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 12, 2024
ffa99e4
Fix trackBy function receiving item as first argument
oliverguenther Mar 12, 2024
098654d
Update project details widget deprecation message.
dombesz Mar 6, 2024
3b0c995
Respect closed version setting in multi select version fields
dombesz Mar 12, 2024
7693bd2
Refactored prototypical implementation as suggested by @dombesz
jjabari-op Mar 13, 2024
b8a07a9
Refactored to a service based approach as suggested by @dombesz
jjabari-op Mar 13, 2024
a83dad0
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 13, 2024
e93e39e
fixing last CI errors, mostly related to adjusted behaviour of the an…
jjabari-op Mar 14, 2024
74cae4c
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 14, 2024
89f2d09
Update modules/xls_export/spec/models/xls_export/project/exporter/xls…
jjabari-op Mar 19, 2024
006ab51
Update spec/features/admin/project_custom_fields/create_spec.rb
jjabari-op Mar 19, 2024
613c7c9
Update spec/features/admin/project_custom_fields/create_spec.rb
jjabari-op Mar 19, 2024
944a3fe
Update spec/features/admin/project_custom_fields/edit_spec.rb
jjabari-op Mar 19, 2024
9cf5af6
Update spec/features/admin/project_custom_fields/edit_spec.rb
jjabari-op Mar 19, 2024
772f0e7
Update spec/services/project_custom_field_project_mappings/toggle_ser…
jjabari-op Mar 19, 2024
71cd1d7
Fix invitation spec
oliverguenther Mar 19, 2024
7911553
Rename project custom field project mappings contract validation meth…
dombesz Mar 19, 2024
89ce735
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
dombesz Mar 19, 2024
b144442
Avoid N+1 queries on the ProjectCustomFieldSections
dombesz Mar 19, 2024
5415efb
checking for correct handling of invisible fields in export specs as …
jjabari-op Mar 19, 2024
37f2b9c
cleanup resolved comment
jjabari-op Mar 19, 2024
552c1c4
cleanup
jjabari-op Mar 20, 2024
3304f54
Fixed model relation definitions
jjabari-op Mar 20, 2024
0932dc5
Fixed specs
jjabari-op Mar 20, 2024
1a49d54
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 20, 2024
bfd695b
Fixed customizable spec
jjabari-op Mar 20, 2024
ad8d2d5
Update app/services/projects/copy_service.rb
jjabari-op Mar 20, 2024
855e1b3
Update db/migrate/20240208100316_enable_required_project_custom_field…
jjabari-op Mar 20, 2024
fac00bb
validate presence of custom_field_section as suggested by @dombesz
jjabari-op Mar 20, 2024
4913e4d
Spec adjustments as suggested by @dombesz
jjabari-op Mar 20, 2024
a48248b
Adjusted filter approach as suggested by @dombesz
jjabari-op Mar 20, 2024
2ace828
Move ProjectCustomField section validation to the object instead of t…
dombesz Mar 20, 2024
451df6b
quick fix failing spec due to changed error message
jjabari-op Mar 20, 2024
66e48a9
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 20, 2024
4d93ce9
Display error messages for missing custom field section on creating p…
dombesz Mar 20, 2024
abbaa50
Remove N+1 queries from CustomFieldSection rendering
dombesz Mar 20, 2024
c68d1a5
Remove N+1 queries from the ProjectCustomFields rendering inside the …
dombesz Mar 20, 2024
15132d0
fixed spec due to changed validation approach
jjabari-op Mar 21, 2024
b4590b4
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
jjabari-op Mar 21, 2024
beed93d
Simplify the Project settings project custom fields page.
dombesz Mar 22, 2024
4d96b77
Add visible scope
dombesz Mar 22, 2024
b5866a6
Simplify the project acts as customizable patch, load all the field d…
dombesz Mar 22, 2024
9b3b5e1
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
dombesz Mar 22, 2024
d05351b
Do not pass down the project.project_custom_field_project_mappings to…
dombesz Mar 22, 2024
3f72301
Fix typo
dombesz Mar 22, 2024
2fb9791
Use translation to count projects on admin project custom field row
dombesz Mar 24, 2024
c82de78
Fix comment typo
dombesz Mar 25, 2024
485b6e0
Use hidden by filter class on the batch actions too
dombesz Mar 25, 2024
32dcd9f
Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-g…
dombesz Mar 25, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/pullpreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
admins: crohr,HDinger,machisuji,oliverguenther,ulferts,wielinde,cbliard
compose_files: docker-compose.pullpreview.yml
instance_type: large
instance_type: xlarge
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still required?

Copy link
Collaborator Author

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...

ports: 80,443,8080
default_port: 443
ttl: 10d
Expand Down
1 change: 1 addition & 0 deletions app/components/_index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
@import "work_packages/share/invite_user_form_component"
@import "open_project/common/attribute_component"
@import "filters_component"
@import "projects/settings/project_custom_field_sections/index_component"
10 changes: 5 additions & 5 deletions app/components/open_project/common/attribute_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
require 'nokogiri'
require "nokogiri"

module OpenProject
module Common
Expand All @@ -34,7 +34,7 @@ class AttributeComponent < Primer::Component
:name,
:description

PARAGRAPH_CSS_CLASS = 'op-uc-p'.freeze
PARAGRAPH_CSS_CLASS = "op-uc-p".freeze

def initialize(id, name, description, **args)
super
Expand Down Expand Up @@ -73,7 +73,7 @@ def first_paragraph
.inner_html
.html_safe # rubocop:disable Rails/OutputSafety
else
''
""
end
end

Expand All @@ -83,12 +83,12 @@ def text_ast

def body_children
text_ast
.xpath('html/body')
.xpath("html/body")
.children
end

def multi_type?
first_paragraph.include?('figure') || first_paragraph.include?('macro')
first_paragraph.include?("figure") || first_paragraph.include?("macro")
end
end
end
Expand Down
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
%>
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
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
%>
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Box
.hidden-by-filter
display: none
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
%>
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
Loading
Loading