Sha256: 7ea1cd211066063e389063f609c91a3e8428d1d215199b09567ded975c24d6fe

Contents?: true

Size: 554 Bytes

Versions: 39

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # The form object that handles the data behind updating a user's
  # interests in her profile page.
  class UserInterestsForm < Form
    mimic :user

    attribute :scopes, Array[UserInterestScopeForm]

    def newsletter_notifications_at
      return nil unless newsletter_notifications

      Time.current
    end

    def map_model(user)
      self.scopes = user.organization.scopes.top_level.map do |scope|
        UserInterestScopeForm.from_model(scope: scope, user: user)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.9 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.8 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.7 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.5 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.4 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.3 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.2 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.1 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.0 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.0.rc2 app/forms/decidim/user_interests_form.rb
decidim-core-0.26.0.rc1 app/forms/decidim/user_interests_form.rb
decidim-core-0.25.2 app/forms/decidim/user_interests_form.rb
decidim-core-0.25.1 app/forms/decidim/user_interests_form.rb
decidim-core-0.25.0 app/forms/decidim/user_interests_form.rb
decidim-core-0.25.0.rc4 app/forms/decidim/user_interests_form.rb
decidim-core-0.25.0.rc3 app/forms/decidim/user_interests_form.rb
decidim-core-0.25.0.rc2 app/forms/decidim/user_interests_form.rb
decidim-core-0.25.0.rc1 app/forms/decidim/user_interests_form.rb
decidim-core-0.24.3 app/forms/decidim/user_interests_form.rb