mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ module Admin
|
|||
@recent_users = User.limit(5).order(created_at: :desc)
|
||||
@recent_events = Event.limit(5).order(created_at: :desc)
|
||||
@recent_registrations = Registration.limit(5).order(created_at: :desc)
|
||||
|
||||
@top_submitter = Conference.get_top_submitter
|
||||
|
||||
@submissions = {}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class User < ActiveRecord::Base
|
|||
before_create :setup_role
|
||||
|
||||
# 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:
|
||||
# :token_authenticatable, :confirmable,
|
||||
|
|
|
|||
|
|
@ -1,19 +1,10 @@
|
|||
.panel.well
|
||||
-@conferences_available.each do |conference|
|
||||
-conference.events.each do |event|
|
||||
- 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
|
||||
%hr
|
||||
-event.comment_threads.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
|
||||
%ul
|
||||
- @another_comments.each do |conference, events|
|
||||
%li= conference.title
|
||||
- events.each do |event, comments|
|
||||
%li= event.title
|
||||
- comments.each do |comment|
|
||||
%li= comment.body
|
||||
%li= comment.user.name
|
||||
%li= comment.created_at
|
||||
|
|
|
|||
|
|
@ -1,17 +1,2 @@
|
|||
.panel.well
|
||||
-@conferences_available.each do |conference|
|
||||
-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
|
||||
Some text
|
||||
|
|
|
|||
|
|
@ -1,19 +1,2 @@
|
|||
.panel.well
|
||||
-@conferences_available.each do |conference|
|
||||
-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
|
||||
Some text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue