Feedback on some new features I'm working on

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.

  1. 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.)

  2. 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


9 Short Title:

10 <%= text_field ‘article’, ‘short_title’ %>
11

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:

<%=h title %>

<% if @articles.empty? -%>
  • No Comments
<% else %>
  • 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}" %>
  • <% @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 <
  • <%= link_to(title, url) %>
  • <% end %>
<% 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 L.
(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

On 7/6/06, David King L. [email protected] wrote:

  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.)

It’s on the roadmap, as is integration with OpenID. No one has really
started on it, though.

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.

  1. 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.)

A few people have requested this. It’ll break all of our current
themes,
though, and it’ll make a mess of our sidebar editor, which was a pain to
get
to the state it’s in now. On the other hand, it’s probably not that
hard to
support an arbitrary number of sidebars.

  1. 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.

That’s going to cause a world of hurt. Really.

We need to refactor some of the fields out–there are quite a few
redundant
fields, or things that we can move into the serialized column because
they’re rare. But breaking things back out will break a lot of code
reuse,
and it’s all been nasty code to get right.

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.

Yeah. I found a 6-second query today in a module I’d never used. Then
I
accidentally blew away my test DB while trying to fix it.

involve inserting the following 4 lines at line 8:
a latest_comments plugin that uses it that has the following controller:

not used yet

     rescue Exception => e

Then it has a default display that looks like this:
# to do the date, but I’m not great with the
show_comment_author
else
linked_title << article.short_title.to_s
end
end
url = “#{article_url(article)}#comment-#
{article.comment_id}”
%>

  • <%= link_to(title, url) %>

  • <% end %>

    <% end -%>

    I’m not sure if this is generally useful or not. I’d like to avoid
    adding
    non-metaweb API fields where we can, although I have a few of my own
    that
    will probably go into 4.1 if I can keep them from being hideously ugly.
    What’s the point of having a title that’s too long to display?

    I’m new to all of this and new to this community. What’s the best way

    to work out these kinds of additions?

    By and large, sending mail here works as well as anything. I’m going to
    add
    a few milestone-4.1 to-do items to Trac soon. Other then that, send
    patches
    via Trac. Patches with tests attached are more likely to be merged.
    Patches that change major pieces of code without tests will probably sit
    for
    months, if they get merged at all. Core pieces, like multiuser support
    or
    anything that makes changes to the contents table should probably be
    discussed a bit first.

    Scott

    On Jul 7, 2006, at 12:34 AM, Scott L. wrote:

    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.

    I’m not sure if this is generally useful or not. I’d like to avoid
    adding non-metaweb API fields where we can, although I have a few
    of my own that will probably go into 4.1 if I can keep them from
    being hideously ugly. What’s the point of having a title that’s
    too long to display?

    Well, most titles can be meaningfully abridged. For example, a title
    like “The Extremes of Good and Evil” is not unduly long, but will
    almost always wrap in a recent comments sidebar that is formatted:
    : . So that abridging it to “Extremes of Good &
    Evil” or even just “Extremes” for that kind of display is useful.
    Another example would be “Movie Review: The Life Aquatic” which could
    be meaningfully abridged to “Life Aquatic,” though there is good
    reason for maintaining a longer title for the main article.
    Basically, the title of a post is something that should be
    informative in its own right, but the entry in the sidebar need do
    nothing more than simply refer to that title. Thus, it’s appropriate
    to consider them two separate entities.

    When I used a wordpress blog, I just used the “excerpt” field for
    this purpose, because there was no known use for the field as far as
    I could determine. I got several inquiries about how I managed to
    maintain two different titles for dispaly in the recent comments
    section (and the most commented articles section), and Be-Revolution
    supports this as a standard feature, so I’m fairly sure that there
    are those who would use it.


    David King L.
    (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

    This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

    | Privacy Policy | Terms of Service | Remote Ruby Jobs