Add comment functionality to tracks
This commit is contained in:
parent
770a63e15c
commit
58208c73ac
19 changed files with 153 additions and 48 deletions
|
|
@ -1,11 +1,14 @@
|
|||
- @comments.each do |conference, events|
|
||||
- @comments.each do |conference, objects|
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
%h4.title.panel-title= conference.title
|
||||
.panel-body
|
||||
- events.each do |event, comments|
|
||||
- objects.each do |obj, comments|
|
||||
.notifications
|
||||
%h4.title= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
|
||||
- if obj.class.name == 'Event'
|
||||
%h4.title= link_to obj.title, admin_conference_program_event_path(obj.program.conference.short_title, obj)
|
||||
- if obj.class.name == 'Track'
|
||||
%h4.title= link_to obj.name, admin_conference_program_track_path(obj.program.conference.short_title, obj)
|
||||
%hr
|
||||
- comments.each do |comment|
|
||||
%h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
- @posted_comments.each do |conference, events|
|
||||
- @posted_comments.each do |conference, objects|
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
%h4.title.panel-title= conference.title
|
||||
.panel-body
|
||||
- events.each do |event, comments|
|
||||
- objects.each do |obj, comments|
|
||||
.notifications
|
||||
%h4.title= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
|
||||
- if obj.class.name == 'Event'
|
||||
%h4.title= link_to obj.title, admin_conference_program_event_path(obj.program.conference.short_title, obj)
|
||||
- if obj.class.name == 'Track'
|
||||
%h4.title= link_to obj.name, admin_conference_program_track_path(obj.program.conference.short_title, obj)
|
||||
%hr
|
||||
- comments.each do |comment|
|
||||
%h5.strong Created at: #{comment.created_at}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
- @unread_comments.each do |conference, events|
|
||||
- @unread_comments.each do |conference, objects|
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
%h4.title.panel-title= conference.title
|
||||
.panel-body
|
||||
- events.each do |event, comments|
|
||||
- objects.each do |obj, comments|
|
||||
.notifications
|
||||
%h4.title= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
|
||||
- if obj.class.name == 'Event'
|
||||
%h4.title= link_to obj.title, admin_conference_program_event_path(obj.program.conference.short_title, obj)
|
||||
- if obj.class.name == 'Track'
|
||||
%h4.title= link_to obj.name, admin_conference_program_track_path(obj.program.conference.short_title, obj)
|
||||
%hr
|
||||
- comments.each do |comment|
|
||||
%h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at}
|
||||
|
|
|
|||
15
app/views/admin/tracks/_nested_comments.html.haml
Normal file
15
app/views/admin/tracks/_nested_comments.html.haml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
%div{ style: "padding-left:#{padding}px" }
|
||||
.well.comment-section
|
||||
%strong= comment.user.name
|
||||
%i= comment.created_at
|
||||
%p.comment-body= comment.body
|
||||
%div
|
||||
%a.pull-right.comment-reply-link{ href: '#' } Reply
|
||||
.comment-reply
|
||||
= semantic_form_for :comment, url: comment_admin_conference_program_track_path(@conference.short_title, @track.short_name, comment.commentable_id), method: :post do |f|
|
||||
= f.input :body
|
||||
%input{ name: 'parent', type: 'hidden', value: comment.id }
|
||||
%input{ name: 'authenticity_token', type: 'hidden', value: '#{form_authenticity_token}' }
|
||||
%button.btn.btn-primary.pull-right{ name: 'button', type: 'submit' } Add Reply
|
||||
- comment.children.each do |child|
|
||||
= render 'nested_comments', comment: child, padding: 50
|
||||
|
|
@ -127,3 +127,21 @@
|
|||
= event.state
|
||||
%td
|
||||
= event.time
|
||||
|
||||
|
||||
|
||||
.row
|
||||
= link_to "Comments (#{@comment_count})", '#', id: 'event-comment-link'
|
||||
#comments-div
|
||||
%hr
|
||||
%ul.media
|
||||
%div
|
||||
.row-fluid
|
||||
= semantic_form_for :comment, url: comment_admin_conference_program_track_path(@conference.short_title, @track.short_name), method: :post do |f|
|
||||
= f.input :body
|
||||
= f.submit 'Add Comment', class: 'btn btn-primary pull-right'
|
||||
%br
|
||||
%br
|
||||
- @comments.each do |comment|
|
||||
%div
|
||||
= render partial: 'nested_comments', locals: { comment: comment, padding: 0}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@
|
|||
Notifications (#{unread_notifications(current_user).length})
|
||||
- if unread_notifications(current_user).length > 0
|
||||
%li.dropdown-header Last 5 Comments for:
|
||||
- unread_notifications(current_user).limit(5).group_by{ |comment| comment.commentable}.each do |event, comments|
|
||||
%li= link_to("#{event.title}(#{comments.count})", admin_conference_program_event_path(event.program.conference.short_title, event.id))
|
||||
- unread_notifications(current_user).limit(5).group_by{ |comment| comment.commentable}.each do |obj, comments|
|
||||
- if obj.class.name === 'Event'
|
||||
%li= link_to("#{obj.title}(#{comments.count})", admin_conference_program_event_path(obj.program.conference.short_title, obj.id))
|
||||
- if obj.class.name === 'Track'
|
||||
%li= link_to("#{obj.name}(#{comments.count})", admin_conference_program_track_path(obj.program.conference.short_title, obj))
|
||||
%li.divider
|
||||
%li= link_to "See all unread Comments (#{unread_notifications(current_user).length})", admin_comments_path
|
||||
%li= link_to 'See all Comments', admin_comments_path(anchor: 'all_comments')
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
Dear <%= @user.name %>,
|
||||
|
||||
User <%= @comment.user.name %> posted a new comment for event <%= @event.title %> of <%= @conference.short_title %> .
|
||||
User <%= @comment.user.name %> posted a new comment for event <%= @commentable.title %> of <%= @conference.short_title %> .
|
||||
|
||||
"<%= @comment.body %>"
|
||||
|
||||
To reply to this comment, please go to <%= h(admin_conference_program_event_url(@conference.short_title, @event, only_path: false)) %>
|
||||
To reply to this comment, please go to <%= h(admin_conference_program_event_url(@conference.short_title, @commentable, only_path: false)) %>
|
||||
|
||||
Best wishes,
|
||||
<%= @conference.title %> Team
|
||||
10
app/views/mailbot/comment_track_template.text.erb
Normal file
10
app/views/mailbot/comment_track_template.text.erb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Dear <%= @user.name %>,
|
||||
|
||||
User <%= @comment.user.name %> posted a new comment for track <%= @commentable.short_name %> of <%= @conference.short_title %> .
|
||||
|
||||
"<%= @comment.body %>"
|
||||
|
||||
To reply to this comment, please go to <%= h(admin_conference_program_track_url(@conference.short_title, @commentable, only_path: false)) %>
|
||||
|
||||
Best wishes,
|
||||
<%= @conference.title %> Team
|
||||
Loading…
Add table
Add a link
Reference in a new issue