-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This does not affect other roles such as homepage link roles, and notification roles, but only the roles attached to positions. These weren't actually roles, so the name brings them more in line with their actual purpose (capabilities), and reduces confusion. This is another wide, but not deep, change. Issue #185: Change entity names
- Loading branch information
Frank Duncan
committed
Jun 16, 2020
1 parent
6825d00
commit d08bcc4
Showing
67 changed files
with
250 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ActiveAdmin.register Roster::Capability, as: 'Capability' do | ||
menu parent: 'Roster' | ||
|
||
controller do | ||
def resource_params | ||
[params.fetch(resource_request_name, {}).permit(:name, :grant_name)] | ||
end | ||
|
||
def collection | ||
@coll ||= apply_scopes(super).preload{[capability_memberships.position, capability_memberships.capability_scopes]} | ||
end | ||
end | ||
|
||
index do | ||
column :name | ||
column :grant_name | ||
column :positions do |capability| | ||
safe_join(capability.capability_memberships.map{|pm| "#{pm.position.name if pm.position} (#{pm.capability_scopes.map(&:scope).join ','})"}, tag(:br)) | ||
end | ||
actions | ||
end | ||
|
||
form do |f| | ||
f.inputs | ||
f.actions | ||
end | ||
|
||
filter :name | ||
filter :grant_name | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Roster::Capability < ActiveRecord::Base | ||
has_many :capability_memberships, class_name: 'Roster::CapabilityMembership' | ||
validates :name, :grant_name, presence: true | ||
|
||
def display_name | ||
"#{name} (#{grant_name})" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Roster::CapabilityMembership < ActiveRecord::Base | ||
belongs_to :position | ||
belongs_to :capability | ||
has_many :capability_scopes | ||
|
||
accepts_nested_attributes_for :capability_scopes, allow_destroy: true | ||
validates :position, :capability, presence: true | ||
|
||
def display_name | ||
"#{capability.try :name} - (#{capability_scopes.map(&:scope).join ','})" | ||
end | ||
end |
4 changes: 2 additions & 2 deletions
4
app/models/roster/role_scope.rb → app/models/roster/capability_scope.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.