mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
add has_comment to field formats using primer form
This commit is contained in:
@@ -136,6 +136,14 @@ module CustomFields
|
||||
)
|
||||
end
|
||||
|
||||
if show_has_comment_field?
|
||||
details_form.check_box(
|
||||
name: :has_comment,
|
||||
label: label(:has_comment),
|
||||
caption: instructions(:has_comment)
|
||||
)
|
||||
end
|
||||
|
||||
if show_is_required_field?
|
||||
details_form.check_box(
|
||||
name: :is_required,
|
||||
@@ -224,6 +232,10 @@ module CustomFields
|
||||
%w[text].include?(model.field_format)
|
||||
end
|
||||
|
||||
def show_has_comment_field?
|
||||
model.can_have_comment?
|
||||
end
|
||||
|
||||
def show_is_required_field?
|
||||
%w[calculated_value bool].exclude?(model.field_format)
|
||||
end
|
||||
|
||||
@@ -150,6 +150,7 @@ RSpec.shared_examples_for "expected fields for the custom field's format", :aggr
|
||||
# Form element labels, default English translation in the trailing comment:
|
||||
let(:label_name) { I18n.t("attributes.name") } # Name
|
||||
let(:label_section) { I18n.t("activerecord.attributes.project_custom_field.custom_field_section") } # Section
|
||||
let(:label_has_comment) { I18n.t("activerecord.attributes.custom_field.has_comment") } # Add a comment text field
|
||||
let(:label_is_for_all) { I18n.t("attributes.is_for_all") } # For all projects
|
||||
let(:label_admin_only) { I18n.t("activerecord.attributes.custom_field.admin_only") } # Admin-only
|
||||
let(:label_searchable) { I18n.t("activerecord.attributes.custom_field.searchable") } # Searchable
|
||||
@@ -185,6 +186,12 @@ RSpec.shared_examples_for "expected fields for the custom field's format", :aggr
|
||||
expect(page).to have_no_label(label_section)
|
||||
end
|
||||
|
||||
if type == "Project"
|
||||
expect(page).to have_field(label_has_comment)
|
||||
else
|
||||
expect(page).to have_no_label(label_has_comment)
|
||||
end
|
||||
|
||||
if type == "Work package"
|
||||
expect(page).to have_field(label_is_filter)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user