Typo Tweaks
There are some annoying things about Typo that are relatively easy to fix. Here are two changes that I have made. Pointers to other posts or sites documenting Typo fixes would be appreciated.
Change pagination on Articles page
Find the contents_controller.rb file in typo/app/controller/admin. Change:per_page => 15 to :per_page => 35 or how ever many posts you want to see at a time.
Save As Draft
In order the save posts as drafts in Typo, you can change the published date to some date in the future. Instead of doing this manually everytime you want to create a draft, you can create a link that will automatically save whatever post you are working on with a publish date far in the future. The following Typo changes add a link that allows you to create a draft post. The draft post will be save with a publish date approximately one year from the current date.
- Make a copy of new.rhtml, name it draft.rhtml and change the action in the form tag from “new” to “draft”.
- Add the following code to typo/app/helpers/admin/base_helper.rb
def task_draft(title)
task(title, 'draft')
end
- Add the following code to typo/app/views/admin/content/list.rhtml:
<div id="draft" style="display:none;position:absolute;">
<%= render :partial => "admin/content/draft" %>
</div>
- Also on the list.rhtml page, make sure you add the link from the list page to the draft page, like this:
<%= task_draft('Draft') %>
- Replace the get_or_build_article method in typo/app/controllers/admin/content_controller.rb with the following code:
def get_or_build_article
@article = case params[:action]
when 'new'
art = this_blog.articles.build
art.allow_comments = this_blog.default_allow_comments
art.allow_pings = this_blog.default_allow_pings
art.published = true
art
when 'edit'
this_blog.articles.find(params[:id])
when 'draft'
art = this_blog.articles.build
art.allow_comments = this_blog.default_allow_comments
art.allow_pings = this_blog.default_allow_pings
art.published = true
t = Time.now + (365 * 24 * 60 * 60)
art.published_at = t
art
else
raise "Don't know how to get article for action: #{params[:action]}"
end
end
More to come; any requests?
Tweaks Elsewhere
- Subdirectories for Typo’s image folder: Now you have no excuse for having a messy image folder!
- Speed Up Typo on Dreamhost
