Navigation Menu

Skip to content

Commit

Permalink
add comment view in session#show
Browse files Browse the repository at this point in the history
  • Loading branch information
sakomoko committed Feb 28, 2012
1 parent dd75ee1 commit 0ea4d32
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/sessions_controller.rb
Expand Up @@ -19,6 +19,7 @@ def finished
# GET /sessions/1.xml
def show
@session = Session.find(params[:id])
@comment = Comment.new
respond_with(@session)
end

Expand Down
1 change: 1 addition & 0 deletions app/models/session.rb
Expand Up @@ -6,6 +6,7 @@ class Session
belongs_to :world
belongs_to :game_master, class_name: "User"
has_many :rooms, as: :roomable
embeds_many :comments, as: :commentable

field :title, :type => String
field :description, :type => String
Expand Down
13 changes: 13 additions & 0 deletions app/views/comments/_comment.html.haml
@@ -0,0 +1,13 @@
%article.comment
.avatar
%div
%div.comment-meta
%p.author
%i.icon-comment
%strong.author
= link_to comment.user.name, comment.user
%p.info
%i.icon-time
%em= comment.created_at.to_s :db
%div.body.well
= comment.body
9 changes: 9 additions & 0 deletions app/views/sessions/show.html.haml
Expand Up @@ -48,3 +48,12 @@
%th Description
%th CreatedAt
= render @session.rooms

%h3 Session Comments
#comments
= render @session.comments
#comment_error
= simple_form_for [@session, @comment], :remote => true do |f|
= f.input :body
.form-actions
= f.button :submit, class: "btn-success", id: "new_comment_submit"

0 comments on commit 0ea4d32

Please sign in to comment.