Class: App::Views::UserShow

Inherits:
Layout
  • Object
show all
Defined in:
app/views/user_show.rb

Instance Method Summary collapse

Methods inherited from Layout

#page_title, #selected_item

Methods included from App::ViewHelpers

#add_book_button, #admin?, #app_name, #base_url, #book_permitted, #count_instances, #external_link_glyph, #flag_modal_button, #flags, #get_instances_per_page, #instance_permitted, #instances_by_names, #javascripts, #json_file, #logged_in, #map_height, #metadata, #not_empty, #place_permitted, #rendered_flash, #stylesheets, #user_name

Instance Method Details

#added_onObject


18
19
20
# File 'app/views/user_show.rb', line 18

def added_on
  @this_user.added_on
end

#adminObject


22
23
24
# File 'app/views/user_show.rb', line 22

def admin
  @this_user.admin?
end

#book_countObject


34
35
36
# File 'app/views/user_show.rb', line 34

def book_count
  @this_user.books.count
end

#booksObject


58
59
60
61
62
63
64
# File 'app/views/user_show.rb', line 58

def books
  @this_user.books.map{ |b| {
    b_slug: b.slug,
    b_title: b.title,
    b_instances: b.instances.count
  } }
end

#change_passwordObject


66
67
68
# File 'app/views/user_show.rb', line 66

def change_password
  @user.admin? || @user == @this_user
end

#emailObject


14
15
16
# File 'app/views/user_show.rb', line 14

def email
  @this_user.email
end

#instance_countObject


26
27
28
# File 'app/views/user_show.rb', line 26

def instance_count
  @this_user.instances.count
end

#instancesObject


38
39
40
41
42
43
44
45
46
47
48
# File 'app/views/user_show.rb', line 38

def instances
  @this_user.instances.map{ |i| { 
    i_id: i.id,
    i_book_slug: i.book.slug,
    i_book: i.book.title,
    i_place_slug: i.place.slug,
    i_place: i.place.name,
    i_page: i.page,
    i_sequence: i.sequence
  } }
end

#nameObject


6
7
8
# File 'app/views/user_show.rb', line 6

def name
  @this_user.name
end

#place_countObject


30
31
32
# File 'app/views/user_show.rb', line 30

def place_count
  @this_user.places.count
end

#placesObject


50
51
52
53
54
55
56
# File 'app/views/user_show.rb', line 50

def places
  @this_user.places.map{ |p| {
    p_slug: p.slug,
    p_name: p.name,
    p_instances: p.instances.count
  } }
end

#usernameObject


10
11
12
# File 'app/views/user_show.rb', line 10

def username
  @this_user.username
end