Class: Views::Lists::Index

Inherits:
Base
  • Object
show all
Defined in:
app/views/lists/index.rb

Instance Method Summary collapse

Constructor Details

#initialize(lists:) ⇒ Index

Returns a new instance of Index.



4
5
6
# File 'app/views/lists/index.rb', line 4

def initialize(lists:)
  @lists = lists
end

Instance Method Details

#view_template ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/views/lists/index.rb', line 8

def view_template
  PageTitle title: t("views.lists.index.title")
  p { t("views.lists.index.description") }
  table class: "table table-striped" do
    tr do
      th { List.human_attribute_name :name }
      th { ListItem.model_name.human(count: 100) }
      th
    end
    @lists.each do |list|
      tr do
        td { link_to (list.special ? t(list.name) : list.name), list_path(list) }
        td { list.list_items.count }
        td { GoButton label: t("views.lists.edit.title"), href: edit_list_path(list), icon: "pencil", variant: :secondary }
      end
    end
  end
  GoButton icon: "plus-circle", label: t("views.lists.new.title"), href: new_list_path, variant: :primary
end