Sha256: bf0cbb804631079490d160ac3f4a04fddd498ba47d599fad856509fa5afeea60

Contents?: true

Size: 427 Bytes

Versions: 44

Compression:

Stored size: 427 Bytes

Contents

module Kuhsaft
  class BrickTypeFilter < SimpleDelegator

    def empty?
      !(respond_to?(:user_can_add_childs?) && user_can_add_childs? && !allowed.empty?)
    end

    def allowed
      if Kuhsaft::BrickType.enabled.count.zero?
        []
      elsif allowed_brick_types.empty?
        Kuhsaft::BrickType.enabled
      else
        Kuhsaft::BrickType.enabled.constrained(allowed_brick_types)
      end
    end

  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
kuhsaft-1.7.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.6.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.5.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.4.3 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.4.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.4.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.4.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.3.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.15 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.14 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.13 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.12 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.11 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.10 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.9 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.8 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.7 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.6 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.5 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.2.4 app/models/kuhsaft/brick_type_filter.rb