[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-45-g8ad9f90

BPS Git Server git at git.bestpractical.com
Tue Oct 10 15:15:38 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-formtools".

The branch, dynamic-forms-from-config has been updated
       via  8ad9f90ad8f85788454ee09d645f8139a1ca08b6 (commit)
      from  523f857c07041523f4ce09c9efd64bc81f34e20f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8ad9f90ad8f85788454ee09d645f8139a1ca08b6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Oct 10 11:10:31 2023 -0400

    Switch to LabeledValue for end user pages

diff --git a/html/FormTools/Field b/html/FormTools/Field
index 5ffd333..2699834 100644
--- a/html/FormTools/Field
+++ b/html/FormTools/Field
@@ -124,11 +124,36 @@ $default = '' unless defined $default;
 % } else {
 
 % if ($render_as ne 'hidden' && $show_label) { # no label if hidden
-<div class="form-row">
-  <div class="label col-3"><%$field_label%><% $after_label |n %></div>
-  <div class="value col-9">
+
+<&| /Elements/LabeledValue, RawLabel => $m->interp->apply_escapes($field_label, 'h') . $after_label &>
+  <& SELF:Value, %ARGS, input_name => $input_name, field_type => $field_type, default => $default, values => \@values, cf => $cf &>
+  <% $after_input |n %>
+</&>
+
+% } else {
+  <& SELF:Value, %ARGS, input_name => $input_name, field_type => $field_type, default => $default, values => \@values, cf => $cf &>
+% }
+
 % }
 
+<%METHOD Value>
+<%ARGS>
+$name
+$render_as          => 'normal'
+$default            => undef
+$cols               => undef
+$rows               => undef
+$empty_allowed      => 1
+$show_validation    => 0
+$disables           => {}
+$after_input        => ''
+$cf                 => undef
+$queue              => undef
+$field_type         => undef
+$input_name         => undef
+ at values             => ()
+</%ARGS>
+
 % if ($field_type eq 'core') {
 
 % if ($name eq 'Attach') {
@@ -256,7 +281,4 @@ $default = '' unless defined $default;
 %}
 
 % }
-% if ($render_as ne 'hidden' && $show_label) {
-<% $after_input |n %></div></div>
-% }
-% }
+</%METHOD>
diff --git a/html/FormTools/ShowChoices b/html/FormTools/ShowChoices
index 176f306..8e07d15 100644
--- a/html/FormTools/ShowChoices
+++ b/html/FormTools/ShowChoices
@@ -9,22 +9,8 @@ my %all_fields = $m->request_args;
 % if ($field =~ /CustomField-(\d+)/) {
 % my $id = $1;
 %$cf->Load($id);
-<div class="form-row">
-  <div class="col-3 label"><%$cf->Name%></div>
-  <div class="col-9 value">
-    <span class="current-value">
-      <% ref ($all_fields{$field}) ? join(', ',@{$all_fields{$field}}) : $all_fields{$field}%>
-    </span>
-  </div>
-</div>
+<& /Elements/LabeledValue, Label => $cf->Name, ValueSpanClass => 'current-value', Value => ref ($all_fields{$field}) ? join(', ',@{$all_fields{$field}}) : $all_fields{$field} &>
 % } elsif (RT::Extension::FormTools::is_core_field($field)) {
-<div class="form-row">
-  <div class="col-3 label"><%$field%></div>
-  <div class="col-9 value">
-    <span class="current-value">
-      <% $all_fields{$field} %>
-    </span>
-  </div>
-</div>
+<& /Elements/LabeledValue, Label => loc("Content"), ValueSpanClass => 'current-value', Value => $all_fields{$field} &>
 %}
 % }

-----------------------------------------------------------------------

Summary of changes:
 html/FormTools/Field       | 36 +++++++++++++++++++++++++++++-------
 html/FormTools/ShowChoices | 18 ++----------------
 2 files changed, 31 insertions(+), 23 deletions(-)


hooks/post-receive
-- 
rt-extension-formtools


More information about the Bps-public-commit mailing list