Giter Club home page Giter Club logo

fusionfiles's Introduction

Kleisli.FusionFiles

Serve different file formats with Neos.Fusion

Available formats

  • json
  • ics
  • pdf (with additional package Kleisli.FusionFiles.Pdf)

Json

To render a node My.NodeType as json, just add a fusion prototype My.NodeType.Json that extends Kleisli.FusionFiles:File.Json and add the json values to the data property.

Eel helper

This package has its own eel helper FusionFiles.Json to jsonify, because the core eel helper fails to replace the Neos cache markers correctly.

Example

prototype(My.App:Document.List.Json) < prototype(Kleisli.FusionFiles:File.Json) {
    data {
        value = 'ok'
        getValueFromPrototype = My.App:Component.ListAsArray
    }
}

on requesting https://your.domain/path/to/node.json the response will be something like

{
    "value" : "ok",
    "getValueFromPrototype" : [
        {"id": "abc"},
        {"id": "def"}
    ]
}

Ics Event

Make nodes representing an event addable to calendars.

To render a node My.Event as ics, just add a fusion prototype My.Event.Ics that extends Kleisli.FusionFiles:File.Ics.Event and add the event properties to the data property.

Example

prototype(My.App:Document.Event.Ics) < prototype(Kleisli.FusionFiles:File.Ics.Event) {
    data {
        startDateTime = ${node.properties.startDate}
        endDateTime = ${node.properties.endDate}
        title = ${node.properties.title}
    }
}

In the template of My.Event you can link the ICS file like:

<Neos.Neos:NodeLink node={documentNode} attributes.href.format="ics">
    Add to calendar
</Neos.Neos:NodeLink>

Use the helpers for other file formats

Add a Request.fusion file to your package with

root {
    // Hook into the root matcher to change rendering for fancy requests
    fancy = Kleisli.FusionFiles:Helper.RenderFileMatcher {
        fileExtension = 'fancy'
    }
}

to access the prototype

prototype(My.App:Document.List.Fancy) < prototype(Neos.Fusion:Component) {
    renderer = ''
}

via https://your.domain/path/to/node.fancy

Kudos

The development of this package has significantly been funded by Profolio - a digital platform for career choice & career counseling

fusionfiles's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.