Skip to content

Commit

Permalink
Add links to help map statuses that have the same name
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnavy committed Mar 26, 2024
1 parent 21c6b46 commit a8cd5ac
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion etc/cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ requires 'HTTP::Message', '>= 6.07';
requires 'IPC::Run3';
requires 'JavaScript::Minifier::XS';
requires 'JSON';
requires 'List::MoreUtils';
requires 'List::MoreUtils', '>= 0.420';
requires 'Locale::Maketext', '>= 1.06';
requires 'Locale::Maketext::Fuzzy', '>= 0.11';
requires 'Locale::Maketext::Lexicon', '>= 0.32';
Expand Down
43 changes: 42 additions & 1 deletion share/html/Admin/Lifecycles/Mappings.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@
% my $ToMapping = $LifecycleObj->MoveMap($Other);
% my @OtherStatuses = $Other->Valid;

<&| /Widgets/TitleBox, title => $Other->Name &>
% require List::MoreUtils;
<&| /Widgets/TitleBox, title => $Other->Name,
List::MoreUtils::duplicates( map { lc } @MyStatuses, @OtherStatuses )
? ( titleright_raw => $titleright )
: (),
&>
<div class="form-row">
<div class="col-6">
<h6 class="text-center my-3"><&|/l, $Other->Name, $LifecycleObj->Name &>From [_1] to [_2]</&></h6>
Expand Down Expand Up @@ -104,6 +109,28 @@ <h6 class="text-center my-3"><&|/l, $LifecycleObj->Name, $Other->Name &>From [_1
</div>

</form>

<script type="text/javascript">
jQuery('.lifecycle-auto-map').click(function() {
jQuery(this).closest('div.titlebox').find('select').each(function() {
const select = jQuery(this);
if ( select.val() ) {
return;
}
else {
const from = select.attr('name').replace(/map-.*--(.*)--.*/, '$1').toLowerCase();
select.find('option').each(function() {
if ( jQuery(this).attr('value').toLowerCase() === from ) {
select.val(jQuery(this).attr('value'));
select.selectpicker('refresh');
return false;
}
});
}
});
return false;
});
</script>
% }
<%INIT>
my ($title, @results);
Expand Down Expand Up @@ -147,6 +174,20 @@ <h6 class="text-center my-3"><&|/l, $LifecycleObj->Name, $Other->Name &>From [_1
@lifecycle_names;

push @results, loc("You only need mappings once you have two more [_1] lifecycles", loc($Type)) unless @lifecycles;

my $alt = loc('Options');
my $map_same_name = loc('Map same names if unset');
my $titleright = qq{
<div class="btn-group dropdown">
<a id="history-dropdown" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fas fa-cog icon-bordered fa-2x" alt="$alt" data-toggle="tooltip" data-placement="top" data-original-title="$alt"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li class="dropdown-item"><a href="#" class="lifecycle-auto-map">$map_same_name</a></li>
</ul>
</div>
};

</%INIT>
<%ARGS>
$Name => undef
Expand Down

0 comments on commit a8cd5ac

Please sign in to comment.