moxie_forum 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +47 -0
- data/app/controllers/moxie/admin/forums_controller.rb +71 -0
- data/app/controllers/moxie/admin_controller.rb +10 -0
- data/app/controllers/moxie/forums_controller.rb +29 -0
- data/app/controllers/moxie/posts_controller.rb +52 -0
- data/app/controllers/moxie/topics_controller.rb +63 -0
- data/app/helpers/moxie/application_helper.rb +3 -0
- data/app/helpers/moxie/forums_helper.rb +5 -0
- data/app/models/moxie/forum.rb +16 -0
- data/app/models/moxie/post.rb +34 -0
- data/app/models/moxie/topic.rb +39 -0
- data/app/views/layouts/forums.html.erb +14 -0
- data/app/views/moxie/admin/forums/_form.html.erb +28 -0
- data/app/views/moxie/admin/forums/edit.html.erb +6 -0
- data/app/views/moxie/admin/forums/index.html.erb +28 -0
- data/app/views/moxie/admin/forums/new.html.erb +5 -0
- data/app/views/moxie/admin/forums/show.html.erb +20 -0
- data/app/views/moxie/admin/index.html.erb +3 -0
- data/app/views/moxie/forums/authorization_error.html.erb +4 -0
- data/app/views/moxie/forums/index.html.erb +20 -0
- data/app/views/moxie/forums/show.html.erb +38 -0
- data/app/views/moxie/posts/_form.html.erb +51 -0
- data/app/views/moxie/posts/_post.html.erb +23 -0
- data/app/views/moxie/topics/_form.html.erb +50 -0
- data/app/views/moxie/topics/new.html.erb +1 -0
- data/app/views/moxie/topics/show.html.erb +12 -0
- data/config/routes.rb +26 -0
- data/lib/application_helper.rb +24 -0
- data/lib/moxie_forum/acts_as_moxie_user/base.rb +53 -0
- data/lib/moxie_forum/engine.rb +54 -0
- data/lib/moxie_forum.rb +4 -0
- data/lib/rails/generators/moxie_forum/moxie_forum_generator.rb +76 -0
- data/lib/rails/generators/moxie_forum/templates/config.yml +5 -0
- data/lib/rails/generators/moxie_forum/templates/initializer.rb +15 -0
- data/lib/rails/generators/moxie_forum/templates/migration.rb +20 -0
- data/lib/rails/generators/moxie_forum/templates/schema.rb +43 -0
- data/lib/rails/railties/tasks.rake +8 -0
- data/lib/tasks/tasks.rb +9 -0
- data/public/images/gradient_grey.png +0 -0
- data/public/stylesheets/moxie_forum.css +223 -0
- data/test/generators/moxie_forum_generator_test.rb +10 -0
- data/test/test_helper.rb +77 -0
- data/test/unit/forum_test.rb +78 -0
- metadata +111 -0
data/README.rdoc
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
== Overview
|
2
|
+
|
3
|
+
There is lots of great forum software for PHP yet I've struggled to find great forums for Rails. With Moxieforum I set out to fix that.
|
4
|
+
|
5
|
+
This is my first plugin/gem for rails but I'm trying to take advantage of all the rails 3 goodness to make this a fantastic plugin. I want it to be effortless to install and integrate with your existing app. When MoxieForum is done, I hope the days of rewriting forum functionality for every rails app are over.
|
6
|
+
|
7
|
+
Note: this forum is a rails engine, it's not designed to run stand-alone. Instead, it assumes you have an existing rails application, with an existing user model and a mechanism for users to register and login. If that is not the case, you may want: http://github.com/krschacht/moxieforum_standalone
|
8
|
+
|
9
|
+
P.S. I've extracted a lot of useful Rails Engine stuff for other engine builders: http://github.com/krschacht/rails_3_engine_demo
|
10
|
+
|
11
|
+
== Installation
|
12
|
+
|
13
|
+
Technically all you need to do is "sudo gem install moxie_forum", but I'll walk you through the basics of integration:
|
14
|
+
|
15
|
+
Requirement: Rails v3
|
16
|
+
|
17
|
+
* sudo gem install moxie_forum
|
18
|
+
* [ edit your app's 'Gemfile' and add: ] gem 'moxie_forum'
|
19
|
+
* rails generate moxie_forum
|
20
|
+
* rails db:migrate
|
21
|
+
* rails server
|
22
|
+
|
23
|
+
You can now visit: http://localhost:3000/forums
|
24
|
+
|
25
|
+
At this point the basic forum setup is done, you can click around, however it's not actually integrated with your user model and authentication system yet so you won't be able to post. To complete that:
|
26
|
+
|
27
|
+
* Edit config/initializers/moxie_forum.rb, change :user to reflect your user model
|
28
|
+
* Edit your ActiveRecord user model and add 'acts_as_moxie_user' inside the class near the top
|
29
|
+
* Also in your user model, MoxieForum will call the following instance methods, you should override these: profile_pic, display_name, admin?, moderator?
|
30
|
+
|
31
|
+
== Features
|
32
|
+
|
33
|
+
* #1 feature - Easy integration with your existing rails app including tight integration with your existing user model and 'admin' designation for users
|
34
|
+
* Administrative interface to create multiple forums
|
35
|
+
|
36
|
+
== Future Features
|
37
|
+
|
38
|
+
Topics:
|
39
|
+
* sticky
|
40
|
+
* locked
|
41
|
+
* merge
|
42
|
+
* split
|
43
|
+
* figure out how to destroy all posts in one query instead of individual
|
44
|
+
|
45
|
+
Forum:
|
46
|
+
* allow admin-only forums
|
47
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Moxie
|
2
|
+
class Admin::ForumsController < ApplicationController
|
3
|
+
|
4
|
+
unloadable
|
5
|
+
|
6
|
+
def index
|
7
|
+
@forums = Forum.all
|
8
|
+
|
9
|
+
respond_to do |format|
|
10
|
+
format.html # index.html.erb
|
11
|
+
format.xml { render :xml => @forums }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def show
|
16
|
+
@forum = Forum.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @forum }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def new
|
25
|
+
@forum = Forum.new
|
26
|
+
|
27
|
+
respond_to do |format|
|
28
|
+
format.html # new.html.erb
|
29
|
+
format.xml { render :xml => @forum }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def edit
|
34
|
+
@forum = Forum.find(params[:id])
|
35
|
+
end
|
36
|
+
|
37
|
+
def create
|
38
|
+
@forum = Forum.new(params[:moxie_forum])
|
39
|
+
|
40
|
+
respond_to do |format|
|
41
|
+
if @forum.save
|
42
|
+
format.html { redirect_to( admin_moxie_forums_path,
|
43
|
+
:notice => 'Forum was successfully created.') }
|
44
|
+
else
|
45
|
+
format.html { render :action => "new" }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def update
|
51
|
+
@forum = Forum.find(params[:id])
|
52
|
+
|
53
|
+
respond_to do |format|
|
54
|
+
if @forum.update_attributes(params[:moxie_forum])
|
55
|
+
format.html { redirect_to( admin_moxie_forums_path, :notice => 'Forum was successfully updated.') }
|
56
|
+
else
|
57
|
+
format.html { render :action => "edit" }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def destroy
|
63
|
+
@forum = Forum.find(params[:id])
|
64
|
+
@forum.destroy
|
65
|
+
|
66
|
+
respond_to do |format|
|
67
|
+
format.html { redirect_to( admin_moxie_forums_path ) }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Moxie
|
2
|
+
class ForumsController < ApplicationController
|
3
|
+
|
4
|
+
layout 'forums'
|
5
|
+
|
6
|
+
unloadable
|
7
|
+
|
8
|
+
def index
|
9
|
+
@forums = Forum.all
|
10
|
+
|
11
|
+
respond_to do |format|
|
12
|
+
format.html # index.html.erb
|
13
|
+
format.xml { render :xml => @forums }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def show
|
18
|
+
@forum = Forum.find( params[:id] )
|
19
|
+
@topic = Topic.new
|
20
|
+
@topic.posts.build
|
21
|
+
|
22
|
+
respond_to do |format|
|
23
|
+
format.html # show.html.erb
|
24
|
+
format.xml { render :xml => @forum }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Moxie
|
2
|
+
class PostsController < ApplicationController
|
3
|
+
before_filter :require_user, :only => [ :new, :create ]
|
4
|
+
|
5
|
+
layout 'forums'
|
6
|
+
|
7
|
+
unloadable
|
8
|
+
|
9
|
+
def show
|
10
|
+
@post = Post.find( params[:id] )
|
11
|
+
|
12
|
+
respond_to do |format|
|
13
|
+
format.html # show.html.erb
|
14
|
+
format.xml { render :xml => @post }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def new
|
19
|
+
@post = Post.new
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
format.html # new.html.erb
|
23
|
+
format.xml { render :xml => @post }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def create
|
28
|
+
post_params = params[:moxie_post]
|
29
|
+
post_params[:author_id] = current_user.id
|
30
|
+
|
31
|
+
@post = Post.new( post_params )
|
32
|
+
|
33
|
+
respond_to do |format|
|
34
|
+
if @post.save
|
35
|
+
format.html { redirect_to( moxie_topic_path( @post.topic ),
|
36
|
+
:notice => 'Post was successfully created.') }
|
37
|
+
else
|
38
|
+
format.html { render :action => "new" }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def require_user
|
48
|
+
redirect_to moxie_authorization_error_path
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Moxie
|
2
|
+
class TopicsController < ApplicationController
|
3
|
+
before_filter :require_user, :only => [ :new, :create, :show_postable ]
|
4
|
+
|
5
|
+
layout 'forums'
|
6
|
+
|
7
|
+
unloadable
|
8
|
+
|
9
|
+
def show_postable
|
10
|
+
@topic = Topic.find( params[:topic_id] )
|
11
|
+
@post = Post.new
|
12
|
+
|
13
|
+
render :action => :show
|
14
|
+
end
|
15
|
+
|
16
|
+
def show
|
17
|
+
@topic = Topic.find( params[:id] )
|
18
|
+
@post = Post.new
|
19
|
+
|
20
|
+
respond_to do |format|
|
21
|
+
format.html # show.html.erb
|
22
|
+
format.xml { render :xml => @topic }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def new
|
27
|
+
@topic = Topic.new
|
28
|
+
@topic.posts.build
|
29
|
+
@forum = Forum.find( params[:forum_id] )
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
format.html # new.html.erb
|
33
|
+
format.xml { render :xml => @topic }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def create
|
38
|
+
topic_params = params[:moxie_topic]
|
39
|
+
topic_params[:author_id] = current_user.id
|
40
|
+
topic_params[:posts_attributes]['0'][:author_id] = current_user.id
|
41
|
+
|
42
|
+
@topic = Topic.new( topic_params )
|
43
|
+
@forum = Forum.find( params[:moxie_topic][:forum_id] )
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @topic.save
|
47
|
+
format.html { redirect_to( moxie_forum_path( @topic.forum ),
|
48
|
+
:notice => 'Topic was successfully created.') }
|
49
|
+
else
|
50
|
+
format.html { render :new }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def require_user
|
60
|
+
redirect_to moxie_authorization_error_path
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Moxie
|
2
|
+
class Forum < ActiveRecord::Base
|
3
|
+
set_table_name "moxie_forums"
|
4
|
+
|
5
|
+
has_many :topics
|
6
|
+
before_destroy :remove_topics
|
7
|
+
|
8
|
+
validates :title, :presence => true
|
9
|
+
|
10
|
+
def remove_topics
|
11
|
+
topics.each { |t| t.destroy }
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Moxie
|
2
|
+
class Post < ActiveRecord::Base
|
3
|
+
set_table_name "moxie_posts"
|
4
|
+
|
5
|
+
begin
|
6
|
+
user_model = MoxieForum::Engine.config.user_model_name
|
7
|
+
rescue
|
8
|
+
user_model = "user"
|
9
|
+
end
|
10
|
+
|
11
|
+
belongs_to :topic
|
12
|
+
belongs_to :author, :class_name => user_model
|
13
|
+
|
14
|
+
validates :body, :presence => true
|
15
|
+
|
16
|
+
after_create :increment_topic_post_count
|
17
|
+
before_destroy :decrement_topic_post_count
|
18
|
+
|
19
|
+
def increment_topic_post_count
|
20
|
+
return if topic.nil?
|
21
|
+
|
22
|
+
topic.post_count += 1
|
23
|
+
topic.save
|
24
|
+
end
|
25
|
+
|
26
|
+
def decrement_topic_post_count
|
27
|
+
return if topic.nil?
|
28
|
+
|
29
|
+
topic.post_count -= 1
|
30
|
+
topic.save
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Moxie
|
2
|
+
class Topic < ActiveRecord::Base
|
3
|
+
set_table_name "moxie_topics"
|
4
|
+
|
5
|
+
begin
|
6
|
+
user_model = MoxieForum::Engine.config.user_model_name
|
7
|
+
rescue
|
8
|
+
user_model = "user"
|
9
|
+
end
|
10
|
+
|
11
|
+
belongs_to :forum
|
12
|
+
belongs_to :author, :class_name => user_model
|
13
|
+
belongs_to :last_post_author, :class_name => user_model
|
14
|
+
has_many :posts
|
15
|
+
accepts_nested_attributes_for :posts
|
16
|
+
|
17
|
+
validates :title, :presence => true
|
18
|
+
|
19
|
+
after_create :increment_forum_topic_count
|
20
|
+
before_destroy :decrement_forum_topic_count
|
21
|
+
after_destroy :remove_posts
|
22
|
+
|
23
|
+
def increment_forum_topic_count
|
24
|
+
forum.topic_count += 1
|
25
|
+
forum.save
|
26
|
+
end
|
27
|
+
|
28
|
+
def decrement_forum_topic_count
|
29
|
+
forum.topic_count -= 1
|
30
|
+
forum.save
|
31
|
+
end
|
32
|
+
|
33
|
+
def remove_posts
|
34
|
+
posts.each { |p| p.destroy }
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= form_for [ :admin, @forum ] do |f| %>
|
2
|
+
<% if @forum.errors.any? %>
|
3
|
+
<div id="errorExplanation">
|
4
|
+
<h2><%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:</h2>
|
5
|
+
<ul>
|
6
|
+
<% @forum.errors.full_messages.each do |msg| %>
|
7
|
+
<li><%= msg %></li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<div class="field">
|
14
|
+
<%= f.label :title %><br />
|
15
|
+
<%= f.text_field :title %>
|
16
|
+
</div>
|
17
|
+
<div class="field">
|
18
|
+
<%= f.label :description %><br />
|
19
|
+
<%= f.text_field :description %>
|
20
|
+
</div>
|
21
|
+
<div class="field">
|
22
|
+
<%= f.label :topic_count %><br />
|
23
|
+
<%= f.text_field :topic_count %>
|
24
|
+
</div>
|
25
|
+
<div class="actions">
|
26
|
+
<%= f.submit %>
|
27
|
+
</div>
|
28
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<h1>Listing forums</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Title</th>
|
6
|
+
<th>Description</th>
|
7
|
+
<th>Num topics</th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
</tr>
|
12
|
+
|
13
|
+
<% @forums.each do |forum| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= forum.title %></td>
|
16
|
+
<td><%= forum.description %></td>
|
17
|
+
<td><%= forum.topic_count %></td>
|
18
|
+
<td><%= link_to 'Show', admin_moxie_forum_path( forum ) %></td>
|
19
|
+
<td><%= link_to 'Edit', edit_admin_moxie_forum_path( forum ) %></td>
|
20
|
+
<td><%= link_to 'Destroy', admin_moxie_forum_path( forum ),
|
21
|
+
:confirm => 'Are you sure?', :method => :delete %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</table>
|
25
|
+
|
26
|
+
<br />
|
27
|
+
|
28
|
+
<%= link_to 'New Forum', new_admin_moxie_forum_path %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<p class="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<b>Title:</b>
|
5
|
+
<%= @forum.title %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<b>Description:</b>
|
10
|
+
<%= @forum.description %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<b>Num topics:</b>
|
15
|
+
<%# @forum.num_topics %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
|
19
|
+
<%# link_to 'Edit', edit_moxie_forum_path(@forum) %> |
|
20
|
+
<%= link_to 'Back', admin_moxie_forums_path %>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<div class="m_error_msg">
|
2
|
+
Setup Problem
|
3
|
+
<p>You just tried to access a page that requires a user to be logged in. The controller had a before_filter :require_user. You need to add a require_user method to your application_controller.rb that does whatever checks necessary to determine that a user is logged in. You will also need a current_user helper method within application_controller.rb that returns the logged in user. The forum will not work correctly until you have both of these.</p>
|
4
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% @forums.each do |forum| %>
|
2
|
+
|
3
|
+
<div class="m_forum clearfix">
|
4
|
+
|
5
|
+
<div class="m_name">
|
6
|
+
<div class="m_title"><%= link_to forum.title, moxie_forum_path( forum ) %></div>
|
7
|
+
<div class="m_description">
|
8
|
+
<span class="m_topic_count"><%= pluralize forum.topic_count, moxie_topic_name %>.</span>
|
9
|
+
<%= forum.description %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="m_info">
|
14
|
+
<div class="m_topic_count"><%= pluralize forum.topic_count, moxie_topic_name %></div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<% end %>
|
20
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div class="m_nav">< <%= link_to "All #{moxie_forum_name.titleize.pluralize}",
|
2
|
+
moxie_forums_path,
|
3
|
+
:class => "always_underlined "%>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div class="m_header">
|
7
|
+
<%= @forum.title %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="m_header_links">
|
11
|
+
<%= link_to "Start a new #{moxie_topic_name}",
|
12
|
+
forum_new_moxie_topic_path( @forum ),
|
13
|
+
:class => "always_underlined action" %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div>
|
17
|
+
<% @forum.topics.each do |topic| %>
|
18
|
+
|
19
|
+
<div class="m_topic clearfix">
|
20
|
+
|
21
|
+
<div class="m_name">
|
22
|
+
<div class="m_title"><%= link_to topic.title, moxie_topic_path( topic ) %></div>
|
23
|
+
<div class="m_description">
|
24
|
+
<span class="m_topic_count"><%= pluralize topic.post_count, moxie_post_name %>.</span>
|
25
|
+
Started by <%= topic.author.full_name if topic.author %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="m_info">
|
30
|
+
<div class="m_topic_count"><%# pluralize forum.topic_count, "topic" %></div>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<%= form_for [ @post ] do |f| %>
|
2
|
+
|
3
|
+
<% if @post.errors.any? %>
|
4
|
+
<div id="errorExplanation">
|
5
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this forum from being saved:</h2>
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if current_user %>
|
15
|
+
|
16
|
+
<div class="m_post clearfix m_newpost">
|
17
|
+
<div class="m_user">
|
18
|
+
<%= current_user.profile_pic %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="m_contents">
|
22
|
+
|
23
|
+
<div class="m_body">
|
24
|
+
<div class="m_prompt field"><%= f.label :body, "Add a reply #{moxie_post_name}" %></div>
|
25
|
+
<%= f.text_area :body %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<%= hidden_field_tag 'moxie_post[topic_id]', @topic.id %>
|
29
|
+
|
30
|
+
<div class="m_actions"><%= f.submit "Create #{moxie_post_name.titleize}" %></div>
|
31
|
+
|
32
|
+
</div> <!-- contents -->
|
33
|
+
</div> <!-- post -->
|
34
|
+
|
35
|
+
<% else %>
|
36
|
+
|
37
|
+
<div class="m_post clearfix m_newpost">
|
38
|
+
|
39
|
+
<div class="m_contents">
|
40
|
+
|
41
|
+
<div class="m_body">
|
42
|
+
<div class="m_prompt field">Add a reply <%= moxie_post_name %></div>
|
43
|
+
|
44
|
+
<%= link_to "Login", topic_show_postable_moxie_topic_path( @topic ) %> to post a reply.
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="m_post clearfix">
|
2
|
+
|
3
|
+
<div class="m_user">
|
4
|
+
<%= post.author.profile_pic if post.author %>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="m_contents">
|
8
|
+
<div class="m_meta">
|
9
|
+
<span class="m_author"><%= post.author.display_name if post.author %></span>
|
10
|
+
<span class="m_datetime"><%= time_ago_in_words( post.created_at ) %></span>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="m_body">
|
14
|
+
<%= auto_link( h( post.body ).
|
15
|
+
gsub(/\n/, '<br>').
|
16
|
+
gsub(/\[b\](.*?)\[\/b\]/, "<b>\\1</b>").
|
17
|
+
gsub(/\[i\](.*?)\[\/i\]/, "<i>\\1</i>").
|
18
|
+
gsub(/\[u\](.*?)\[\/u\]/, "<u>\\1</u>").
|
19
|
+
gsub(/\?last_post_at=\d+/, "") , :all ) %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
</div>
|