Skip to content

Commit

Permalink
Traduction + Bouton on dashboard page
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickFavre committed Jan 14, 2022
1 parent d7ecabf commit 1ccac4e
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [2.5.1-1]
### Changed
- A checkbox is available on Dashboard page to enable notifition when components change. This checkbox is disabled by default.
- Add a link on status page on notification email

## [2.5.1]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.5.1
v2.5.1-1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public function handle(ComponentStatusWasChangedEvent $event)
return;
}

// YF - Don't notify if checkbox not checked
if ($_POST["component_notify"] == "false" || $_POST["component_notify"] == ""){
return;
}

// First notify all global subscribers.
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public function toMail($notifiable)
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => $manageUrl,
'statuspageText' => trans('cachet.subscriber.statuspage'),
'statuspageUrl' => cachet_route('status-page'),
]);
}

Expand Down
2 changes: 2 additions & 0 deletions app/Notifications/Incident/NewIncidentNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function toMail($notifiable)
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => $manageUrl,
'statuspageText' => trans('cachet.subscriber.statuspage'),
'statuspageUrl' => cachet_route('status-page'),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public function toMail($notifiable)
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => $manageUrl,
'statuspageText' => trans('cachet.subscriber.statuspage'),
'statuspageUrl' => cachet_route('status-page'),
]);
}

Expand Down
2 changes: 2 additions & 0 deletions app/Notifications/Schedule/NewScheduleNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function toMail($notifiable)
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => $manageUrl,
'statuspageText' => trans('cachet.subscriber.statuspage'),
'statuspageUrl' => cachet_route('status-page'),
]);
}

Expand Down
1 change: 1 addition & 0 deletions resources/lang/fr-FR/cachet.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
'unsubscribe' => 'Se désabonner',
'button' => 'S\'abonner',
'manage_subscription' => 'Gérer l\'abonnement',
'statuspage' => 'Page de statut',
'manage' => [
'notifications' => 'Notifications',
'notifications_for' => 'Gérer les notifications pour',
Expand Down
5 changes: 3 additions & 2 deletions resources/lang/fr/cachet.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@
],
'component' => [
'subject' => 'Mise à jour du statut d\'un composant',
'text' => 'Le statut du composant :component_name a été mis à jour. Il est maintenant :component_human_status.\nMerci, :app_name',
'html' => '<p>Le statut du composant :component_name a été mis à jour. Il est maintenant :component_human_status.</p><p>Merci, :app_name</p>',
'text' => 'Le statut du composant :component_name a été mis à jour. Il est maintenant en l\'état: \'<b>:component_human_status</b>\'.\nMerci, :app_name',
'html' => '<p>Le statut du composant :component_name a été mis à jour. Il est maintenant en l\'état: \'<b>:component_human_status</b>\'.</p><p>Merci, :app_name</p>',
'tooltip-title' => 'S\'abonner aux notifications pour :component_name.',
],
'statuspage' => 'Page de statut', ],
],
],

Expand Down
18 changes: 18 additions & 0 deletions resources/views/dashboard/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
<div class="alert alert-info hidden" id="update-alert">{!! trans('cachet.system.update') !!}</div>
</div>
</div>
<!-- DEBUT -->
<input type="hidden" name="notify" value="0">
<div class="checkbox">
<label>
<input type="checkbox" name="notify" onchange="changeNotif(this)">
{{ trans('forms.incidents.notify_subscribers') }}
</label>
</div>
<script>
function changeNotif(obj){
var value = obj.checked;
var x = document.getElementsByClassName("component_notify");
for (i = 0; i < x.length; i++) {
x[i].value=value;
}
}
</script>
<!-- FIN -->

<div class="row">
<div class="col-md-12">
Expand Down
1 change: 1 addition & 0 deletions resources/views/dashboard/partials/component.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
</div>
</div>
<input type="hidden" name="component_id" value="{{ $component->id }}">
<input type="hidden" class="component_notify" name="component_notify">
</form>
</li>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@component('mail::subcopy')
[{{ $unsubscribeText }}]({{ $unsubscribeUrl }}) &mdash; [{{ $manageSubscriptionText }}]({{ $manageSubscriptionUrl }})
[{{ $statuspageText }}]({{ $statuspageUrl }}) &mdash; [{{ $unsubscribeText }}]({{ $unsubscribeUrl }}) &mdash; [{{ $manageSubscriptionText }}]({{ $manageSubscriptionUrl }})
@endcomponent

0 comments on commit 1ccac4e

Please sign in to comment.