Module: AspectGlobalHelper

Defined in:
app/helpers/aspect_global_helper.rb

Overview

Copyright © 2010-2011, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Instance Method Summary collapse

Instance Method Details

#aspect_options_for_select(aspects) ⇒ Object


8
9
10
11
12
13
14
# File 'app/helpers/aspect_global_helper.rb', line 8

def aspect_options_for_select(aspects)
  options = {}
  aspects.each do |aspect|
    options[aspect.to_s] = aspect.id
  end
  options
end

#publisher_aspects_for(stream) ⇒ Object


16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/aspect_global_helper.rb', line 16

def publisher_aspects_for(stream)
  if stream
    aspects = stream.aspects
    aspect = stream.aspect
  elsif current_user
    aspects = current_user.post_default_aspects
    aspect = aspects.first
  else
    return {}
  end
  {selected_aspects: aspects, aspect: aspect}
end