New Features in Wheelhouse CMS 1.0.11

Posted on November 26th, 2012

Author: Sam Pohlenz

Since the initial release, Wheelhouse CMS has been undergoing continual improvement. Whilst the focus has mostly been on bug fixes, I wanted to highlight a few new features that have been introduced in the latest version.

Unpublish

Unpublish pages

In case you accidentally publish a page that wasn't ready, it is now possible to unpublish a page or other resource (such as a blog post or form).

If a page is published, the Save Draft button becomes a dropdown menu from where the page can be unpublished.

Send-to-topSend to top/bottom for sortable lists

Inspired by 37signals' double-click scrolling margins, double-clicking the top or bottom half of the drag handle of sortable items (such as looped template items) now sends that item to the top or bottom respectively.

Remove image selection

Remove-Selection

One small final feature to round out the three — images defined in the templates can now be removed by selecting Remove Selection from the image chooser.

This can be useful if you want to remove an optional template image from the page, such as a banner image.

If you'd like to try Wheelhouse CMS, check out the 30-day free trial (no payment details required).

Easy Blog Post Excerpts with Wheelhouse CMS

Posted on October 23rd, 2012

Author: Sam Pohlenz

When setting up a new blog within Wheelhouse CMS, you may be surprised to see somewhat of a minimalist picture when it comes to features such as blogrolls, custom banner images and post excerpts. In actual fact, the powerful templating features of Wheelhouse CMS not only make adding these features to your blog delightfully simple, but also pave the way for a huge amount of customization possibilities.

In this article I'll show you how to add excerpts to your site's blog posts, a feature I've recently incorporated into a couple of my own clients' blogs.

Customizing the post template

The Wheelhouse blog plugin allows you to customize the post template for all views by overriding a single partial. To define a very basic post template, save the following as blog/_post.html.erb within your theme's templates folder:

<article class="post">
<h3><%= post.title %></h3>
<p class="date"><%= post.published_at.to_s(:short) %></p>

<%= post.content %>
</article>

This template will be rendered for each post on the blog index (as well as archives, tags and category pages), as well as when viewing the post in isolation.

The current_page?(post) Rails helper can be used to determine if the user is on a post or index page. Other built-in Rails helpers can also be used, such as link_to_unless_current to only link the post title from the blog index pages.

Adding a content field for excerpts

The other important piece of the puzzle is how to define the post excerpts so that they can be edited by the post author. Wheelhouse's content area helpers give us a huge amount of flexibility here, allowing us to define editable content areas, text fields, images or a combination of these.

To define a short excerpt field, which will appear below the main post content field when editing the post, we can use the following line in the template:

<%= post.content "Excerpt", :rows => 5 %>

Bringing it all together

Combining these concepts, we end up with the following post template:

<article class="post">
<h3><%= link_to_unless_current post.title, post %></h3>
<p class="date"><%= post.published_at.to_s(:short) %></p>

<% if current_page?(post) %>
<%= post.content %>
<% else %>
<%= post.content "Excerpt", :rows => 5 %>
<%= link_to "Read More", post %>
<% end %>
</article>

Which looks like this when editing the post within the Wheelhouse admin:

Blog Post Excerpts

Bonus: automatic excerpts

These fully custom excerpts give the post author complete control as to how the post excerpt should appear. However it requires the post author explicitly enter in the excerpt content, usually by copy and pasting the first few sentences of the post. If we are aren't fussy about the format of the excerpts and just care about their length, we can simply truncate the post content and get the excerpt for free.

Although Rails provides a built-in truncate helper, this unfortunately does not work on HTML output such as the post content. Instead we can use the truncate_html helper by adding it to the Gemfile and using the following code in the post template to produce the excerpt:

<%= truncate_html(post.content, :length => 300) %>
<%= link_to "Read More", post %>

Installing Ruby, Rails & MongoDB on Mountain Lion

Posted on July 28th, 2012

Author: Sam Pohlenz

Updated 5th December 2012 with latest package versions.

After recently updating to OS X 10.8 Mountain Lion, I decided to document the process of getting set up for Ruby on Rails development with MongoDB. Fortunately the process hasn't changed too much from previous versions of Mac OS X.

1. Install Command Line Tools 10.8 for Xcode

In order to compile Ruby with RVM, as well as many Homebrew packages, you'll need a compilation toolchain. If you are doing Mac or iOS development, you may want to install Xcode in its entirety. However if you don't want the hefty Xcode (1.8GB) on your system, the Command Line Tools are a good lightweight (110MB) alternative.

The Command Line Tools installer can be downloaded here (you'll need an Apple ID). After downloading, mount the disk image and run the installer.

2. Install Ruby and Rails using RVM

Note: the following commands should be run as a non-root user (i.e. no sudo).

To install the latest stable version of RVM, run the following from a terminal window:

$ curl -L https://get.rvm.io | bash -s stable

Close and reopen the terminal window. Then install the latest Ruby version with:

$ rvm install 1.9.3

You can confirm this has installed correctly by running:

$ ruby -v
ruby 1.9.3p327 (2012-11-10) [x86_64-darwin12.2.0]

Before installing any gems, I generally disable the slow and unnecessary RDoc and RI generation by creating a ~/.gemrc file with the following:

install: --no-ri --no-rdoc
update: --no-ri --no-rdoc

Then we can install and verify Rails with the following commands:

$ gem install rails
$ rails -v
Rails 3.2.9

3. Install Homebrew & XQuartz (X11)

Homebrew is my preferred way of managing packages in OS X. Homebrew compiles most packages from source and keeps everything nicely managed within /usr/local. It can be installed by running:

$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

X11, which is required for packages such as ImageMagick, was previously bundled with Mac OS X. It is still maintained, but no longer ships with the OS, instead available as XQuartz.

Download XQuartz 2.7.4, mount the disk image and run the installer, as with the Command Line Tools.

4. Install MongoDB

Finally, we can install MongoDB using Homebrew:

$ brew install mongodb
$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/Cellar/mongodb/2.2.2-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

This will load MongoDB automatically on login, and start it for the first time. We can verify MongoDB is installed correctly by loading the console:

$ mongo
MongoDB shell version: 2.2.2
connecting to: test
>

Wheelhouse CMS now free to try

Posted on July 26th, 2012

Author: Sam Pohlenz

Been thinking about trying Wheelhouse CMS but not sure if it's going to be right for you? Would you like to test Wheelhouse in your own development environment before taking the leap?

Wheelhouse CMS can now be evaluated for a period of 30 days with no credit card or payment details necessary. In addition to this free trial period, our 30-day, no questions asked refund policy isn't going anywhere, so you have even longer to try it out risk-free.

So what are you waiting for? Start your free trial now!

Wheelhouse 1.0.1 (with Rails 3.2 support)

Posted on February 1st, 2012

Author: Sam Pohlenz

The first patch release of Wheelhouse CMS is now out with a number of bugfixes and improvements, most notable of which is support for Rails 3.2.

It's worth upgrading to Rails 3.2 if only for the improved development mode reloading, which leads to significantly faster response times whilst you are building your themes and plugins.

To upgrade to Wheelhouse 1.0.1 and Rails 3.2, simply update the following versions in your Gemfile:

gem 'rails', '3.2.1'

gem 'wheelhouse'

group :assets do
gem 'sass-rails', '~> 3.2.4'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '~> 1.2.3'
end

Then run bundle update, restart your rails server and you're good to go.