ref: master
plugins/people_block/lib/members_block.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
class MembersBlock < PeopleBlockBase settings_items :show_join_leave_button, :type => :boolean, :default => false settings_items :visible_role, :type => :string, :default => nil attr_accessible :show_join_leave_button, :visible_role def self.description c_('Members') end def help _('Clicking a member takes you to his/her homepage') end def default_title title = role ? _(role.name) : _('members') '{#} %s' % title end def profiles role ? owner.members.with_role(role.id) : owner.members.no_templates end def role visible_role && !visible_role.empty? ? Role.find_by(key: visible_role, environment_id: owner.environment.id) : nil end def roles Profile::Roles.organization_member_roles(owner.environment) end def extra_option data = { :human_name => _("Show join leave button"), :name => 'block[show_join_leave_button]', :value => true, :checked => show_join_leave_button, :options => {} } end def self.expire_on {:profile => [:role_assignment]} end end |