Skip to content

Commit

Permalink
Update formatting and some spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrandtbuffalo committed Nov 13, 2024
1 parent ff0368b commit 47e4105
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions share/html/Dashboards/Subscription.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@

<&| /Widgets/TitleBox, title => loc('Subscription') &>
% if (!$SubscriptionObj) {
<p><% loc("Set a schedule below to receive this dashboard in email") %></p>
<&| /Elements/LabeledValue, Label => loc('No Subscription Set') &>
<span class="current-value"><&|/l&>Set a schedule below to receive this dashboard in email</&></span>
</&>
% } else {
<p><% loc("RT will send email for this dashboard based on the schedule below") %></p>
<&| /Elements/LabeledValue, Label => loc('Subscription Set') &>
<span class="current-value"><&|/l&>RT will send email for this dashboard based on the schedule below</&></span>
</&>
% }
<&| /Elements/LabeledValue, Label => loc('Frequency') &>
<div class="form-row">
Expand Down Expand Up @@ -252,15 +256,19 @@
IsFirstSubscription => $SubscriptionObj ? 0 : 1 &>
</&>

<div class="form-row">
<div class="col-12">
<div class="form-row justify-content-end">
% if ($SubscriptionObj) {
<& /Elements/Submit, Name => "Save", Label => loc('Save Changes') &>
<div class="col-auto">
<& /Elements/Submit, Name => "DeleteSubscription", Label => loc('Delete Subscription') &>
</div>
<div class="col-auto">
<& /Elements/Submit, Name => "Save", Label => loc('Save Changes') &>
</div>
% } else {
<div class="col-12">
<& /Elements/Submit, Name => "Save", Label => loc('Subscribe') &>
% }
</div>
% }
</div>

% if ($SubscriptionObj) {
Expand Down Expand Up @@ -376,17 +384,16 @@
$m->callback( %ARGS, CallbackName => 'SubscriptionFields', FieldsRef => \%fields,
SubscriptionObj => $SubscriptionObj, DashboardObj => $Dashboard);

if (defined $ARGS{DeleteSubscription}) {
if ($SubscriptionObj) {
($ok, $msg) = $SubscriptionObj->Delete;
if ($ok) {
if ( defined $ARGS{DeleteSubscription} ) {
if ($SubscriptionObj) {
($ok, $msg) = $SubscriptionObj->Delete;
if ($ok) {
push @results, loc("Subscription to dashboard [_1] deleted", $Dashboard->Name);

undef $SubscriptionObj;
} else {
push @results, loc("Could not delete subscription: [_1]", $msg);
}
}
} else {
push @results, loc("Unable to delete subscription: [_1]", $msg);
}
}
}

# update any fields with the values from the subscription object
Expand All @@ -395,14 +402,15 @@
$fields{$field} = $SubscriptionObj->SubValue($field);
}
}

# We do not want to process any magic args if we are deleting the subscription
unless (defined $ARGS{DeleteSubscription}) {
# finally, update any fields with arguments passed in by the user
for my $field (keys %fields) {
next if $field eq 'DashboardId'; # but this one is immutable
$fields{$field} = $ARGS{$field}
if defined($ARGS{$field}) || $ARGS{$field.'-Magic'};
}
unless ( defined $ARGS{DeleteSubscription} ) {
# finally, update any fields with arguments passed in by the user
for my $field (keys %fields) {
next if $field eq 'DashboardId'; # but this one is immutable
$fields{$field} = $ARGS{$field}
if defined($ARGS{$field}) || $ARGS{$field.'-Magic'};
}
}

$m->callback( %ARGS, CallbackName => 'MassageSubscriptionFields', FieldsRef => \%fields,
Expand Down

0 comments on commit 47e4105

Please sign in to comment.