WIP changed CommentsController#index; temporary view for all_comments
This commit is contained in:
parent
be55456c78
commit
449d466f7d
6 changed files with 15 additions and 54 deletions
|
|
@ -3,7 +3,8 @@ module Admin
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@conferences_available = Conference.with_roles([:admin, :organizer, :cfp], current_user)
|
@comments = Comment.accessible_by(current_ability).order(created_at: :desc).group_by { |comment| comment.commentable.conference }
|
||||||
|
@another_comments = Hash[@comments.map{|conference, comments| [conference, comments.group_by {|comment| comment.commentable}]}]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ module Admin
|
||||||
@recent_users = User.limit(5).order(created_at: :desc)
|
@recent_users = User.limit(5).order(created_at: :desc)
|
||||||
@recent_events = Event.limit(5).order(created_at: :desc)
|
@recent_events = Event.limit(5).order(created_at: :desc)
|
||||||
@recent_registrations = Registration.limit(5).order(created_at: :desc)
|
@recent_registrations = Registration.limit(5).order(created_at: :desc)
|
||||||
|
|
||||||
@top_submitter = Conference.get_top_submitter
|
@top_submitter = Conference.get_top_submitter
|
||||||
|
|
||||||
@submissions = {}
|
@submissions = {}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ class User < ActiveRecord::Base
|
||||||
before_create :setup_role
|
before_create :setup_role
|
||||||
|
|
||||||
# add scope
|
# add scope
|
||||||
scope :comment_notifiable, ->(conference) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_id = ?', conference.id)}
|
scope :comment_notifiable, ->(conference) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_type = ? AND roles.resource_id = ?', 'Conference', conference.id)}
|
||||||
|
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :token_authenticatable, :confirmable,
|
# :token_authenticatable, :confirmable,
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,10 @@
|
||||||
.panel.well
|
.panel.well
|
||||||
-@conferences_available.each do |conference|
|
%ul
|
||||||
-conference.events.each do |event|
|
- @another_comments.each do |conference, events|
|
||||||
- if event.comment_threads.count > 0
|
|
||||||
%panel
|
|
||||||
%panel.panel-header
|
|
||||||
%h4.title
|
|
||||||
%ul.list-unstyled
|
|
||||||
%li= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
|
||||||
%li= conference.title
|
%li= conference.title
|
||||||
%hr
|
- events.each do |event, comments|
|
||||||
-event.comment_threads.each do |comment|
|
%li= event.title
|
||||||
%panel-body
|
- comments.each do |comment|
|
||||||
%ul.list-unstyled
|
|
||||||
%li= comment.body
|
%li= comment.body
|
||||||
%ul.list-inline
|
%li= comment.user.name
|
||||||
%li Posted by: #{comment.user.name}
|
%li= comment.created_at
|
||||||
%li Created at: #{comment.created_at}
|
|
||||||
%hr
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,2 @@
|
||||||
.panel.well
|
.panel.well
|
||||||
-@conferences_available.each do |conference|
|
Some text
|
||||||
-conference.events.each do |event|
|
|
||||||
- if event.comment_threads.find_comments_by_user(current_user).count > 0
|
|
||||||
%panel
|
|
||||||
%panel.panel-header
|
|
||||||
%h4.title
|
|
||||||
%ul.list-unstyled
|
|
||||||
%li= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
|
||||||
%li= conference.title
|
|
||||||
%hr
|
|
||||||
-event.comment_threads.find_comments_by_user(current_user).each do |comment|
|
|
||||||
%panel-body
|
|
||||||
%ul.list-unstyled
|
|
||||||
%li= comment.body
|
|
||||||
%li Created at: #{comment.created_at}
|
|
||||||
%hr
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,2 @@
|
||||||
.panel.well
|
.panel.well
|
||||||
-@conferences_available.each do |conference|
|
Some text
|
||||||
-conference.events.each do |event|
|
|
||||||
- if event.comment_threads.find_since_last_login(current_user).count > 0
|
|
||||||
%panel
|
|
||||||
%panel.panel-header
|
|
||||||
%h4.title
|
|
||||||
%ul.list-unstyled
|
|
||||||
%li= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
|
||||||
%li= conference.title
|
|
||||||
%hr
|
|
||||||
-event.comment_threads.find_since_last_login(current_user).each do |comment|
|
|
||||||
%panel-body
|
|
||||||
%ul.list-unstyled
|
|
||||||
%li= comment.body
|
|
||||||
%ul.list-inline
|
|
||||||
%li Posted by: #{comment.user.name}
|
|
||||||
%li Created at: #{comment.created_at}
|
|
||||||
%hr
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue