sapwood

v1.3 Makes Blogging a Little Easier

Unlike v1.2, v1.3 had to happen fast, and it did! In just a few days and less than 30 commits, we have a few features that make blogging a little easier.

Introducing Resources

I struggled with this for some time. I knew there was a need for tags of some sort. And I knew that some sites were eligible only on the basis of needing a many-to-many relationship, which Sapwood was not prepared to handle.

But, then two requests similar to this came in within one week, and I knew there had to be a way to solve it. Resources are the first attempt at that.

A resource is any item that needs to be linked to several different pages. So, a tag could be a resource, but so could a feature slide.

You can read much more about resource on its doc page.

Searching

v1.3 also brings the first pass at bringing in searching to pages. There is a search feature built in to the builder for pages, and developers now have the option of listing search results on their pages.

To obtain the results, we simply need to call search_content at the Page class level. And then it's best to send the results to an array so you can work with them like you usually would a query result.

If your form is:

<%= simple_form_for(:search, :url => viewer_home, :method => :get) do |f| %>
  <%= f.input(:q, :label => false, :wrapper => false) %>
<% end %>

Then you can get the search results like so:

current_site.pages.search_content(params[:search][:q]).to_a

A Database Switch

I'm finally starting to come around, and now PostgreSQL is the only supported database adapter for Sapwood. The biggest factor in making this switch is the ease of being able to run searches without needing something like Thinking Sphinx running all the time.

Other Items

A few other feature additions:

  • Files can be uploaded to public forms. You can view and download files within each submission.
  • There is a google analytics helper to clean up your layout files.