Class: App::Views::BookShow

Inherits:
Layout
  • Object
show all
Includes:
App::ViewHelpers
Defined in:
app/views/book_show.rb

Instance Method Summary collapse

Methods included from App::ViewHelpers

#add_book_button, #admin, #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, #metadata, #not_empty, #place_permitted, #places, #rendered_flash, #stylesheets, #user_name

Methods inherited from Layout

#page_title, #selected_item

Instance Method Details

#authorObject


25
26
27
# File 'app/views/book_show.rb', line 25

def author
  @book.author
end

#coverObject


41
42
43
# File 'app/views/book_show.rb', line 41

def cover
  @book.cover
end

#cover_altObject


49
50
51
# File 'app/views/book_show.rb', line 49

def cover_alt
  "#{title}, #{year}"
end

7
8
9
# File 'app/views/book_show.rb', line 7

def external_link
  external_link_glyph(@book.url)
end

#idObject


21
22
23
# File 'app/views/book_show.rb', line 21

def id
  @book.id
end

#instance_countObject


79
80
81
# File 'app/views/book_show.rb', line 79

def instance_count
  @instances.length
end

#instancesObject


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'app/views/book_show.rb', line 61

def instances
  @instances.map do |i| 
    {
      page: i[:page], 
      sequence: i[:sequence], 
      place_name: i[:place_name], 
      place_slug: i[:place_slug], 
      instance_id: i[:id],
      owner: i[:owner],
      flagged: i[:flagged],
      text: i[:text],
      special: i[:special],
      note: not_empty(i[:note]),
      instance_permitted: ( admin? || Instance[i[:id]].user == @user )
    } 
  end
end

#instances_per_pageObject


83
84
85
# File 'app/views/book_show.rb', line 83

def instances_per_page
  get_instances_per_page(@book.total_pages, instance_count)
end

#isbnObject


37
38
39
# File 'app/views/book_show.rb', line 37

def isbn
  @book.isbn
end

#last_updatedObject


11
12
13
14
15
16
17
18
19
# File 'app/views/book_show.rb', line 11

def last_updated
  unless @last_updated.nil?
    if @last_updated < 11
      "; list updated #{@last_updated} minutes ago"
    else
      ""
    end
  end
end

53
54
55
# File 'app/views/book_show.rb', line 53

def link
  @book.url
end

#map_heightObject


87
88
89
# File 'app/views/book_show.rb', line 87

def map_height
  "300px;"
end

#slugObject


57
58
59
# File 'app/views/book_show.rb', line 57

def slug
  @book.slug
end

#special_fieldObject


45
46
47
# File 'app/views/book_show.rb', line 45

def special_field
  @book.special.field unless @book.special.nil?
end

#titleObject


29
30
31
# File 'app/views/book_show.rb', line 29

def title
  @book.title
end

#yearObject


33
34
35
# File 'app/views/book_show.rb', line 33

def year
  @book.year
end