Skip to content

Using Mercury without Rails

ha25gmail edited this page Mar 29, 2012 · 4 revisions

Installation

Get the distro files by downloading them from github using the downloads feature, or pull them out of the project manually (the files are in /public/mercury). Copy these files into your project, and if you adjust where they're located (e.g. if they're not within assets/javascripts or assets/stylesheets). Also make sure you update the mercury_loader.js file to reflect this. How to use the mercury_loader.js is outlined in more detail below. Modify options.pack.

Images are bundled into the CSS if you're using the mercury.bundle.css file, but if you'd rather not use the bundled CSS you'll need to grab the images manually and adjust the paths that are in the mercury.css file.

The dialogs (eg. color palettes, modals, and other dialog types) are bundled into the mercury_dialogs.js file. If you would like to customize a view you can remove the view from the mercury_dialogs.js file and adjust the path you want to load using the configuration -- your custom view will then load using Ajax.

Bundling snippet options and snippets doesn't work in this way, so you may need to disable snippets or adjust where they're loaded from (writing your own back end integration).. We'll see how this pans out and adjust over time if needed, so feedback would be useful here.

Usage

Include the mercury_loader.js file. The loader will reload the page and enable Mercury in full page editing mode, so you may want to wrap this in conditional logic (only admins or something).

<script src="mercury_loader.js" type="text/javascript"></script>

You must also ensure that you set the editable regions data type and class appropriately e.g. <div class="mercury-region" data-type="editable"> /* Your editable content will be here... */ </div>

See "options" hash. Paths for css and JavaScript for 'bundled' and 'development' differ. See "mercuryPackages" hash.

Mercury Loader

... more added soon ...