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

Primerize the t&c settings page

Klaus Zanders3a857d8dee54
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 93d9e523de5..4b0fce56677 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2436,6 +2436,7 @@ en:
label_missing_or_hidden_custom_option: "(missing value or lacking permissions to access)"
label_descending: "Descending"
label_details: "Details"
+ label_defaults: "Defaults"
label_development_roadmap: "Development roadmap"
label_diff: "diff"
label_diff_inline: "inline"
diff --git a/modules/costs/app/components/admin/time_entry_activities/index_component.html.erb b/modules/costs/app/components/admin/time_entry_activities/index_component.html.erb
index a3692dd95a9..961d515081e 100644
--- a/modules/costs/app/components/admin/time_entry_activities/index_component.html.erb
+++ b/modules/costs/app/components/admin/time_entry_activities/index_component.html.erb
@@ -6,7 +6,8 @@ component_wrapper do
subheader.with_action_button(
scheme: :primary,
tag: :a,
- href: new_admin_time_entry_activity_path
+ href: new_admin_time_entry_activity_path,
+ test_selector: "add-activity-button"
) do |button|
button.with_leading_visual_icon(icon: :plus)
I18n.t(:button_add_activity)
diff --git a/modules/costs/app/views/admin/costs_settings/show.html.erb b/modules/costs/app/views/admin/costs_settings/show.html.erb
index 2194d9791d8..e6eb5fa7062 100644
--- a/modules/costs/app/views/admin/costs_settings/show.html.erb
+++ b/modules/costs/app/views/admin/costs_settings/show.html.erb
@@ -31,42 +31,57 @@ See COPYRIGHT and LICENSE files for more details.
<%=
render(Primer::OpenProject::PageHeader.new) do |header|
- header.with_title { t(:label_setting_plural) }
+ header.with_title { t(:label_defaults) }
header.with_breadcrumbs(
[
{ href: admin_index_path, text: t("label_administration") },
{ href: admin_costs_settings_path, text: t(:project_module_costs) },
- t(:label_setting_plural)
+ t(:label_defaults)
]
)
end
%>
-<%= styled_form_tag(
- admin_costs_settings_path,
- method: :patch,
- class: "op-costs-admin-settings"
- ) do %>
-
- <section class="form--section">
- <div class="form--field">
- <%= setting_text_field :costs_currency, type: :string, container_class: "-middle" %>
- </div>
-
- <div class="form--field">
- <%= setting_text_field :costs_currency_format, type: :string, container_class: "-middle" %>
- </div>
+<%=
+render(Primer::Alpha::TabPanels.new(label: I18n.t(:project_module_costs))) do |component|
+ component.with_tab(selected: true, id: "tab-time") do |tab|
+ tab.with_text { I18n.t(:label_time) }
+ tab.with_panel do
+ primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|
+ render_inline_settings_form(time_form) do |form|
+ form.html_content do
+ render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|
+ subhead.with_heading(size: :medium) { I18n.t(:label_mandatory_fields) }
+ subhead.with_description { I18n.t(:description_time_settings) }
+ end
+ end
+ form.check_box(name: :allow_tracking_start_and_end_times)
+ form.check_box(name: :enforce_tracking_start_and_end_times)
- <%- if OpenProject::FeatureDecisions.track_start_and_end_times_for_time_entries_active? %>
- <div class="form--field">
- <%= setting_check_box :allow_tracking_start_and_end_times, container_class: "-middle" %>
- </div>
+ form.submit
+ end
+ end
+ end
+ end
- <div class="form--field">
- <%= setting_check_box :enforce_tracking_start_and_end_times, container_class: "-middle" %>
- </div>
- <%- end %>
- </section>
+ component.with_tab(id: "tab-costs") do |tab|
+ tab.with_text { I18n.t(:label_cost) }
+ tab.with_panel do
+ primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|
+ render_inline_settings_form(time_form) do |form|
+ form.html_content do
+ render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|
+ subhead.with_heading(size: :medium) { I18n.t(:label_costs) }
+ subhead.with_description { I18n.t(:description_costs_settings) }
+ end
+ end
+ form.text_field(name: :costs_currency, input_width: :large)
+ form.text_field(name: :costs_currency_format, input_width: :large)
- <%= styled_button_tag t(:button_save), class: "-primary -with-icon icon-checkmark" %>
-<% end %>
+ form.submit
+ end
+ end
+ end
+ end
+end
+%>
diff --git a/modules/costs/config/locales/en.yml b/modules/costs/config/locales/en.yml
index d9095d7181a..52b1453564e 100644
--- a/modules/costs/config/locales/en.yml
+++ b/modules/costs/config/locales/en.yml
@@ -110,6 +110,8 @@ en:
caption_activity_order_changed: "Order successfully changed."
description_date_for_new_rate: "Date for new rate"
+ description_costs_settings: "Define the desired format for the costs in all projects."
+ description_time_settings: "Define which fields are mandatory to fill when logging time in all projects."
error_activity_could_not_be_moved: "Activity could not be moved."
@@ -154,6 +156,10 @@ en:
label_until: "until"
label_valid_from: "Valid from"
label_yes: "Yes"
+ label_time: "Time"
+ label_cost: "Cost"
+ label_costs: "Costs"
+ label_mandatory_fields: "Mandatory fields"
placeholder_activity_select_work_package_first: Work package selection is required first
diff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rb
index eea7274ea30..137897fbf51 100644
--- a/modules/costs/lib/costs/engine.rb
+++ b/modules/costs/lib/costs/engine.rb
@@ -128,7 +128,7 @@ module Costs
:costs_settings,
{ controller: "/admin/costs_settings", action: :show },
if: Proc.new { User.current.admin? },
- caption: :label_setting_plural,
+ caption: :label_defaults,
parent: :admin_costs
menu :admin_menu,