added logic for available conferences based on roles in comments_controller.rb
This commit is contained in:
parent
52a503afd2
commit
800a41b3f9
5 changed files with 48 additions and 44 deletions
|
|
@ -1,11 +1,9 @@
|
||||||
module Admin
|
module Admin
|
||||||
class CommentsController < Admin::BaseController
|
class CommentsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ordered_events = Event.order(:title).all
|
@conferences_available = Conference.with_roles([:admin, :organizer, :cfp], current_user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
devise(*devise_modules)
|
devise(*devise_modules)
|
||||||
|
|
||||||
has_and_belongs_to_many :roles
|
has_and_belongs_to_many :roles
|
||||||
has_many :openids
|
has_many :openids
|
||||||
|
|
||||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
|
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
.panel.well
|
.panel.well
|
||||||
-@ordered_events.each do |event|
|
-@conferences_available.each do |conference|
|
||||||
- if event.comment_threads.count > 0
|
-conference.events.each do |event|
|
||||||
%panel
|
- if event.comment_threads.count > 0
|
||||||
%panel.panel-header
|
%panel
|
||||||
%h4.title
|
%panel.panel-header
|
||||||
= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
%h4.title
|
||||||
|
= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
||||||
|
= 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
|
%hr
|
||||||
-event.comment_threads.order(created_at: :desc).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
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
.panel.well
|
.panel.well
|
||||||
-@ordered_events.each do |event|
|
-@conferences_available.each do |conference|
|
||||||
- if event.comment_threads.find_comments_by_user(current_user).count > 0
|
-conference.events.each do |event|
|
||||||
%panel
|
- if event.comment_threads.find_comments_by_user(current_user).count > 0
|
||||||
%panel.panel-header
|
%panel
|
||||||
%h4.title
|
%panel.panel-header
|
||||||
= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
%h4.title
|
||||||
|
= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
||||||
|
= 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
|
%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,16 +1,18 @@
|
||||||
.panel.well
|
.panel.well
|
||||||
-@ordered_events.each do |event|
|
-@conferences_available.each do |conference|
|
||||||
- if event.comment_threads.find_since_last_login(current_user).count > 0
|
-conference.events.each do |event|
|
||||||
%panel
|
- if event.comment_threads.find_since_last_login(current_user).count > 0
|
||||||
%panel.panel-header
|
%panel
|
||||||
%h4.title
|
%panel.panel-header
|
||||||
= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
%h4.title
|
||||||
|
= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
|
||||||
|
= 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
|
%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