From b36d026f4e24fab3ce3122e9bb8225d38ffcef0d Mon Sep 17 00:00:00 2001 From: Josh Rowley Date: Wed, 30 Jul 2014 13:17:54 -0400 Subject: [PATCH] :shipit: v0.0.1 --- lib/index.coffee | 6 ++---- package.json | 2 +- readme.md | 27 ++++++--------------------- test/test.coffee | 2 -- 4 files changed, 9 insertions(+), 28 deletions(-) diff --git a/lib/index.coffee b/lib/index.coffee index 0237fb9..3473e03 100644 --- a/lib/index.coffee +++ b/lib/index.coffee @@ -29,8 +29,7 @@ module.exports = (opts) -> setup: -> configure_content(opts.content_types) .then(get_all_content) - .then (res) => - @roots.config.locals.contentful = res + .then (res) => @roots.config.locals.contentful = res ###* * Configures content types set in app.coffee. Sets default values if @@ -78,8 +77,7 @@ module.exports = (opts) -> * @return {Promise} - returns formatted content type entries object ### - format_content = (content) -> - W.map(content, format_entry) + format_content = (content) -> W.map(content, format_entry) ###* * Formats a single entry object from Contentful API response diff --git a/package.json b/package.json index 0761c3f..703f58e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "roots-contentful", - "version": "0.0.0", + "version": "0.0.1", "description": "An extension for using roots with the API-driven Contentful CMS", "main": "lib", "directories": { diff --git a/readme.md b/readme.md index 0300f1d..624eb24 100644 --- a/readme.md +++ b/readme.md @@ -1,9 +1,9 @@ Roots Contentful ================ -[![npm](https://badge.fury.io/js/roots-contentful.png)](http://badge.fury.io/js/roots-contentful) [![tests](https://travis-ci.org/carrot/roots-contentful.png?branch=master)](https://travis-ci.org/carrot/roots-contentful) [![dependencies](https://david-dm.org/carrot/roots-contentful.png?theme=shields.io)](https://david-dm.org/carrot/roots-contentful) [![Coverage Status](https://img.shields.io/coveralls/carrot/roots-contentful.svg)](https://coveralls.io/r/carrot/roots-contentful?branch=implement-view-helper) +[![npm](https://badge.fury.io/js/roots-contentful.png)](http://badge.fury.io/js/roots-contentful) [![tests](https://travis-ci.org/carrot/roots-contentful.png?branch=master)](https://travis-ci.org/carrot/roots-contentful) [![dependencies](https://david-dm.org/carrot/roots-contentful.png?theme=shields.io)](https://david-dm.org/carrot/roots-contentful) [![Coverage Status](https://img.shields.io/coveralls/carrot/roots-contentful.svg)](https://coveralls.io/r/carrot/roots-contentful?branch=master) -An extension for using roots with the Contentful CMS API. +An extension for using [roots](https://github.com/jenius/roots) with the Contentful CMS API. > **Note:** This project is in early development, and versioning is a little different. [Read this](http://markup.im/#q4_cRZ1Q) for more details. @@ -66,28 +66,13 @@ A `contentful` view helper object will be passed into every view containing your #### Single Entry Views +> **Note:** This feature is currently not implemented, but is planned for a future release. + If a `template` option is defined for a Content Type in `app.coffee`, roots will compile a single page view for each entry in that Content Type collection. The entry will also have a `_url` key that returns the path to the single page view (so you can create links on an index page for example). #### The Entry Object -Contentful's [documentation](https://www.contentful.com/developers/documentation/content-delivery-api/#getting-entry) shows the response the API returns when fetching an entry. It looks something like this: - -```json -{ - "sys": { - "type": "Entry", - "id": "cat" - # ... - }, - "fields": { - "title": "Wow. Such title. Much viral", - "author": "The Doge of Venice" - # ... - } -} -``` - -As a convenience, the entry object roots-contentful makes available in your views will have the `fields` key's value set one level higher on the object. System metadata remains accessible on the `sys` key and roots-contentful will raise an error if you have a field named `sys`. Thus, the entry object above will have this structure inside your views: +Contentful's [documentation](https://www.contentful.com/developers/documentation/content-delivery-api/#getting-entry) shows the API response when fetching an entry. Your content fields are nested in a `fields` key. As a convenience, the entry object roots-contentful makes available in your views will have the `fields` key's value set one level higher on the object. System metadata remains accessible on the `sys` key and roots-contentful will raise an error if you have a field named `sys`. Inside your views, the entry object will have this structure: ```json { @@ -125,7 +110,7 @@ Required. The Content Type's ID on Contentful. #### name -Optional. This is the name of the key the entries will be attached to on the `contentful` object in your views. Defaults to a [pluralized](https://github.com/blakeembrey/pluralize), [underscored](http://stringjs.com/#methods/underscore) representation of the Content Type name (e.g. 'Blog Post' => `contentful.blogPosts`) +Optional. This is the name of the key the entries will be attached to on the `contentful` object in your views. Defaults to a [pluralized](https://github.com/blakeembrey/pluralize), [underscored](http://stringjs.com/#methods/underscore) representation of the Content Type name (e.g. 'Blog Post' => `contentful.blog_posts`) #### template diff --git a/test/test.coffee b/test/test.coffee index e83576a..1d90972 100644 --- a/test/test.coffee +++ b/test/test.coffee @@ -1,8 +1,6 @@ _ = require 'lodash' path = require 'path' -fs = require 'fs' W = require 'when' -node = require 'when/node' Roots = require 'roots' # setup, teardown, and utils