effective_memberships 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/effective/memberships_directory_controller.rb +14 -0
- data/app/datatables/admin/effective_memberships_datatable.rb +2 -2
- data/app/datatables/effective_memberships_directory_datatable.rb +31 -0
- data/app/views/effective/memberships_directory/index.html.haml +1 -0
- data/config/routes.rb +2 -0
- data/lib/effective_memberships/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 240ed521dcef407cae7be663d49f877b373012b2fbd8877b787a4fa315539a2b
|
4
|
+
data.tar.gz: 394ebf710135b07e984df6277e80ca2340f8f4e4e61980e127dd0113ea6e2dca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7602bafa9bd4d86c4d01db0acadf432da1b9af29c7eeee171d3e560baa74037318802e7604282986bbe09230fbee3ae8005ee1f3148ff477422d0ef5ed83d138
|
7
|
+
data.tar.gz: a3d51cf1a5d0941b48d1a3c400115973478acf21c501daf8e79aa61b83bb2109c314c6091d8a8742d1637b21895cd214819c94b53aef5e0743db3371f384bef8
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Effective
|
2
|
+
class MembershipsDirectoryController < ApplicationController
|
3
|
+
include Effective::CrudController
|
4
|
+
|
5
|
+
def index
|
6
|
+
@page_title = 'Directory'
|
7
|
+
|
8
|
+
EffectiveResources.authorize!(self, :index, Effective::Membership)
|
9
|
+
|
10
|
+
@datatable = EffectiveResources.best('EffectiveMembershipsDirectoryDatatable').new
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -8,7 +8,7 @@ module Admin
|
|
8
8
|
col :owner_id, visible: false
|
9
9
|
col :owner_type, visible: false
|
10
10
|
|
11
|
-
|
11
|
+
val :owner
|
12
12
|
col :categories
|
13
13
|
|
14
14
|
col :number
|
@@ -28,7 +28,7 @@ module Admin
|
|
28
28
|
end
|
29
29
|
|
30
30
|
collection do
|
31
|
-
memberships = Effective::Membership.deep.all
|
31
|
+
memberships = Effective::Membership.deep.all.includes(:owner)
|
32
32
|
|
33
33
|
raise('expected an owner_id, not user_id') if attributes[:user_id].present?
|
34
34
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Member Directory Datatable
|
2
|
+
class EffectiveMembershipsDirectoryDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
length 100
|
5
|
+
|
6
|
+
col(:name) { |membership| membership.owner.to_s }
|
7
|
+
|
8
|
+
col :joined_on
|
9
|
+
col :number
|
10
|
+
col :categories, search: :string, label: 'Category'
|
11
|
+
end
|
12
|
+
|
13
|
+
collection do
|
14
|
+
scope = Effective::Membership.deep.includes(:owner)
|
15
|
+
|
16
|
+
archived_klasses.each do |klass|
|
17
|
+
scope = scope.where.not(owner_id: klass.archived.select('id'), owner_type: klass.name)
|
18
|
+
end
|
19
|
+
|
20
|
+
scope
|
21
|
+
end
|
22
|
+
|
23
|
+
def archived_klasses
|
24
|
+
@archived_klasses ||= begin
|
25
|
+
klasses = Effective::Membership.distinct(:owner_type).pluck(:owner_type)
|
26
|
+
klasses = klasses.select { |klass| klass.safe_constantize.try(:acts_as_archived?) }
|
27
|
+
klasses.map { |klass| klass.constantize }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= render_datatable(@datatable, buttons: false)
|
data/config/routes.rb
CHANGED
@@ -16,6 +16,8 @@ EffectiveMemberships::Engine.routes.draw do
|
|
16
16
|
resources :fee_payments, only: [:new, :show] do
|
17
17
|
resources :build, controller: :fee_payments, only: [:show, :update]
|
18
18
|
end
|
19
|
+
|
20
|
+
get '/directory', to: 'memberships_directory#index'
|
19
21
|
end
|
20
22
|
|
21
23
|
namespace :admin do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_memberships
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
@@ -249,6 +249,7 @@ files:
|
|
249
249
|
- app/controllers/effective/applicant_references_controller.rb
|
250
250
|
- app/controllers/effective/applicants_controller.rb
|
251
251
|
- app/controllers/effective/fee_payments_controller.rb
|
252
|
+
- app/controllers/effective/memberships_directory_controller.rb
|
252
253
|
- app/datatables/admin/effective_applicant_course_areas_datatable.rb
|
253
254
|
- app/datatables/admin/effective_applicant_course_names_datatable.rb
|
254
255
|
- app/datatables/admin/effective_applicants_datatable.rb
|
@@ -263,6 +264,7 @@ files:
|
|
263
264
|
- app/datatables/effective_applicant_references_datatable.rb
|
264
265
|
- app/datatables/effective_applicants_datatable.rb
|
265
266
|
- app/datatables/effective_fee_payments_datatable.rb
|
267
|
+
- app/datatables/effective_memberships_directory_datatable.rb
|
266
268
|
- app/helpers/effective_memberships_helper.rb
|
267
269
|
- app/mailers/effective/memberships_mailer.rb
|
268
270
|
- app/models/concerns/effective_memberships_applicant.rb
|
@@ -372,6 +374,7 @@ files:
|
|
372
374
|
- app/views/effective/fees/_fee.html.haml
|
373
375
|
- app/views/effective/memberships/_dashboard.html.haml
|
374
376
|
- app/views/effective/memberships/_membership.html.haml
|
377
|
+
- app/views/effective/memberships_directory/index.html.haml
|
375
378
|
- app/views/effective/memberships_mailer/applicant_approved.liquid
|
376
379
|
- app/views/effective/memberships_mailer/applicant_declined.liquid
|
377
380
|
- app/views/effective/memberships_mailer/applicant_reference_notification.liquid
|