Class: App::Views::InstanceNew

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

Instance Method Summary collapse

Methods inherited from Layout

#page_title, #selected_item

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

Instance Method Details

#book_slugObject


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

def book_slug
  @book.slug
end

#book_titleObject


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

def book_title
  @book.title
end

#edit_last_instanceObject


58
59
60
# File 'app/views/instance_new.rb', line 58

def edit_last_instance
  @user.admin? || @last_instance.user == @user
end

#form_buttonObject


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

def form_button
  "Add Instance"
end

#form_sourceObject


42
43
44
# File 'app/views/instance_new.rb', line 42

def form_source
  "modal"
end

#last_instanceObject


46
47
48
49
50
51
52
53
54
55
56
# File 'app/views/instance_new.rb', line 46

def last_instance
  { li_page: @last_instance.page,
    li_sequence: @last_instance.sequence,
    li_place: @last_instance.place.name,
    li_place_name_in_text: @last_instance.text,
    li_place_slug: @last_instance.place.slug,
    li_owner: @last_instance.user.name,
    li_note: @last_instance.note,
    li_special: @last_instance.special,
    li_id: @last_instance.id } unless @last_instance.nil?
end

#nicknamesObject


38
39
40
# File 'app/views/instance_new.rb', line 38

def nicknames
  @nicknames
end

#object_id_for_flagObject


62
63
64
# File 'app/views/instance_new.rb', line 62

def object_id_for_flag
  @last_instance.id unless @last_instance.nil?
end

#pageObject


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

def page
  @last_instance.nil? ? 1 : @last_instance.page
end

#sequenceObject


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

def sequence
  @last_instance.nil? ? 1 : @last_instance.sequence + 1
end

#specialObject


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

def special
  @last_instance.nil? ? nil : @last_instance.special
end

#special_fieldObject


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

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

#special_help_textObject


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

def special_help_text
  @book.special.help_text unless @book.special.nil?
end

#typeObject


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

def type
  "instance"
end