Sha256: d327dc09bab3fdd016213f45d1097821eae3c54acc447f916ecdf4af2b395458

Contents?: true

Size: 755 Bytes

Versions: 9

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.pushable)
    end
    return [device.pushable]
  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

9 entries across 9 versions & 1 rubygems

Version Path
jera_push-1.2.1 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.7 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.6 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.5 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.4 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.3 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.2 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.1 app/helpers/jera_push/admin/devices_helper.rb
jera_push-1.1.0 app/helpers/jera_push/admin/devices_helper.rb