Sha256: 39b9fec07f548e8e7512c6508859f2365235730b00041a67e95c9a08d1c61d27

Contents?: true

Size: 755 Bytes

Versions: 4

Compression:

Stored size: 755 Bytes

Contents

module JeraPush::Admin::DevicesHelper

  def resource_extras(device)
    if JeraPush.resource_attributes && JeraPush.resource_attributes.any?
      return resource_attributes(JeraPush.resource_attributes, device.resource)
    end
    return [device.resource]
  end

  def resource_attributes(attributes, resource)
    if resource
      attrs = attributes.collect do |attribute|
        "#{attribute}: #{resource.send(attribute)}"
      end
      return attrs.delete_if { |v| v.nil?}
    end
  end

  def devices_fields_for_filter_select
    fields = [:token]
    if JeraPush.resource_attributes && JeraPush.resource_attributes.any?
      JeraPush.resource_attributes.each do |attribute|
        fields << attribute
      end
    end
    fields
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jera_push-1.0.3 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.0.2 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.0.1.1 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.0.1 app/helpers/jera_push/admin/devices_helper.rb