Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/controllers/admin/portal_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ def index

@chapters = Chapter.active.all.order(name: :asc)
@workshops = Workshop.upcoming
@groups = Group.joins(:chapter).merge(@chapters)
@subscribers = Subscription.kept.joins(:chapter).merge(@chapters)
.ordered.limit(20).includes(:member, :group)
end

def guide; end
Expand Down
1 change: 0 additions & 1 deletion app/models/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class Subscription < ApplicationRecord
# 'subscribed then unsubscribed' (issue #2920). The partial unique index
# (index_subscriptions_on_member_id_group_id_active) enforces this at the DB level.
validates :group, uniqueness: { scope: :member_id, conditions: -> { kept } }
scope :ordered, -> { order(created_at: :desc) }

def student?
group.name.casecmp('students').zero?
Expand Down
14 changes: 0 additions & 14 deletions app/views/admin/portal/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,3 @@
= link_to 'Members Directory', admin_members_path, class: 'btn btn-primary btn-lg mb-3'
= link_to 'Chapter Status', status_admin_chapters_path, class: 'btn btn-primary btn-lg mb-3'
= link_to 'Stats', admin_stats_path, class: 'btn btn-primary btn-lg mb-3'
%hr

.row
.col-12.col-md-3
%h3.mb-3 Groups
%ul.list-unstyled.m-0
- @groups.each do |group|
%li.border-bottom.border-dark.pb-2.mb-3
= link_to [:admin, group] do
#{group.name} (#{group.chapter.name})

.col-12.col-md-9
%h3.mb-3 Latest Subscribers
= render partial: 'admin/subscriptions/index', locals: { subscribers: @subscribers }
13 changes: 4 additions & 9 deletions spec/features/admin/accessing_portal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,12 @@
end

scenario 'can view all active chapters listed' do
chapter = Fabricate(:chapter_with_groups)
inactive_chapter = Fabricate(:chapter_with_groups, active: false)
chapter = Fabricate(:chapter, name: 'Manchester')
inactive_chapter = Fabricate(:chapter, name: 'Dormant', active: false)
visit admin_root_path

chapter.groups.each do |group|
expect(page).to have_text(group.to_s)
end

inactive_chapter.groups.each do |group|
expect(page).to have_no_text(group.to_s)
end
expect(page).to have_text(chapter.name)
expect(page).to have_no_text(inactive_chapter.name)
end

scenario 'can access sponsor contacts' do
Expand Down
Loading