Module: Pageflow::FoldersHelper

Defined in:
app/helpers/pageflow/folders_helper.rb

Instance Method Summary collapse

Instance Method Details

#collection_for_folders(current_account, current_folder = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/pageflow/folders_helper.rb', line 3

def collection_for_folders(, current_folder = nil)
  accounts = AccountPolicy::Scope.new(current_user, Pageflow::Account)
             .entry_creatable.includes(:folders).where('pageflow_folders.id IS NOT NULL')
             .order(:name, 'pageflow_folders.name')

  option_groups_from_collection_for_select(accounts,
                                           :folders,
                                           :name,
                                           :id,
                                           :name,
                                           selected: current_folder.try(:id),
                                           disabled: disabled_ids(accounts, ))
end