Module: SocialStream::Views::Settings::Base

Defined in:
lib/social_stream/views/settings/base.rb

Instance Method Summary collapse

Instance Method Details

#settings_itemsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/social_stream/views/settings/base.rb', line 5

def settings_items
  SocialStream::Views::List.new.tap do |items|
    if current_subject  == current_user
      items << {
        :key  => 'user.edit',
        :html => render(:partial => "devise/registrations/edit_user",
                        :locals => {
                                     :resource => current_user,
                                     :resource_name => :user
                                   })
      }
    end

    items << {
      :key  => 'notifications',
      :html => render(:partial => "notifications")
    }

    if current_subject.respond_to? :authentication_token
      items << {
        :key  => 'api_key',
        :html => render(:partial => "api_key")
      }
    end

    items << {
      :key  => 'destroy',
      :html => 
        current_subject == current_user ?
          render(:partial => "devise/registrations/delete_account",
                             :locals => { :resource => current_user, :resource_name => :user }) :
          render(:partial => 'destroy')
    }
  end
end