Sha256: 484556d38d769ef1033bada4ebde347cf414454832d235c420251ceda4f09de8

Contents?: true

Size: 660 Bytes

Versions: 7

Compression:

Stored size: 660 Bytes

Contents

module Curate::FieldsForAddToCollection
  extend ActiveSupport::Concern

protected

  def collection_options
    @collection_options ||= current_users_collections
  end

  def profile_collection_options
    @profile_collection_options ||= current_users_profile_sections
  end

  def current_users_collections
    current_user ? current_user.collections.to_a : []
  end

  def current_users_profile_sections
    return [] unless current_user
    return [] unless current_user.profile
    options = current_user.profile.members.select{ |item|
      item.is_a?(Collection) && can?(:edit, item)
    }
    options = options.unshift(current_user.profile)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
curate-0.5.6 app/controllers/concerns/curate/fields_for_add_to_collection.rb
curate-0.5.5 app/controllers/concerns/curate/fields_for_add_to_collection.rb
curate-0.5.4 app/controllers/concerns/curate/fields_for_add_to_collection.rb
curate-0.5.2 app/controllers/concerns/curate/fields_for_add_to_collection.rb
curate-0.5.1 app/controllers/concerns/curate/fields_for_add_to_collection.rb
curate-0.5.0 app/controllers/concerns/curate/fields_for_add_to_collection.rb
curate-0.4.2 app/controllers/concerns/curate/fields_for_add_to_collection.rb