Sha256: 8f21db7eeb6bbb345cb3b325d6aea4d1cd28baca261e4666216e0ae00f047c1a

Contents?: true

Size: 913 Bytes

Versions: 11

Compression:

Stored size: 913 Bytes

Contents

module SocialNetworking
  module Serializers
    # Serializes Profile models.
    class ProfileSerializer < Serializer
      DEFAULT_ICON = "questionmark"

      def to_serialized
        if model.participant.is_admin
          icon_path = "social_networking/_profile_icon_admin.png"
        else
          icon_path = "social_networking/profile_icon_" +
                      (model.icon_name || DEFAULT_ICON) + ".png"
        end
        {
          id: model.id,
          participantId: model.participant_id,
          username: model.user_name,
          latestAction: model.latest_action_at,
          endOfTrial: model.active_membership_end_date,
          isAdmin: model.participant.is_admin,
          isWoz: (model.participant.current_group.arm.woz? &&
            model.participant.is_admin),
          iconSrc: ApplicationController.helpers.asset_path(icon_path)
        }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
social_networking-0.11.8 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.7 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.6 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.5 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.4 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.3 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.2 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.1 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.11.0 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.10.0 app/models/social_networking/serializers/profile_serializer.rb
social_networking-0.9.3 app/models/social_networking/serializers/profile_serializer.rb