Browse files

Add atom posts to latest posts, forums, topics and clean up forum views

  • Loading branch information...
1 parent 89d12f0 commit 6473b41e995e0d682871bd46650e584133007159 @sudara sudara committed Jan 4, 2009
View
1 app/controllers/posts_controller.rb
@@ -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
View
2 app/controllers/users_controller.rb
@@ -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
View
2 app/models/comment.rb
@@ -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
View
18 app/views/forums/index.html.erb
@@ -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">
@@ -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:
@@ -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 %>
View
10 app/views/forums/show.html.erb
@@ -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">
@@ -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 %>
View
8 app/views/playlists/index.html.erb
@@ -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 %>
View
22 app/views/posts/index.atom.builder
@@ -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
View
20 app/views/topics/new.html.erb
@@ -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 %>
View
2 app/views/topics/show.html.erb
@@ -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 %>
View
18 config/mongrel_cluster.yml
@@ -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
+
+
+
View
BIN public/images/icons/create_new_forum.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/icons/create_new_topic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/icons/follow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/icons/view_all_recent_posts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
31 public/stylesheets/sass/typography.sass
@@ -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
@@ -383,6 +390,7 @@ a.alonetone_plus_link
:height 32px
:margin-left 20px
+// CREATE BUTTONS (grey/black)
#create_new_playlist
:width 185px
:height 32px
@@ -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
View
1 vendor/plugins/haml/init.rb
@@ -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.