Skip to content

Server Specification

jejacks0n edited this page Jun 25, 2011 · 11 revisions

This document is intended for developers looking to create their own integration with various servers, frameworks, and languages. It outlines and details the features necessary for backend integration of Mercury, and is broken into two categories. The first category outlines the aspects for Snippets, and the second outlines the features required for Image processing (uploading, resizing, cropping etc).

Snippets

Snippets are chunks of markup that can be inserted into a region. These are added by developers and are intended to provide more complex functionality that can be placed within content. When inserting a snippet, a user is prompted to enter options. Once the options are submitted, a preview of the snippet is rendered to the page.

You can check this project for an example snippet written for Rails.

It's worth noting that all of these urls are available in the configuration, so you may consider bundling your own configuration along with your server implementation.

Listing Snippets

When you open the Snippet Panel an Ajax request is made to the server ('/mercury/panels/snippets' by default) and it's expected to respond with a list of snippets. This view provides a filterable list of snippets and snippet icons, that a user can then drag into regions.

To see what this markup should look like, check /app/views/mercury/panels/snippets.html

Options View

Upon dragging a snippet icon into a region, an Ajax request is made to the server for the options form for the given snippet. The default path for this is '/mercury/snippets/:name/options' with :name being replaced with the snippet name (eg. 'example'). The server is expected to respond with an options form that's associated with the given snippet.

For an example of this view check /app/views/mercury/snippets/example_options.html.erb

Snippet Preview

Upon entering and submitting options for a snippet, a third Ajax request is made to the server for a preview of the snippet. The default path is '/mercury/snippets/:name/preview'. This is used to populate the content within the snippet, and should provide as accurate of a representation as possible for the given snippet.

For an example of this check /app/views/mercury/snippets/example.html.erb

Images

Incomplete spec..