posabsolute/inker

View on GitHub
src/templates/components/jsonld/actions/_component.jsonld.rsvp.html

Summary

Maintainability
Test Coverage
<!-- 
JSON-LD RSVP
https://developers.google.com/gmail/markup/reference/rsvp-action

@startDate {date} "2015-04-18T15:30:00Z"
@endDate {date} "2015-04-18T16:30:00Z"
@name {string} "Address name"
@streetAddress {string} "24 Willie Mays Plaza"
@addressLocality {string} "San Francisco"
@addressRegion {string} "CA"
@postalCode {string} "94107"
@addressCountry {string} "USA"
@actions {array} Array of actions object
Ex:
"actions" : [{
  "url" : "http://www.google.com",
  "attendance" : "http://schema.org/RsvpAttendance/Yes"
}]

@action.attendance http://schema.org/RsvpAttendance/Yes || http://schema.org/RsvpAttendance/No ||  http://schema.org/RsvpAttendance/maybe

* ---- *

You may add a one-click confirm button to emails requiring users to approve, confirm and acknowledge something. Once the user clicks on the button, an http request will be issued from Google to your service, recording the confirmation. ConfirmAction can only be interacted with once.

SaveAction can be used to describe interactions like saving a coupon or adding songs to the listen queue. SaveAction can only be interacted with once.

-->

{% macro jsonldRSVP() %}
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "{{'{{ jsonLD.name }}'}}",
  "startDate": "{{'{{ jsonLD.startdate }}'}}",
  "endDate": "{{'{{ jsonLD.enddate }}'}}",
  "location": {
    "@type": "Place",
    "address": {
      "@type": "PostalAddress",
      "name": "{{'{{ jsonLD.addressName }}'}}",
      "streetAddress": "{{'{{ jsonLD.addressStress }}'}}",
      "addressLocality": "{{'{{ jsonLD.addressCity }}'}}",
      "addressRegion": "{{'{{ jsonLD.addressRegion }}'}}",
      "postalCode": "{{'{{ jsonLD.adressPostal }}'}}",
      "addressCountry": "{{'{{ jsonLD.addressCountry }}'}}"
    }
  },
  "action": [
    {{ '{% for action in jsonLD.actions %}' }}
      {
      "@type": "RsvpAction",
      "handler": {
        "@type": "HttpActionHandler",
        "url": "{{'{{ action.url }}'}}"
      },
      "attendance": "{{'{{ action.attendance }}'}}"
      },
    {{ '{% endfor %}' }}
  ]
}
</script>
{% endmacro %}