Class: App::Views::BooksShow

Inherits:
Layout
  • Object
show all
Includes:
App::ViewHelpers
Defined in:
app/views/books_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, #map_height, #metadata, #not_empty, #place_permitted, #places, #rendered_flash, #stylesheets, #user_name

Methods inherited from Layout

#page_title, #selected_item

Instance Method Details

#booksObject


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/views/books_show.rb', line 11

def books
  @books.map do |b| 
    { 
      author: b[:author], 
      title: b[:title], 
      slug: b[:slug], 
      link: b[:url], 
      external_link: external_link_glyph(b[:url]), 
      year: b[:year], 
      # users: b[:user_sentence], 
      users: b.user_sentence, 
      # instances: b[:instances],
      instances: b.instances.count,
      # pages: b[:total_pages],
      pages: b.total_pages,
      # instances_per_page: get_instances_per_page(b[:total_pages], b[:instances]),
      instances_per_page: b.instances_per_page,
      permitted: ( admin? || Book[b[:id]].users.include?(@user) )
    } 
  end
end

#last_updatedObject


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

def last_updated
  @last_updated
end