Show campaigns list doesn't include child campaigns for non-logged-in users
This commit is contained in:
parent
3d1fac1655
commit
e0c2358d74
1 changed files with 7 additions and 2 deletions
|
@ -9,14 +9,19 @@ class CampaignsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@nonprofit = current_nonprofit
|
@nonprofit = current_nonprofit
|
||||||
@campaigns = @nonprofit.campaigns.includes(:nonprofit).not_deleted.order('created_at desc')
|
if (current_nonprofit_user?)
|
||||||
|
@campaigns = @nonprofit.campaigns.includes(:nonprofit).not_deleted.order('created_at desc')
|
||||||
|
@deleted_campaigns = @nonprofit.campaigns.includes(:nonprofit).deleted.order('created_at desc')
|
||||||
|
else
|
||||||
|
@campaigns = @nonprofit.campaigns.includes(:nonprofit).not_deleted.not_a_child.order('created_at desc')
|
||||||
|
@deleted_campaigns = @nonprofit.campaigns.includes(:nonprofit).deleted.not_a_child.order('created_at desc')
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
@active_campaigns = @campaigns.active
|
@active_campaigns = @campaigns.active
|
||||||
@past_campaigns = @campaigns.past
|
@past_campaigns = @campaigns.past
|
||||||
@unpublished_campaigns = @campaigns.unpublished
|
@unpublished_campaigns = @campaigns.unpublished
|
||||||
@deleted_campaigns = @nonprofit.campaigns.deleted.order('created_at desc')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
|
|
Loading…
Reference in a new issue