Hi guys,

I'm starting a new blog, and since I've been using Ruby at my work  
for 4 years, and since I want to grow familiar with rails, I've  
decided to use typo. I've run a medium traffic, group blog using  
wordpress before, and I actually designed the prototype theme my new  
blog in wordpress, which I'm now in the process of converting to  
typo. The wordpress/apache version is here: http:// 
www.mormonmentality.org u/p previewer. The typo/lighttpd version is  
still a work in progress (I hope to have it mostly wrapped up this  
weekend), and it is at http://beta.mormonmentality.org u/p betauser .

So far, I think typo is pretty slick. I'm interested in contributing,  
and I see that the 4.0 release is nearing completion. I take it that  
this means that the time is nearing on deciding new features for the  
post-4.0 release. There are a couple of things that I intend to add  
to my version in the next week or two:

1. introduce user privilege levels and user types. My blog is going  
to be a large group blog, and I will need this sooner rather than  
later. (This is the one gap between typo and wordpress that is an  
absolute obstacle to long term deployment.)

I have a few things already in mind here. I can go into it in some  
detail if you all are ready for a proposal.

2. ability to have a right sidebar and a left sidebar (most blogs, in  
my opinion, have lines of text that are too long, and therefore too  
hard on the eyes). I'll probably start out with a hack of some sort  
and try to work it in more gracefully as I get a better handle on how  
the sidebar works.)

3. separating out some parts of the contents table for article and  
comment specific data. In my opinion, there seem to be too many  
single use fields to justify a single table for the whole set.

A fourth item that I have already implemented is an increase in the  
number of indices in the tables to make sure that common joins are  
correctly optimized.

A fifth item that I have already implemented is a short_title field  
for the contents table, along with a one line change to the  
appropriate admin page.

The sql to change this is as follows:

alter table contents add column short_title varchar(60) default NULL  
after title;

the changes to the admin page at app/views/admin/content/_form.rhtml  
involve inserting the following 4 lines at line 8:

  8  <p>
  9    <label for="article_short_title">Short Title:</label><br />
10    <%= text_field 'article', 'short_title'  %>
11  </p>

This allows for  a short version of the title to be specified for  
places where an abbreviation is appropriate. This is especially  
advantageous for elements in the sidebar which may want a meaningful  
abridgment of the name due to space constraints. Specifically, I have  
a latest_comments plugin that uses it that has the following controller:

class Plugins::Sidebars::LatestCommentsController <  
Sidebars::ComponentPlugin

     setting :title,     "Latest Comments", :label => "Title"
     setting :count,     20, :label => "Number of Comments"
     setting :show_comment_author,  true, :label => "Show Comment  
Author", :input_type => :checkbox
     setting :show_article_title,   true, :label => "Show Article  
Title", :input_type => :checkbox
# not used yet
#    setting :link_to_more,   true, :label => "Link to More Comments  
(requires comments page)", :input_type => :checkbox

     def self.display_name
         "Latest Comments"
     end

     def self.description
         "Links to the latest comments"
     end

     def content
         begin
             @articles = Article.find( :all,
                           :select       => "contents.*,  
comments.author AS comment_author, comments.id AS comment_id",
                           :joins        => 'LEFT JOIN contents AS  
comments ON comments.article_id = contents.id',
                           :conditions   => 'comments.type = "Comment"',
                           :order        => "comments.created_at DESC",
                           :limit        => @sb_config['count'])
         rescue Exception => e
             logger.info e
             nil
         end
     end

end

(This is my first typo sidebar thing, so excuse any egregious errors  
or omissions)

Then it has a default display that looks like this:

<h3><%=h title %></h3>
<% if @articles.empty? -%>
     <ul id="latest_comments">
         <li>No Comments</li>
     </ul>
<% else %>
     <ul id="latest_comments">
         <li>Last: <%=
                         # I realize that this is a pretty cloogey way
                         # to do the date, but I'm not great with the
                         # rails date thingies yet
                         d = @articles.first.created_at
                         p = d.strftime("%p").downcase
                         i = d.strftime("%I").to_i.to_s
                         m = d.strftime("%M").to_i.to_s
                         t = d.strftime("%a, %b %e")
                         "#{t}, #{i}:#{m}#{p}" %></li>
         <%  @articles.each do | article |
             title = ''
             title << "#{article.comment_author}: " if  
show_comment_author
             linked_title = ''
             if show_article_title
                 # this works for now, but it should be simplified using
                 # the coalesce function in the content method of the
                 # controller and offering an option in the  
controller to
                 # use short_title
                 if article.short_title.to_s.empty?
                     linked_title << (article.title.to_s.empty? ?  
'[no title]' : article.title)
                 else
                     linked_title << article.short_title.to_s
                 end
             end
             url = "#{article_url(article)}#comment-# 
{article.comment_id}"
         %>
         <li><%= link_to(title, url) %></li>
         <% end %>
     </ul>
<% end -%>

I'm new to all of this and new to this community. What's the best way  
to work out these kinds of additions?

-------------------------------------------------------
   David King Landrith
    (w) 617.227.4469x213
    (h) 617.696.7133

   One useless man is a disgrace, two
   are called a law firm, and three or more
   become a congress   -- John Adams
-------------------------------------------------------
public key available upon request




_______________________________________________
Typo-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/typo-list

Reply via email to