lib/tiny_tabs.rb
# returns true if the logged in user should see this tab
returns true if the logged in user should see this tab
returns true if the logged in user should see this tab
def privileged_for? tab
    return false if tab[:privilege] && (@user.nil? || tab[:privilege] > @user.privilege)
    return true unless tab[:if]
    tab[:if] = [tab[:if]] unless tab[:if].is_a? Array
    privileged = true
    tab[:if].each do |i|
      case i
      when :contract
	      return false if @contract.nil? || @contract.new_record?
	    when :student
	      return false if @student.nil?
	    when nil
	    else
	      return false unless self.send(i)
      end
    end
    return true    
  end
def privileged_for? tab return false if tab [ :privilege ] && ( @user . nil? || tab [ :privilege ] > @user . privilege ) return true unless tab [ :if ] tab [ :if ] = [ tab [ :if ] ] unless tab [ :if ] . is_a? Array privileged = true tab [ :if ] . each do | i | case i when :contract return false if @contract . nil? || @contract . new_record? when :student return false if @student . nil? when nil else return false unless self . send ( i ) end end return true end
returns true if the logged in user should see this tab
returns true if the logged in user should see this tab
tab
<not_specific>