Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "view all" option to curvals [B: 1734] #498

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/GADS/Column/Curval.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 => (
Expand Down
1 change: 1 addition & 0 deletions lib/GADS/Role/Presentation/Column.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
22 changes: 22 additions & 0 deletions views/layout.tt
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,28 @@
%]
</div>
</div>
<div class="row">
<div class="col">
<fieldset class="fieldset" >
<div class="fieldset__legend ">
<legend >
Show View All:
</legend>
</div>

<div class="form-group ">
[%
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;
%]
</div>
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
[%
Expand Down
14 changes: 10 additions & 4 deletions views/snippets/datum.tt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,20 @@
[% render_datum(col_inner) %]
</td>
[% END %]
</tr>
</tr>
[% curcommon_row_counter = curcommon_row_counter + 1%]
[% END %]
</table>
[% END %]
<p>
<a href="/[% curval.parent_layout_identifier %]/data?curval_record_id=[% curval.record_id %]&curval_layout_id=[% curval.column_id %]" target="_blank">view all</a>
</p>
[% IF (col.limit_rows AND curval.links.size >= col.limit_rows) OR col.show_view_all %]
<p><em>(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%].</em>

<a href="/[% curval.parent_layout_identifier %]/data?curval_record_id=[% curval.record_id %]&curval_layout_id=[% curval.column_id %]" target="_blank">view all</a>)</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like one p tag and one em tag is inside the condition and one is outside.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reformatted to make the statements clearer.

[% END %]
droberts-ctrlo marked this conversation as resolved.
Show resolved Hide resolved
[% END %]

[% MACRO render_curcommon_datum(is_multivalue, curval, header, full_content) BLOCK %]
Expand Down
Loading