self::$showAll = ($_REQUEST['show'] ?? '') === 'all';
}
- public static function post(array $parameters = [])
- {
- $request_id = DI::args()->get(1);
-
- if ($request_id === 'all') {
- return;
- }
-
- if ($request_id) {
- $intro = DI::intro()->selectFirst(['id' => $request_id, 'uid' => local_user()]);
-
- switch ($_POST['submit']) {
- case DI::l10n()->t('Discard'):
- $intro->discard();
- break;
- case DI::l10n()->t('Ignore'):
- $intro->ignore();
- break;
- }
-
- DI::baseUrl()->redirect('notifications/intros');
- }
- }
-
public static function rawContent(array $parameters = [])
{
// If the last argument of the query is NOT json, return
}
}
+ public static function post(array $parameters = [])
+ {
+ $request_id = $parameters['id'] ?? false;
+
+ if (DI::args()->get(1) == 'action' && $request_id) {
+ $intro = DI::intro()->selectFirst(['id' => $request_id, 'uid' => local_user()]);
+
+ switch ($_POST['submit']) {
+ case DI::l10n()->t('Discard'):
+ $intro->discard();
+ break;
+ case DI::l10n()->t('Ignore'):
+ $intro->ignore();
+ break;
+ }
+
+ DI::baseUrl()->redirect('notifications/intros');
+ }
+ }
+
public static function rawContent(array $parameters = [])
{
// @TODO: Replace with parameter from router
],
'/notification' => [
- '[/]' => [Module\Notifications\Notification::class, [R::GET]],
- '/view/{id:\d+}' => [Module\Notifications\Notification::class, [R::GET]],
- '/mark/all' => [Module\Notifications\Notification::class, [R::GET]],
+ '[/]' => [Module\Notifications\Notification::class, [R::GET]],
+ '/view/{id:\d+}' => [Module\Notifications\Notification::class, [R::GET]],
+ '/mark/all' => [Module\Notifications\Notification::class, [R::GET]],
+ '/action/{id:\d+}' => [Module\Notifications\Notification::class, [ R::POST]],
],
'/objects/{guid}' => [Module\Objects::class, [R::GET]],
<div class="intro-knowyou">{{$lbl_knowyou}} {{$knowyou}}</div>
<div class="intro-note" id="intro-note-{{$contact_id}}">{{$note}}</div>
<div class="intro-wrapper-end" id="intro-wrapper-end-{{$contact_id}}"></div>
-<form class="intro-form" action="notifications/{{$intro_id}}" method="post">
+<form class="intro-form" action="notification/action/{{$intro_id}}" method="post">
<input class="intro-submit-ignore" type="submit" name="submit" value="{{$ignore}}" />
{{if $discard}}<input class="intro-submit-discard" type="submit" name="submit" value="{{$discard}}" />{{/if}}
</form>
<a class="intro-url-link" href="{{$url}}" ><img class="intro-photo lframe" src="{{$photo}}" width="175" height="175" title="{{$fullname}}" alt="{{$fullname}}" /></a>
<div class="intro-note" >{{$note}}</div>
<div class="intro-wrapper-end"></div>
-<form class="intro-form" action="notifications/{{$intro_id}}" method="post">
+<form class="intro-form" action="notification/action/{{$intro_id}}" method="post">
<input class="intro-submit-ignore" type="submit" name="submit" value="{{$ignore}}" />
<input class="intro-submit-discard" type="submit" name="submit" value="{{$discard}}" />
</form>
<div class="intro-actions pull-right nav-pills preferences">
<button class="btn-link intro-action-link" onclick="addElmToModal('#intro-approve-wrapper-{{$intro_id}}');" aria-label="{{$approve}}" title="{{$approve}}" data-toggle="tooltip"><i class="fa fa-check" aria-hidden="true"></i></button>
- <form class="intro-form" action="notifications/{{$intro_id}}" method="post">
+ <form class="intro-form" action="notification/action/{{$intro_id}}" method="post">
<button class="btn-link intro-submit-ignore intro-action-link" type="submit" name="submit" value="{{$ignore}}" aria-label="{{$ignore}}" title="{{$ignore}}" data-toggle="tooltip"><i class="fa fa-ban" aria-hidden="true"></i></button>
{{if $discard}}<button class="btn-link intro-submit-discard intro-action-link" type="submit" name="submit" value="{{$discard}}" aria-label="{{$discard}}" title="{{$discard}}" data-toggle="tooltip"><i class="fa fa-trash-o" aria-hidden="true"></i></button>{{/if}}
</form>
{{* On mobile touch devices we use buttons for approve, ingnore && discard to have a better UX *}}
{{if $APP->is_mobile}}
<div class="intro-action-buttons">
- <form class="intro-form pull-left" action="notifications/{{$intro_id}}" method="post">
+ <form class="intro-form pull-left" action="notification/action/{{$intro_id}}" method="post">
<button class="btn btn-small btn-default intro-submit-ignore" type="submit" name="submit" value="{{$ignore}}">{{$ignore}}</button>
{{if $discard}}<button class="btn btn-small btn-default intro-submit-discard" type="submit" name="submit" value="{{$discard}}">{{$discard}}</button> {{/if}}
</form>