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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add options Hash to schema && add display class for right-to-left text
Henriette Dingerd4e5aa9c2dc9
diff --git a/app/assets/stylesheets/openproject/_generic.sass b/app/assets/stylesheets/openproject/_generic.sassindex 5582932d305..936c637e01c 100644--- a/app/assets/stylesheets/openproject/_generic.sass+++ b/app/assets/stylesheets/openproject/_generic.sass@@ -86,6 +86,8 @@font-style: italic.-small-fontfont-size: 12px+.-rtl+ direction: rtl.drop-zone.-dragged-overbackground-color: #eaeaea60diff --git a/frontend/src/app/components/wp-edit-form/display-field-renderer.ts b/frontend/src/app/components/wp-edit-form/display-field-renderer.tsindex 36e67bbd51d..22b36655840 100644--- a/frontend/src/app/components/wp-edit-form/display-field-renderer.ts+++ b/frontend/src/app/components/wp-edit-form/display-field-renderer.ts@@ -61,7 +61,7 @@ export class DisplayFieldRenderer<T extends HalResource = HalResource> {}const field = this.getField(resource, fieldSchema, schemaName, change);- field.render(span, this.getText(field, fieldSchema, placeholder));+ field.render(span, this.getText(field, fieldSchema, placeholder), fieldSchema.options);const title = field.title;if (title) {diff --git a/frontend/src/app/modules/fields/display/display-field.module.ts b/frontend/src/app/modules/fields/display/display-field.module.tsindex b88458706cc..89f0ccee538 100644--- a/frontend/src/app/modules/fields/display/display-field.module.ts+++ b/frontend/src/app/modules/fields/display/display-field.module.ts@@ -118,7 +118,7 @@ export class DisplayField<T extends HalResource = HalResource> extends Field {return this.valueString;}- public render(element:HTMLElement, displayText:string):void {+ public render(element:HTMLElement, displayText:string, options:any = {}):void {element.textContent = displayText;}diff --git a/frontend/src/app/modules/fields/display/field-types/formattable-display-field.module.ts b/frontend/src/app/modules/fields/display/field-types/formattable-display-field.module.tsindex 6eb1a2d9bb3..e602231ab1c 100644--- a/frontend/src/app/modules/fields/display/field-types/formattable-display-field.module.ts+++ b/frontend/src/app/modules/fields/display/field-types/formattable-display-field.module.ts@@ -35,9 +35,10 @@ export class FormattableDisplayField extends DisplayField {private readonly appRef = this.$injector.get(ApplicationRef);- public render(element:HTMLElement, displayText:string):void {+ public render(element:HTMLElement, displayText:string, options:any = {}):void {let div = document.createElement('div');div.classList.add('read-value--html', 'wiki', 'highlight', '-multiline');+ if (options.rtl) { div.classList.add('-rtl'); }div.innerHTML = displayText;element.innerHTML = '';diff --git a/lib/api/decorators/property_schema_representer.rb b/lib/api/decorators/property_schema_representer.rbindex 388f2235e40..6249d6011d6 100644--- a/lib/api/decorators/property_schema_representer.rb+++ b/lib/api/decorators/property_schema_representer.rb@@ -61,7 +61,8 @@ module API:attribute_group,:min_length,:max_length,- :regular_expression+ :regular_expression,+ :optionsproperty :type, exec_context: :decoratorproperty :name, exec_context: :decorator@@ -73,6 +74,7 @@ module APIproperty :min_length, exec_context: :decoratorproperty :max_length, exec_context: :decoratorproperty :regular_expression, exec_context: :decorator+ property :options, exec_context: :decoratorprivatediff --git a/lib/api/decorators/schema_representer.rb b/lib/api/decorators/schema_representer.rbindex 1b95e1a4aea..55712312054 100644--- a/lib/api/decorators/schema_representer.rb+++ b/lib/api/decorators/schema_representer.rb@@ -63,6 +63,7 @@ module APImin_length: nil,max_length: nil,regular_expression: nil,+ options: {},show_if: true)getter = ->(*) doschema_property_getter(type,@@ -74,7 +75,8 @@ module APIattribute_group,min_length,max_length,- regular_expression)+ regular_expression,+ options)endschema_property(property,@@ -286,7 +288,8 @@ module APIattribute_group,min_length,max_length,- regular_expression)+ regular_expression,+ options)name = call_or_translate(name_source)schema = ::API::Decorators::PropertySchemaRepresenter.new(type: call_or_use(type),@@ -299,6 +302,7 @@ module APIschema.min_length = min_lengthschema.max_length = max_lengthschema.regular_expression = regular_expression+ schema.options = optionsschemaenddiff --git a/lib/api/v3/utilities/custom_field_injector.rb b/lib/api/v3/utilities/custom_field_injector.rbindex 1ce81b4f352..374d655b51e 100644--- a/lib/api/v3/utilities/custom_field_injector.rb+++ b/lib/api/v3/utilities/custom_field_injector.rb@@ -188,7 +188,8 @@ module APIwritable: writable,min_length: cf_min_length(custom_field),max_length: cf_max_length(custom_field),- regular_expression: cf_regexp(custom_field)+ regular_expression: cf_regexp(custom_field),+ options: cf_options(custom_field)enddef path_method_for(custom_field)@@ -321,6 +322,12 @@ module APIcustom_field.regexp unless custom_field.regexp.blank?end+ def cf_options(custom_field)+ {+ rtl: ("true" if custom_field.content_right_to_left)+ }+ end+def list_schemas_values_callback(custom_field)->(*) { represented.assignable_custom_field_values(custom_field) }end