From 737b84f22494e1ec3952cb6d3d6c1e19e4980bd9 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Thu, 5 Dec 2024 09:26:04 +0000 Subject: [PATCH 1/6] Added "view all" option to curvals --- lib/GADS/Column/Curval.pm | 15 ++++++++++++++- lib/GADS/Role/Presentation/Column.pm | 1 + views/layout.tt | 22 ++++++++++++++++++++++ views/snippets/datum.tt | 12 ++++++++---- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/lib/GADS/Column/Curval.pm b/lib/GADS/Column/Curval.pm index 6f3190801..6de5cae90 100644 --- a/lib/GADS/Column/Curval.pm +++ b/lib/GADS/Column/Curval.pm @@ -30,7 +30,20 @@ extends 'GADS::Column::Curcommon'; with 'GADS::Role::Curcommon::CurvalMulti'; has '+option_names' => ( - default => sub { [qw/override_permissions value_selector show_add delete_not_used limit_rows/] }, + default => sub { [qw/override_permissions value_selector show_add delete_not_used limit_rows show_view_all/] }, +); + +has show_view_all => ( + is => 'rw', + isa => Bool, + lazy => 1, + coerce => sub { $_[0] ? 1 : 0 }, + builder => sub { + my $self = shift; + return 0 unless $self->has_options; + $self->options->{show_view_all}; + }, + trigger => sub { $_[0]->reset_options }, ); has value_selector => ( diff --git a/lib/GADS/Role/Presentation/Column.pm b/lib/GADS/Role/Presentation/Column.pm index ad0d07fba..d84d8cf40 100644 --- a/lib/GADS/Role/Presentation/Column.pm +++ b/lib/GADS/Role/Presentation/Column.pm @@ -59,6 +59,7 @@ sub presentation { return_type => $self->return_type, show_in_edit => $self->show_in_edit, has_typeahead => $self->has_filter_typeahead, + show_view_all => $self->has_options && $self->options->{show_view_all}, }; if (my $sort = $options{sort}) diff --git a/views/layout.tt b/views/layout.tt index 10934ddc7..43c38a3fb 100755 --- a/views/layout.tt +++ b/views/layout.tt @@ -1045,6 +1045,28 @@ %] +
+
+
+
+ + Show View All: + +
+ +
+ [% + INCLUDE fields/sub/checkbox.tt + id = "show_view_all" + name = "show_view_all" + label = "Always show view all option" + value = 1 + checked = column.type == "curval" AND column.show_view_all ? 1 : 0; + %] +
+
+
+
[% diff --git a/views/snippets/datum.tt b/views/snippets/datum.tt index 50cb4b119..d7af8ce72 100644 --- a/views/snippets/datum.tt +++ b/views/snippets/datum.tt @@ -25,14 +25,18 @@ [% render_datum(col_inner) %] [% END %] - + [% curcommon_row_counter = curcommon_row_counter + 1%] [% END %] [% END %] -

- view all -

+ [% IF col.limit_rows AND curval.links.size >= col.limit_rows %] +

(showing maximum [% col.limit_rows %] rows. + view all) + [% ELSIF col.show_view_all %] +

(showing [% curval.links.size %] rows. + view all)

+ [% END %] [% END %] [% MACRO render_curcommon_datum(is_multivalue, curval, header, full_content) BLOCK %] From 313723a71984e84e1d2c27747cade4a870f79726 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Thu, 5 Dec 2024 10:44:11 +0000 Subject: [PATCH 2/6] Updated pluralisation --- views/snippets/datum.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/snippets/datum.tt b/views/snippets/datum.tt index d7af8ce72..86117178b 100644 --- a/views/snippets/datum.tt +++ b/views/snippets/datum.tt @@ -31,10 +31,10 @@ [% END %] [% IF col.limit_rows AND curval.links.size >= col.limit_rows %] -

(showing maximum [% col.limit_rows %] rows. +

(showing maximum [% col.limit_rows %] row[%IF curval.links.size != 1%]s[%END%]. view all) [% ELSIF col.show_view_all %] -

(showing [% curval.links.size %] rows. +

(showing [% curval.links.size %] row[%IF curval.links.size != 1%]s[%END%]. view all)

[% END %] [% END %] From 793ed616c335611d83baf9a0452381a6dfcb53f2 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Fri, 6 Dec 2024 14:12:21 +0000 Subject: [PATCH 3/6] Modified conditions and corrected tags on link --- views/snippets/datum.tt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/views/snippets/datum.tt b/views/snippets/datum.tt index 86117178b..cebd6661d 100644 --- a/views/snippets/datum.tt +++ b/views/snippets/datum.tt @@ -30,14 +30,12 @@ [% END %] [% END %] - [% IF col.limit_rows AND curval.links.size >= col.limit_rows %] -

(showing maximum [% col.limit_rows %] row[%IF curval.links.size != 1%]s[%END%]. - view all) - [% ELSIF col.show_view_all %] -

(showing [% curval.links.size %] row[%IF curval.links.size != 1%]s[%END%]. - view all)

+ [% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all%] +

(showing[% IF col.limit_rows AND curval.links.size >= col.limit_rows %] maximum [% col.limit_rows %] + [% ELSE %] [% curval.links.size %] [% END %]row[%IF curval.links.size != 1%]s[%END%]. + view all)

+ [% END %] [% END %] -[% END %] [% MACRO render_curcommon_datum(is_multivalue, curval, header, full_content) BLOCK %] [% IF curval.text.length > MORE_LESS_TRESHOLD AND NOT full_content %] From bf56bec3481d37d92b0fc0d9d12e0a19d49e84fc Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Mon, 9 Dec 2024 09:27:39 +0000 Subject: [PATCH 4/6] Updated indents --- views/snippets/datum.tt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/snippets/datum.tt b/views/snippets/datum.tt index cebd6661d..084dda83c 100644 --- a/views/snippets/datum.tt +++ b/views/snippets/datum.tt @@ -30,9 +30,10 @@ [% END %] [% END %] - [% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all%] + [% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all %]

(showing[% IF col.limit_rows AND curval.links.size >= col.limit_rows %] maximum [% col.limit_rows %] - [% ELSE %] [% curval.links.size %] [% END %]row[%IF curval.links.size != 1%]s[%END%]. + [% ELSE %] + [% curval.links.size %] [% END %]row[%IF curval.links.size != 1%]s[%END%]. view all)

[% END %] [% END %] From 3f687d2a8cf53c438f7135155a17dc20facba24c Mon Sep 17 00:00:00 2001 From: Dave Roberts <145559566+droberts-ctrlo@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:54:52 +0000 Subject: [PATCH 5/6] Update datum.tt --- views/snippets/datum.tt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/views/snippets/datum.tt b/views/snippets/datum.tt index 084dda83c..994d7a0fc 100644 --- a/views/snippets/datum.tt +++ b/views/snippets/datum.tt @@ -30,13 +30,16 @@ [% END %] [% END %] - [% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all %] -

(showing[% IF col.limit_rows AND curval.links.size >= col.limit_rows %] maximum [% col.limit_rows %] - [% ELSE %] - [% curval.links.size %] [% END %]row[%IF curval.links.size != 1%]s[%END%]. - view all)

- [% END %] + [% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all %] +

(showing[% IF col.limit_rows AND curval.links.size >= col.limit_rows %] maximum [% col.limit_rows %] + [% ELSE %] + [% curval.links.size %] + [% END %] + row[%IF curval.links.size != 1%]s[%END%]. + + view all)

[% END %] +[% END %] [% MACRO render_curcommon_datum(is_multivalue, curval, header, full_content) BLOCK %] [% IF curval.text.length > MORE_LESS_TRESHOLD AND NOT full_content %] From 21ddfa2d8201ccd7acdddece8448dbf28cfb2165 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Thu, 19 Dec 2024 09:39:08 +0000 Subject: [PATCH 6/6] reformatted datum.tt --- views/snippets/datum.tt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/views/snippets/datum.tt b/views/snippets/datum.tt index 994d7a0fc..b1911328c 100644 --- a/views/snippets/datum.tt +++ b/views/snippets/datum.tt @@ -30,14 +30,15 @@ [% END %] [% END %] - [% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all %] -

(showing[% IF col.limit_rows AND curval.links.size >= col.limit_rows %] maximum [% col.limit_rows %] + [% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all %] +

(showing + [% IF col.limit_rows AND curval.links.size >= col.limit_rows %] + maximum [% col.limit_rows %] [% ELSE %] [% curval.links.size %] [% END %] row[%IF curval.links.size != 1%]s[%END%]. - - view all)

+ view all)

[% END %] [% END %]