Added support for gmail one-click actions

This commit is contained in:
Hillel Coren 2015-03-11 23:37:43 +02:00
parent 228f772f02
commit 2cdf6d517a
9 changed files with 197 additions and 159 deletions

View File

@ -41,6 +41,8 @@ class ContactMailer extends Mailer
]; ];
$data['body'] = str_replace(array_keys($variables), array_values($variables), $emailTemplate); $data['body'] = str_replace(array_keys($variables), array_values($variables), $emailTemplate);
$data['link'] = $invitation->getLink();
$data['entityType'] = $entityType;
$fromEmail = $invitation->user->email; $fromEmail = $invitation->user->email;
$this->sendTo($invitation->contact->email, $fromEmail, $accountName, $subject, $view, $data); $this->sendTo($invitation->contact->email, $fromEmail, $accountName, $subject, $view, $data);

View File

@ -8,9 +8,13 @@
<div class="panel-body"> <div class="panel-body">
<img src="{{ asset('images/totalincome.png') }}" class="in-image"/> <img src="{{ asset('images/totalincome.png') }}" class="in-image"/>
<div class="in-bold"> <div class="in-bold">
@if (count($paidToDate))
@foreach ($paidToDate as $item) @foreach ($paidToDate as $item)
{{ Utils::formatMoney($item->value, $item->currency_id); }}<br/> {{ Utils::formatMoney($item->value, $item->currency_id); }}<br/>
@endforeach @endforeach
@else
{{ Utils::formatMoney(0) }}
@endif
</div> </div>
<div class="in-thin"> <div class="in-thin">
{{ trans('texts.in_total_revenue') }} {{ trans('texts.in_total_revenue') }}

View File

@ -1,5 +1,6 @@
<html> <html>
<body> <body>
@if (!$invitationMessage)
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context":"http://schema.org", "@context":"http://schema.org",
@ -8,14 +9,20 @@
"action": "action":
{ {
"@type":"ConfirmAction", "@type":"ConfirmAction",
"name":"Confirm Account", "name":"Confirm account",
"handler": { "handler": {
"@type": "HttpActionHandler", "@type": "HttpActionHandler",
"url": "{{{ URL::to("user/confirm/{$user->confirmation_code}") }}}" "url": "{{{ URL::to("user/confirm/{$user->confirmation_code}") }}}"
},
"publisher": {
"@type": "Organization",
"name": "Invoice Ninja",
"url": "{{{ NINJA_WEB_URL }}}"
} }
} }
} }
</script> </script>
@endif
<h1>{{ trans('texts.confirmation_header') }}</h1> <h1>{{ trans('texts.confirmation_header') }}</h1>
@ -28,6 +35,7 @@
{{ trans('texts.email_signature') }}<br/> {{ trans('texts.email_signature') }}<br/>
{{ trans('texts.email_from') }} {{ trans('texts.email_from') }}
</p>
</body> </body>
</html> </html>

View File

@ -3,5 +3,8 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
</head> </head>
<body>{{ $body }}</body> <body>
@include('emails.view_action', ['link' => $link, 'entityType' => $entityType])
{{ $body }}
</body>
</html> </html>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
</head> </head>
<body> <body>
@include('emails.view_action', ['link' => $invoiceLink, 'entityType' => $entityType])
{{ trans('texts.email_salutation', ['name' => $userName]) }} <p/> {{ trans('texts.email_salutation', ['name' => $userName]) }} <p/>
{{ trans("texts.notification_{$entityType}_paid", ['amount' => $paymentAmount, 'client' => $clientName, 'invoice' => $invoiceNumber]) }} <p/> {{ trans("texts.notification_{$entityType}_paid", ['amount' => $paymentAmount, 'client' => $clientName, 'invoice' => $invoiceNumber]) }} <p/>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
</head> </head>
<body> <body>
@include('emails.view_action', ['link' => $invoiceLink, 'entityType' => $entityType])
{{ trans('texts.email_salutation', ['name' => $userName]) }} <p/> {{ trans('texts.email_salutation', ['name' => $userName]) }} <p/>
{{ trans("texts.notification_{$entityType}_sent", ['amount' => $invoiceAmount, 'client' => $clientName, 'invoice' => $invoiceNumber]) }} <p/> {{ trans("texts.notification_{$entityType}_sent", ['amount' => $invoiceAmount, 'client' => $clientName, 'invoice' => $invoiceNumber]) }} <p/>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
</head> </head>
<body> <body>
@include('emails.view_action', ['link' => $invoiceLink, 'entityType' => $entityType])
{{ trans('texts.email_salutation', ['name' => $userName]) }} <p/> {{ trans('texts.email_salutation', ['name' => $userName]) }} <p/>
{{ trans("texts.notification_{$entityType}_viewed", ['amount' => $invoiceAmount, 'client' => $clientName, 'invoice' => $invoiceNumber]) }} <p/> {{ trans("texts.notification_{$entityType}_viewed", ['amount' => $invoiceAmount, 'client' => $clientName, 'invoice' => $invoiceNumber]) }} <p/>

View File

@ -0,0 +1,17 @@
<script type="application/ld+json">
{
"@context":"http://schema.org",
"@type":"EmailMessage",
"description":"View your {{ $entityType }}",
"action": {
"@type": "ViewAction",
"url": "{{{ $link }}}",
"name": "View {{ $entityType }}"
},
"publisher": {
"@type": "Organization",
"name": "Invoice Ninja",
"url": "{{{ NINJA_WEB_URL }}}"
}
}
</script>

View File

@ -366,6 +366,10 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px"> <div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }} </button> <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }} </button>
{{-- DropdownButton::success_lg(trans('texts.buy'), [
['url' => URL::to(""), 'label' => trans('texts.pay_with_paypal')],
['url' => URL::to(""), 'label' => trans('texts.pay_with_card')]
])->addClass('btn-lg') --}}
<button type="button" class="btn btn-primary" onclick="buyProduct('{{ WHITE_LABEL_AFFILIATE_KEY }}', '{{ PRODUCT_WHITE_LABEL }}')">{{ trans('texts.buy') }} </button> <button type="button" class="btn btn-primary" onclick="buyProduct('{{ WHITE_LABEL_AFFILIATE_KEY }}', '{{ PRODUCT_WHITE_LABEL }}')">{{ trans('texts.buy') }} </button>
</div> </div>
</div> </div>