public
Description: The kick ass (non-commercial) home for musicians and their music
Homepage: http://alonetone.com
Clone URL: git://github.com/sudara/alonetone.git
forums!
sudara (author)
Wed Jun 18 04:03:29 -0700 2008
commit  85e821f31be90e1b157408ce591e3e2e85b6d40d
tree    6d0e006dd8248e42b36df0a4d89eb176e0fa0a5f
parent  c48b6e74c2b184e1dd18ba9a87673b6686a12a17
...
13
14
15
16
 
17
18
19
...
33
34
35
 
 
 
36
37
38
...
95
96
97
 
 
 
 
 
 
 
 
98
99
100
...
13
14
15
 
16
17
18
19
...
33
34
35
36
37
38
39
40
41
...
98
99
100
101
102
103
104
105
106
107
108
109
110
111
0
@@ -13,7 +13,7 @@ class ApplicationController < ActionController::Base
0
   before_filter :set_latest_update_title
0
   
0
   # let ActionView have a taste of our authentication
0
- helper_method :current_user, :logged_in?, :admin?, :last_active
0
+ helper_method :current_user, :logged_in?, :admin?, :last_active, :current_page, :moderator?
0
   
0
   
0
   rescue_from ActiveRecord::RecordNotFound, :with => :show_error
0
@@ -33,6 +33,9 @@ class ApplicationController < ActionController::Base
0
   end
0
   
0
   
0
+ def current_page
0
+ @page ||= params[:page].blank? ? 1 : params[:page].to_i
0
+ end
0
   
0
   protected
0
   
0
@@ -95,6 +98,14 @@ class ApplicationController < ActionController::Base
0
   
0
   # authorization tricks
0
   
0
+ def moderator?
0
+ logged_in? && current_user.moderator?
0
+ end
0
+
0
+ def admin_required
0
+ login_required && admin?
0
+ end
0
+
0
   def admin_or_owner(record=current_user)
0
     admin? || (!%w(destroy admin edit update).include?(action_name) && (params[:login].nil? || params[:login] == record.login))
0
   end
...
1
 
 
2
3
4
5
 
 
 
 
6
7
8
...
13
14
15
16
 
 
 
17
18
19
 
 
 
20
21
22
...
34
35
36
37
 
38
39
40
...
57
58
59
60
 
61
62
63
...
74
75
76
77
 
78
79
80
81
 
82
83
84
...
1
2
3
4
5
6
 
7
8
9
10
11
12
13
...
18
19
20
 
21
22
23
24
25
 
26
27
28
29
30
31
...
43
44
45
 
46
47
48
49
...
66
67
68
 
69
70
71
72
...
83
84
85
 
86
87
88
89
 
90
91
92
93
0
@@ -1,8 +1,13 @@
0
 class ForumsController < ApplicationController
0
+ before_filter :admin_required, :except => [:index, :show]
0
+
0
   # GET /forums
0
   # GET /forums.xml
0
   def index
0
- @forums = Forum.find(:all)
0
+ # reset the page of each forum we have visited when we go back to index
0
+ session[:forums_page] = nil
0
+
0
+ @forums = Forum.ordered
0
 
0
     respond_to do |format|
0
       format.html # index.html.erb
0
@@ -13,10 +18,14 @@ class ForumsController < ApplicationController
0
   # GET /forums/1
0
   # GET /forums/1.xml
0
   def show
0
- @forum = Forum.find(params[:id])
0
+ @forum = Forum.find_by_permalink(params[:id])
0
+ (session[:forums] ||= {})[@forum.id] = Time.now.utc
0
+ (session[:forums_page] ||= Hash.new(1))[@forum.id] = current_page if current_page > 1
0
 
0
     respond_to do |format|
0
- format.html # show.html.erb
0
+ format.html do # show.html.erb
0
+ @topics = @forum.topics.paginate :page => current_page
0
+ end
0
       format.xml { render :xml => @forum }
0
     end
0
   end
0
@@ -34,7 +43,7 @@ class ForumsController < ApplicationController
0
 
0
   # GET /forums/1/edit
0
   def edit
0
- @forum = Forum.find(params[:id])
0
+ @forum = Forum.find_by_permalink(params[:id])
0
   end
0
 
0
   # POST /forums
0
@@ -57,7 +66,7 @@ class ForumsController < ApplicationController
0
   # PUT /forums/1
0
   # PUT /forums/1.xml
0
   def update
0
- @forum = Forum.find(params[:id])
0
+ @forum = Forum.find_by_permalink(params[:id])
0
 
0
     respond_to do |format|
0
       if @forum.update_attributes(params[:forum])
0
@@ -74,11 +83,11 @@ class ForumsController < ApplicationController
0
   # DELETE /forums/1
0
   # DELETE /forums/1.xml
0
   def destroy
0
- @forum = Forum.find(params[:id])
0
+ @forum = Forum.find_by_permalink(params[:id])
0
     @forum.destroy
0
 
0
     respond_to do |format|
0
- format.html { redirect_to(forums_url) }
0
+ format.html { redirect_to(forums_path) }
0
       format.xml { head :ok }
0
     end
0
   end
...
1
2
3
4
5
 
 
6
 
7
8
9
 
 
 
 
 
10
11
 
 
 
12
13
14
15
16
17
18
19
20
 
 
 
 
 
 
 
 
 
 
 
21
22
23
24
25
26
27
28
29
30
31
 
32
33
34
35
36
37
38
39
40
41
42
43
 
44
45
46
47
48
49
50
 
51
52
 
 
 
 
 
53
54
55
56
57
58
59
60
61
 
62
63
 
64
65
 
66
67
68
69
 
70
71
72
73
74
75
76
77
78
79
80
81
 
82
83
84
 
 
 
 
 
 
 
 
 
85
...
1
 
 
 
 
2
3
4
5
6
 
 
7
8
9
10
11
12
13
14
15
16
17
 
 
18
 
 
19
 
 
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
 
34
35
36
37
38
 
39
40
41
42
 
 
 
 
 
 
 
43
 
44
45
46
 
 
 
 
 
47
48
 
49
50
51
52
53
54
55
56
57
 
 
58
 
 
59
60
 
61
62
 
63
64
65
66
 
67
68
69
70
71
 
 
72
 
73
74
75
 
76
77
78
79
80
81
82
83
84
85
86
87
88
89
0
@@ -1,85 +1,89 @@
0
 class TopicsController < ApplicationController
0
- # GET /topics
0
- # GET /topics.xml
0
- def index
0
- @topics = Topic.find(:all)
0
+ before_filter :find_forum
0
+ before_filter :find_topic, :only => [:show, :edit, :update, :destroy]
0
 
0
+ def index
0
     respond_to do |format|
0
- format.html # index.html.erb
0
- format.xml { render :xml => @topics }
0
+ format.html { redirect_to forum_path(@forum) }
0
+ format.xml do
0
+ @topics = find_forum.topics.paginate(:page => current_page)
0
+ render :xml => @topics
0
+ end
0
     end
0
   end
0
+
0
+ def edit
0
+ end
0
 
0
- # GET /topics/1
0
- # GET /topics/1.xml
0
   def show
0
- @topic = Topic.find(params[:id])
0
-
0
     respond_to do |format|
0
- format.html # show.html.erb
0
- format.xml { render :xml => @topic }
0
+ format.html do
0
+ if logged_in?
0
+ update_last_seen_at
0
+ (session[:topics] ||= {})[@topic.id] = Time.now.utc
0
+ end
0
+
0
+ @topic.hit! unless logged_in? && @topic.user_id == current_user.id
0
+ @posts = @topic.posts.paginate :page => current_page
0
+ @post = Post.new
0
+ end
0
+ format.xml { render :xml => @topic }
0
     end
0
   end
0
 
0
- # GET /topics/new
0
- # GET /topics/new.xml
0
   def new
0
     @topic = Topic.new
0
 
0
     respond_to do |format|
0
       format.html # new.html.erb
0
- format.xml { render :xml => @topic }
0
+ format.xml { render :xml => @topic }
0
     end
0
   end
0
 
0
- # GET /topics/1/edit
0
- def edit
0
- @topic = Topic.find(params[:id])
0
- end
0
-
0
- # POST /topics
0
- # POST /topics.xml
0
   def create
0
- @topic = Topic.new(params[:topic])
0
+ @topic = current_user.post @forum, params[:topic]
0
 
0
     respond_to do |format|
0
- if @topic.save
0
- flash[:notice] = 'Topic was successfully created.'
0
- format.html { redirect_to(@topic) }
0
- format.xml { render :xml => @topic, :status => :created, :location => @topic }
0
- else
0
+ if @topic.new_record?
0
         format.html { render :action => "new" }
0
- format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }
0
+ format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }
0
+ else
0
+ flash[:notice] = 'Topic was successfully created.'
0
+ format.html { redirect_to(forum_topic_path(@forum, @topic)) }
0
+ format.xml { render :xml => @topic, :status => :created, :location => forum_topic_url(@forum, @topic) }
0
       end
0
     end
0
   end
0
 
0
- # PUT /topics/1
0
- # PUT /topics/1.xml
0
   def update
0
- @topic = Topic.find(params[:id])
0
-
0
+ current_user.revise @topic, params[:topic]
0
     respond_to do |format|
0
- if @topic.update_attributes(params[:topic])
0
+ if @topic.errors.empty?
0
         flash[:notice] = 'Topic was successfully updated.'
0
- format.html { redirect_to(@topic) }
0
+ format.html { redirect_to(forum_topic_path(@forum, @topic)) }
0
         format.xml { head :ok }
0
       else
0
         format.html { render :action => "edit" }
0
- format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }
0
+ format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }
0
       end
0
     end
0
   end
0
 
0
- # DELETE /topics/1
0
- # DELETE /topics/1.xml
0
   def destroy
0
- @topic = Topic.find(params[:id])
0
     @topic.destroy
0
 
0
     respond_to do |format|
0
- format.html { redirect_to(topics_url) }
0
+ format.html { redirect_to(@forum) }
0
       format.xml { head :ok }
0
     end
0
   end
0
+
0
+protected
0
+ def find_forum
0
+ @forum = Forum.find_by_permalink(params[:forum_id])
0
+ end
0
+
0
+ def find_topic
0
+ @topic = @forum.topics.find_by_permalink(params[:id])
0
+ end
0
 end
...
99
100
101
 
 
 
 
102
103
...
99
100
101
102
103
104
105
106
107
0
@@ -99,5 +99,9 @@ module ApplicationHelper
0
     logged_in? ? '' : (link_to '(login for this option)', login_path)
0
   end
0
   
0
+ def feed_icon_tag(title, url)
0
+ (@feed_icons ||= []) << { :url => url, :title => title }
0
+ link_to image_tag('feed-icon.png', :size => '14x14', :alt => "Subscribe to #{title}"), url
0
+ end
0
   protected
0
 end
...
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
0
@@ -1,2 +1,57 @@
0
 module ForumsHelper
0
+ def pagination(collection)
0
+ if collection.total_pages > 1
0
+ "<p class='pages'>" + 'Pages'[:pages_title] + ": <strong>" +
0
+ will_paginate(collection, :inner_window => 10, :next_label => "next"[], :prev_label => "previous"[]) +
0
+ "</strong></p>"
0
+ end
0
+ end
0
+
0
+ def next_page(collection)
0
+ unless collection.current_page == collection.total_pages or collection.total_pages == 0
0
+ "<p style='float:right;'>" + link_to("Next page"[], { :page => collection.current_page.next }.merge(params.reject{|k,v| k=="page"})) + "</p>"
0
+ end
0
+ end
0
+
0
+ def search_posts_title
0
+ returning(params[:q].blank? ? 'Recent Posts'[] : "Searching for"[] + " '#{h params[:q]}'") do |title|
0
+ title << " "+'by {user}'[:by_user,h(@user.display_name)] if @user
0
+ title << " "+'in {forum}'[:in_forum,h(@forum.name)] if @forum
0
+ end
0
+ end
0
+
0
+ def topic_title_link(topic, options)
0
+ if topic.title =~ /^\[([^\]]{1,15})\]((\s+)\w+.*)/
0
+ "<span class='flag'>#{$1}</span>" +
0
+ link_to(h($2.strip), forum_topic_path(@forum, topic), options)
0
+ else
0
+ link_to(h(topic.title), forum_topic_path(@forum, topic), options)
0
+ end
0
+ end
0
+
0
+ # used to know if a topic has changed since we read it last
0
+ def recent_topic_activity(topic)
0
+ return false unless logged_in?
0
+ return topic.last_updated_at > ((session[:topics] ||= {})[topic.id] || (session[:last_active] ||= Time.now.utc))
0
+ end
0
+
0
+ # used to know if a forum has changed since we read it last
0
+ def recent_forum_activity(forum)
0
+ return false unless logged_in? && forum.recent_topic
0
+ return forum.recent_topic.last_updated_at > ((session[:forums] ||= {})[forum.id] || (session[:last_active] ||= Time.now.utc))
0
+ end
0
+
0
+ def topic_count(topics)
0
+ pluralize topics.size, 'topic'
0
+ end
0
+
0
+ def post_count(posts)
0
+ pluralize posts.size, 'post'
0
+ end
0
+
0
+ # Ripe for optimization
0
+ def voice_count
0
+ pluralize current_site.topics.to_a.sum { |t| t.voice_count }, 'voice'
0
+ end
0
+
0
 end
...
8
9
10
 
11
12
13
...
22
23
24
25
26
27
28
29
30
...
8
9
10
11
12
13
14
...
23
24
25
 
 
 
26
27
28
0
@@ -8,6 +8,7 @@ class Forum < ActiveRecord::Base
0
   validates_presence_of :name
0
     
0
   has_permalink :name
0
+ before_save :create_unique_permalink
0
   
0
   attr_readonly :posts_count, :topics_count
0
 
0
@@ -22,9 +23,6 @@ class Forum < ActiveRecord::Base
0
 
0
   has_many :posts, :order => "#{Post.table_name}.created_at DESC", :dependent => :delete_all
0
   has_one :recent_post, :order => "#{Post.table_name}.created_at DESC", :class_name => 'Post'
0
-
0
- has_many :moderatorships, :dependent => :delete_all
0
- has_many :moderators, :through => :moderatorships, :source => :user
0
   
0
   def to_param
0
     permalink
...
21
22
23
24
25
26
27
28
29
...
33
34
35
 
36
37
38
...
21
22
23
 
 
 
24
25
26
...
30
31
32
33
34
35
36
0
@@ -21,9 +21,6 @@ class Topic < ActiveRecord::Base
0
   
0
   has_many :voices, :through => :posts, :source => :user, :uniq => true
0
   
0
- has_many :monitorships, :dependent => :delete_all
0
- has_many :monitoring_users, :through => :monitorships, :source => :user, :conditions => {"#{Monitorship.table_name}.active" => true}
0
-
0
   validates_presence_of :user_id, :forum_id, :title
0
   validates_presence_of :body, :on => :create
0
 
0
@@ -33,6 +30,7 @@ class Topic < ActiveRecord::Base
0
   attr_readonly :posts_count, :hits
0
   
0
   has_permalink :title
0
+ before_save :create_unique_permalink
0
 
0
   def sticky?
0
     sticky == 1
...
1
2
 
3
4
5
...
59
60
61
 
 
 
 
62
63
64
...
1
 
2
3
4
5
...
59
60
61
62
63
64
65
66
67
68
0
@@ -1,5 +1,5 @@
0
 class User < ActiveRecord::Base
0
- concerned_with :validation, :findability, :profile, :statistics
0
+ concerned_with :validation, :findability, :profile, :statistics, :posting
0
   
0
   named_scope :musicians, {:conditions => ['assets_count > ?',0], :order => 'assets_count DESC', :include => :pic}
0
   named_scope :activated, {:conditions => {:activation_code => nil}, :order => 'created_at DESC', :include => :pic}
0
@@ -59,6 +59,10 @@ class User < ActiveRecord::Base
0
     super
0
   end
0
   
0
+ def moderator?
0
+ (self[:moderator] == true)
0
+ end
0
+
0
   protected
0
   
0
   def make_first_user_admin
...
1
 
2
3
4
5
6
7
8
9
10
11
12
 
 
 
 
 
 
13
...
 
1
2
 
 
 
 
 
 
 
 
 
 
3
4
5
6
7
8
9
0
@@ -1,12 +1,8 @@
0
-<h1>Editing forum</h1>
0
+<h1>Edit Forum</h1>
0
 
0
-<% form_for(@forum) do |f| %>
0
- <%= f.error_messages %>
0
-
0
- <p>
0
- <%= f.submit "Update" %>
0
- </p>
0
-<% end %>
0
-
0
-<%= link_to 'Show', @forum %> |
0
-<%= link_to 'Back', forums_path %>
0
+<% form_for :forum,
0
+ :url => forum_path(@forum),
0
+ :html => { :method => :put } do |f| -%>
0
+<%= render :partial => "form", :object => f %>
0
+<%= submit_tag 'Save Forum'%> or <%= link_to('Cancel', forums_path) %>
0
+<% end -%>
0
\ No newline at end of file
...
1
 
 
 
 
 
 
2
3
4
5
 
 
 
6
7
8
9
10
11
12
13
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
16
 
 
 
 
 
 
 
 
 
 
17
18
 
 
 
 
19
...
 
1
2
3
4
5
6
7
 
 
 
8
9
10
11
 
 
 
 
 
 
 
 
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
40
41
42
43
44
45
46
47
48
49
50
 
51
52
53
54
55
0
@@ -1,18 +1,54 @@
0
-<h1>Listing forums</h1>
0
+<% render :layout => 'forums' do %>
0
+ <% content_for :h1 do %>alonetone Forums <% end %>
0
+
0
+ <% if admin? %>
0
+ <%= link_to "Create New Forum", new_forum_path, :class => 'new button' %>
0
+ <% end %>
0
 
0
-<table>
0
- <tr>
0
- </tr>
0
+ <% content_for :extras do %>
0
+ <%= feed_icon_tag "Recent Posts", formatted_posts_path(:format => 'rss') %>
0
+ <% end %>
0
 
0
-<% for forum in @forums %>
0
- <tr>
0
- <td><%= link_to 'Show', forum %></td>
0
- <td><%= link_to 'Edit', edit_forum_path(forum) %></td>
0
- <td><%= link_to 'Destroy', forum, :confirm => 'Are you sure?', :method => :delete %></td>
0
- </tr>
0
-<% end %>
0
-</table>
0
+ <table border="0" cellspacing="0" cellpadding="0" class="wide forums">
0
+ <tr>
0
+ <th class="la" width="70%" colspan="3"><%= 'Forum' %></th>
0
+ <th class="la" width="30%" colspan="1"><%= 'Last Post'%></th>
0
+ </tr>
0
+ <% for forum in @forums do %>
0
+ <tr class="<%= cycle 'even', 'odd' %>">
0
+ <td class="vat c1">
0
+
0
+ <% if recent_forum_activity(forum) %>
0
+ <%= image_tag "forum/unread.png", :class => "icon green", :title => 'Recent activity' %>
0
+ <% else %>
0
+ <%= image_tag "forum/read.png", :class => "icon grey", :title => 'No recent activity' %>
0
+ <% end %>
0
+ </td>
0
+ <td class="c2 vat">
0
+ <%= link_to h(forum.name), forum_path(forum), :class => "title" %>
0
+ <div class="posts">
0
+ <%= pluralize forum.topics.size, 'topic' %>,
0
+ <%= pluralize forum.posts.size, 'post' %>
0
+ </div>
0
+ <p class="desc"><%= forum.description_html %>
0
+ </p>
0
+ </td>
0
+ <td class="c3">
0
+ <%= link_to 'Edit', edit_forum_path(forum), :class => "tiny", :rel => "directory", :style => "float:right" if admin? %>
0
+ </td>
0
 
0
-<br />
0
+ <td class="inv lp">
0
+ <% if forum.recent_post -%>
0
+ <%= forum.recent_post.created_at %><br />
0
+ <%= "by #{h(forum.recent_post.user.display_name)}" %>
0
+ <span>(<%= link_to 'view', forum_topic_path(forum, forum.recent_post.topic, :page => forum.recent_post.topic.last_page, :anchor => dom_id(forum.recent_post)) %>)</span>
0
+ <% end -%>
0
+ </td>
0
+ </tr>
0
+ <% end %>
0
+ </table>
0
 
0
-<%= link_to 'New forum', new_forum_path %>
0
+ <p>
0
+ <%= link_to 'Recent posts', posts_path %>
0
+ </p>
0
+<% end %>
0
\ No newline at end of file
...
1
 
 
 
2
3
4
 
5
6
7
8
9
10
11
 
 
 
 
12
...
 
1
2
3
4
 
 
5
6
 
 
 
 
 
 
7
8
9
10
11
0
@@ -1,11 +1,10 @@
0
-<h1>New forum</h1>
0
+<div class="crumbs">
0
+ <%= link_to "Forums", forums_path %> <span class="arrow">&rarr;</span>
0
+</div>
0
 
0
-<% form_for(@forum) do |f| %>
0
- <%= f.error_messages %>
0
+<h1><%= 'New Forum'%></h1>
0
 
0
- <p>
0
- <%= f.submit "Create" %>
0
- </p>
0
-<% end %>
0
-
0
-<%= link_to 'Back', forums_path %>
0
+<% form_for :forum, :url => forums_path do |f| -%>
0
+<%= render :partial => "form", :object => f %>
0
+<%= submit_tag 'Create' %> or <%= link_to('Cancel', forums_path) %>
0
+<% end -%>
0
\ No newline at end of file
...
 
 
 
 
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
...
1
2
3
4
5
 
 
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
0
@@ -1,3 +1,72 @@
0
+<% render :layout => 'forums' do %>
0
+ <% content_for :h1 do %>
0
+ <%= link_to 'alonetone Forums', forums_path %> <span class="arrow">&rarr;</span> <%= @forum.name %>
0
+ <% end %>
0
 
0
-<%= link_to 'Edit', edit_forum_path(@forum) %> |
0
-<%= link_to 'Back', forums_path %>
0
+ <% @page_title = 'alonetone forums - ' + @forum.name %>
0
+
0
+ <% content_for :extras do %>
0
+ <%= feed_icon_tag @forum.name, formatted_forum_posts_path(@forum, :atom) %>
0
+ <%= pluralize @forum.topics.size, 'topics' %>,
0
+ <%= pluralize @forum.posts.size, 'posts' %>
0
+ <% end %>
0
+
0
+ <% if logged_in? %>
0
+ <p style="float:right; margin-top:0;"><%= link_to 'New topic', new_forum_topic_path(@forum), :class => "button new" %></p>
0
+ <% end %>
0
+
0
+ <% if @topics.total_pages > 1 -%>
0
+ <% content_for :pagination do %>
0
+ <%= pagination @topics %>
0
+ <% end %>
0
+ <% end -%>
0
+
0
+ <table border="0" cellspacing="0" cellpadding="0" class="wide topics">
0
+ <tr>
0
+ <th class="la" colspan="2"><%= 'Topic'%></th>
0
+ <th width="1%"><%= 'Posts'%></th>
0
+ <th width="1%"><%= 'Views'%></th>
0
+ <th class="la"><%= 'Last post'%></th>
0
+ </tr>
0
+ <% for topic in @topics %>
0
+ <tr class="hentry">
0
+ <td style="padding:5px; width:16px;" class="c1">
0
+ <%
0
+ if topic.locked?
0
+ icon = "lock"
0
+ post = ", this topic is locked."
0
+ color = "darkgrey"
0
+ end
0
+ %>
0
+ <% if recent_topic_activity(topic) %>
0
+ <%= image_tag "forum/unread.png", :class => "icon green", :title => "Recent activity #{post}" %>
0
+ <% else %>
0
+ <%= image_tag "forum/read.png", :class => "icon grey", :title => "No recent activity #{post}" %>
0
+ <% end %>
0
+ </td>
0
+ <td class="c2">
0
+ <%= "Sticky: <strong>" if topic.sticky? %>
0
+ <%= topic_title_link (topic), :class => "entry-title", :rel => "bookmark" %>
0
+ <%= "</strong>" if topic.sticky? %>
0
+ <% if topic.paged? -%>
0
+ <small><%= link_to 'last'[], forum_topic_path(@forum, topic, :page => topic.last_page) %></small>
0
+ <% end -%>
0
+ </td>
0
+ <td class="ca inv stat"><%= topic.posts.size %></td>
0
+ <td class="ca inv stat"><%= number_with_delimiter(topic.hits) %></td>
0
+ <td class="lp">
0
+ <abbr class="updated" title="<%= topic.last_updated_at.xmlschema %>"><%= (topic.last_updated_at) %></abbr>
0
+ <span class="author"><strong class="fn"><%=h topic.last_user.name if topic.last_user %></strong></span>
0
+ <span><%= link_to 'view', forum_topic_path(@forum, topic, :page => topic.last_page, :anchor => "posts-#{topic.last_post_id}") %></span>
0
+ </td>
0
+ </tr>
0
+ <% end %>
0
+ </table>
0
+
0
+ <%= next_page @topics %>
0
+ <%= pagination @topics %>
0
+
0
+ <% if logged_in? %>
0
+ <p><%= link_to 'New topic', new_forum_topic_path(@forum), :class => "button new" %></p>
0
+ <% end%>
0
+<% end %>
0
\ No newline at end of file
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@
0
   <head>
0
     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
0
     <title><%= @page_title || 'alonetone, a damn fine home for musicians. Upload mp3s and share your music.' %> - alonetone</title>
0
- <%= stylesheet_link_tag 'reset','typography', 'layout', 'nav', 'flash', 'tracks','playlists','tabs','facebox','alonetone', :cache => 'alonetone-v2'%>
0
+ <%= stylesheet_link_tag 'reset','typography', 'layout', 'nav', 'flash', 'tracks','playlists','tabs','facebox','alonetone','forums', :cache => 'alonetone-v2'%>
0
     <%= stylesheet_link_tag 'ie6' if request.env['HTTP_USER_AGENT'] and request.env['HTTP_USER_AGENT'].include? "MSIE 6.0" %>
0
         <%= '<meta name="robots" content="noindex,nofollow" />' unless request.host =~ /^http:\/\/alonetone.com|^alonetone.com/ %>
0
     <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
...
1
 
 
 
 
2
3
4
5
6
7
8
9
 
 
10
11
 
 
 
 
 
 
 
...
 
1
2
3
4
5
 
 
6
 
 
 
 
7
8
9
 
10
11
12
13
14
15
16
0
@@ -1,11 +1,16 @@
0
-<h1>New topic</h1>
0
+<div class="crumbs" xstyle="margin-top:1.1em;">
0
+ <%= link_to 'Forums', root_path %> <span class="arrow">&rarr;</span>
0
+ <%= link_to h(@forum.name), forum_path(@forum) %> <span class="arrow">&rarr;</span>
0
+</div>
0
 
0
-<% form_for(@topic) do |f| %>
0
- <%= f.error_messages %>
0
 
0
- <p>
0
- <%= f.submit "Create" %>
0
- </p>
0
-<% end %>
0
+<h1 id="new_topic"><%= 'New Topic' %></h1>
0
+<p class="subtitle">by <%= current_user.name %></p>
0
 
0
-<%= link_to 'Back', topics_path %>
0
+
0
+<%= error_messages_for :topic %>
0
+<% form_for :topic,
0
+ :url => forum_topics_path(@forum) do |f| -%>
0
+<%= render :partial => "form", :object => f %>
0
+<%= submit_tag 'Post Topic', :or => link_to('Cancel', forum_path(@forum)) %>
0
+<% end -%>
...
 
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 <