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..b1911328c 100644 --- a/views/snippets/datum.tt +++ b/views/snippets/datum.tt @@ -25,14 +25,21 @@ [% 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) 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 %]