Skip to content

Commit

Permalink
Add atom posts to latest posts, forums, topics and clean up forum views
Browse files Browse the repository at this point in the history
  • Loading branch information
sudara committed Jan 3, 2009
1 parent 89d12f0 commit 6473b41
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 35 deletions.
1 change: 1 addition & 0 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def index
@show_title_and_link = true
respond_to do |format|
format.html # index.html.erb
format.atom
format.xml { render :xml => @posts }
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def index
end
# API
format.json do
users = User.musicians.find(:all,:include => :pic, :limit => 10)
users = User.musicians.find(:all,:include => :pic)
render :json => '{ records : ' + users.to_json(:methods => [:name, :type], :only => [:id,:name,:comments_count,:bio_html,:website,:login]) + '}'
end
# format.fbml do
Expand Down
2 changes: 1 addition & 1 deletion app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Comment < ActiveRecord::Base
# this helps simplify a user lookup of all comments across tracks/playlists/whatever
belongs_to :user

validates_length_of :body, :within => 1..700
validates_length_of :body, :within => 1..1000

formats_attributes :body

Expand Down
18 changes: 8 additions & 10 deletions app/views/forums/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
<% content_for :extras do %>
<%# feed_icon_tag "Recent Posts", formatted_posts_path(:format => 'rss') %>
<%= feed_icon_tag "Recent Posts", formatted_posts_path(:format => 'atom') %>
<% end %>
<% if admin? %>
<div class="additional_options_solo" >
<div class="button_wrapper" style="margin-top:-32px;">
<%= link_to "Create New Forum", new_forum_path, :class => 'new button' %>
</div>
</div>
<div class="button_wrapper" style="margin-top:-30px;">
<%= link_to " ", new_forum_path, :id => 'create_new_forum', :class => 'button' %>
</div>
<% end %>

<table border="0" cellspacing="0" cellpadding="0" class="wide forums">
Expand Down Expand Up @@ -57,10 +55,7 @@
<% end %>
</table>

<p>
<%= link_to('View Recent Posts', posts_path) if Post.first %>
</p>
<% if @online && !@online.empty?%>
<% if present? @online %>
<div class="box">
<div class="static_content" id="currently_online">
alonetoners online:
Expand All @@ -70,4 +65,7 @@
</div>
</div>
<% end %>
<div class="footer_box">
<%= link_to('', posts_path, :class=>'view_all_recent_posts', :title => 'view all recent posts') if Post.first %>
</div>
<% end %>
10 changes: 5 additions & 5 deletions app/views/forums/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<% content_for :breadcrumbs do %>
<%= link_to 'alonetone forums', forums_path %> <span class="arrow">&rarr;</span> <%= @forum.name %>
<% end %>
<% @page_title = @forum.name+ ' forum'%>
<% content_for :extras do %>
<%= pluralize @forum.topics.size, 'topics' %>,
<%= pluralize @forum.posts.size, 'posts' %>
<%# feed_icon_tag @forum.name, formatted_forum_posts_path(@forum, :atom)%>
<%= feed_icon_tag @forum.name, formatted_forum_posts_path(@forum, :atom)%>
<% end %>

<table border="0" cellspacing="0" cellpadding="0" class="wide topics">
Expand Down Expand Up @@ -59,9 +59,9 @@

<div class="forum_paginator clearfix">
<%= pagination @topics %>
<div class="button_wrapper">
<%= link_to 'New topic', new_forum_topic_path(@forum), :class => "button new" %></p>
</div>
</div>
<div class="footer_box">
<%= link_to ' ', new_forum_topic_path(@forum), :id => "create_new_topic", :class => 'margin1px', :title => 'Start a new forum topic' %></p>
</div>

<% end %>
8 changes: 4 additions & 4 deletions app/views/playlists/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<div class="button_wrapper">
<%= link_to " ", new_user_playlist_path(@user), :id => 'create_new_playlist', :class => 'button' %>
</div>
<% if @user.playlists.public.size > 2 %>
<div class="button_wrapper">
<%= link_to " ", sort_user_playlists_path(@user), :id => 'change_playlist_order', :class => 'button' %>
</div>
<% if @user.playlists.public.size > 1 %>
<div class="button_wrapper">
<%= link_to " ", sort_user_playlists_path(@user), :id => 'change_playlist_order', :class => 'button' %>
</div>
<% end %>
</div>
<% end %>
Expand Down
22 changes: 22 additions & 0 deletions app/views/posts/index.atom.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
xml.instruct! :xml, :version => "1.0"
xml.feed(:xmlns => "http://www.w3.org/2005/Atom") do |feed|
feed.title "Posts for #{["alonetone forums", @forum.try(:name), @topic.try(:title)].compact * ' > '}"
feed.link :href => request.url
feed.updated((@posts.first || @topic || current_site).created_at.to_s(:rfc3339))
feed.id request.url
for post in @posts do
feed.entry do |entry|
entry.id forum_topic_url(post.topic.forum, post.topic,
:anchor => dom_id(post))
entry.title post.topic.title
entry.content post.body
entry.updated post.updated_at.to_s(:rfc3339)
entry.link :href => forum_topic_url(post.topic.forum, post.topic,
:anchor => dom_id(post))

entry.author do |author|
author.name post.user.name
end
end
end
end
20 changes: 13 additions & 7 deletions app/views/topics/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<% render :layout => 'forums/forums' do %>
<% content_for :h1 do %>alonetone forums: Starting a new topic <% end %>
<% content_for :breadcrumbs do %>
<%= link_to 'Forums', forums_path %> <span class="arrow">&rarr;</span>
<%= link_to h(@forum.name), forum_path(@forum) %> <span class="arrow">&rarr;</span> New Topic
<%= link_to 'Forums', forums_path %> <span class="arrow">&rarr;</span>
<%= link_to h(@forum.name), forum_path(@forum) %> <span class="arrow">&rarr;</span> New Topic
<% end %>

<h1 id="new_topic"><%= "Start a New Topic" %></h1>

<h1 id="new_topic"><%= 'New Topic' %></h1>
<p class="subtitle">by <%= current_user.name %></p>


<div class="container static_content">
<p class="subtitle">Post will be by <%= current_user.name %> in the "<%= @forum.name %>" forum</p>
<%= error_messages_for :topic %>
<% form_for :topic,
:url => forum_topics_path(@forum) do |f| -%>
<%= render :partial => "form", :object => f %>
<%= submit_tag 'Post Topic', :or => link_to('Cancel', forum_path(@forum)) %>
<div class="submit_wrapper">
<%= submit_tag 'Post Topic', :or => link_to('Cancel', forum_path(@forum)) %>
</div>
<% end -%>
<%= render :partial => 'posts/formatting' %>

</div>

<% end %>
2 changes: 1 addition & 1 deletion app/views/topics/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<% content_for :extras do %>
<%= pluralize @topic.posts.size, 'post' %>,
<%= pluralize @topic.voices.size, 'person' %> talking
<%# feed_icon_tag @topic.title, formatted_forum_topic_path(@forum, @topic, :rss) %>
<%= feed_icon_tag @topic.title, formatted_posts_path(:atom,:forum_id => @forum, :topic_id => @topic) %>
<% end %>

Expand Down
18 changes: 12 additions & 6 deletions config/mongrel_cluster.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
---
docroot: /home/alonetone.com/web/alonetone/current/
log_file: /home/alonetone.com/web/alonetone/current/log/mongrel.log
port: "8000"
environment: production
pid_file: /home/alonetone.com/web/alonetone/current/tmp/pids/mongrel.pid
servers: 4
port: 5000
servers: 3
docroot: public
environment: production
cwd: /data/alonetone/current
log_file: /var/log/engineyard/mongrel/alonetone/mongrel.log
pid_file: /var/run/mongrel/alonetone/mongrel.pid
user: alonetone
group: alonetone



Binary file added public/images/icons/create_new_forum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/icons/create_new_topic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/icons/follow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/icons/view_all_recent_posts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions public/stylesheets/sass/typography.sass
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ div.footer_box
:background-position -165px 0px
&:active
:background-position -330px 0px
a.view_all_recent_posts
:width 197px
:background transparent url(../images/icons/view_all_recent_posts.png) no-repeat 0px 0px
&:hover
:background-position -197px 0px
&:active
:background-position -394px 0px

a.edit_green, a.delete_green
:display block
Expand Down Expand Up @@ -383,6 +390,7 @@ a.alonetone_plus_link
:height 32px
:margin-left 20px

// CREATE BUTTONS (grey/black)
#create_new_playlist
:width 185px
:height 32px
Expand All @@ -402,6 +410,29 @@ a.alonetone_plus_link
:background-position -203px
&:active
:background-position -406px

#create_new_topic
:width 164px
:height 32px
:display block
:background transparent url(../images/icons/create_new_topic.png) no-repeat 0px 0px
&:hover
:background-position -164px
&:active
:background-position -328px

#create_new_forum
:width 174px
:height 32px
:display block
:background transparent url(../images/icons/create_new_forum.png) no-repeat 0px 0px
&:hover
:background-position -174px
&:active
:background-position -348px




a.button
&.unspam, &.spam, &.delete_comment
Expand Down
1 change: 1 addition & 0 deletions vendor/plugins/haml/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
require 'haml' # From gem
end

# Load Haml and Sass
Haml.init_rails(binding)

0 comments on commit 6473b41

Please sign in to comment.