Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

switched to whole button instead of icon_button for toggling project custom field mappings

Jonas Jabari2eb825e5cb4a
diff --git a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb
index aae232542a0..b2f20592c10 100644
--- a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb
+++ b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb
@@ -1,31 +1,8 @@
<%=
component_wrapper do
flex_layout(align_items: :center) do |custom_field_container|
- custom_field_container.with_column(mr: 2) do
- if active_in_project?
- render(Primer::Beta::IconButton.new(
- tag: :a,
- href: toggle_project_settings_project_custom_fields_path(project_id: @project.id, project_custom_field_id: @project_custom_field.id),
- scheme: :invisible,
- icon: 'check-circle',
- 'aria-label': t('projects.settings.project_custom_fields.actions.label_disable_single'),
- data: { 'turbo-method': :put, 'turbo-stream': true }
- ))
- else
- render(Primer::Beta::IconButton.new(
- tag: :a,
- href: toggle_project_settings_project_custom_fields_path(project_id: @project.id, project_custom_field_id: @project_custom_field.id),
- scheme: :invisible,
- icon: 'circle',
- 'aria-label': t('projects.settings.project_custom_fields.actions.label_enable_single'),
- data: { 'turbo-method': :put, 'turbo-stream': true }
- ))
- end
- end
- custom_field_container.with_column(mr: 2) do
- render(Primer::Beta::Text.new(font_weight: :bold)) do
- @project_custom_field.name
- end
+ custom_field_container.with_column(mr: 1) do
+ toggle_button
end
custom_field_container.with_column do
render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do
diff --git a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb
index 4186ad637aa..8161c9f254e 100644
--- a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb
+++ b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb
@@ -53,6 +53,19 @@ module Projects
mapping.custom_field_id == @project_custom_field.id
end
end
+
+ def toggle_button
+ render(Primer::Beta::Button.new(
+ tag: :a,
+ href: toggle_project_settings_project_custom_fields_path(project_id: @project.id,
+ project_custom_field_id: @project_custom_field.id),
+ scheme: :invisible,
+ data: { 'turbo-method': :put, 'turbo-stream': true }
+ )) do |button|
+ button.with_leading_visual_icon(icon: (active_in_project? ? 'check-circle' : 'circle'))
+ @project_custom_field.name
+ end
+ end
end
end
end