Class: Records::Table::RecordPanel

Inherits:
Components::Base
  • Object
show all
Defined in:
app/components/databasium/records/table/record_panel.rb

Instance Method Summary collapse

Constructor Details

#initializeRecordPanel

Returns a new instance of RecordPanel.



4
5
# File 'app/components/databasium/records/table/record_panel.rb', line 4

def initialize
end

Instance Method Details

#view_templateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/components/databasium/records/table/record_panel.rb', line 7

def view_template
  div(class: "flex flex-col min-h-0 items-end") do
    div(
      class:
        "hidden bg-panel flex-1 min-h-0 overflow-y-auto rounded-bl-xl mb-2 min-h-[calc(100dvh-51px)] flex flex-col w-125",
      data: {
        table_target: "recordsPanel"
      },
      id: "editRecord"
    ) do
      button(
        class:
          "w-fit text-accent hover:text-accent-dark border-1 border-accent p-1 rounded-xl m-2 ms-auto",
        data: {
          action: "click->table#closeRecordsPanel"
        }
      ) { raw heroicon("x-mark", variant: :solid, options: { class: "w-6 h-6" }) }
      div(
        class:
          "flex bg-background px-2 overflow-x-auto max-w-fill divide-x-1 divide-border gap-x-2",
        data: {
          table_target: "recordTabs"
        }
      ) do
        template(data: { table_target: "recordTab" }) do
          button(
            type: "button",
            class: "flex items-center gap-2 px-2 cursor-pointer",
            data: {
              action: "click->table#openTab"
            }
          ) do
            div(data: { table_target: "recordTabTitle" }) { plain "Name" }
            div(data: { action: "click->table#closeTab" }) do
              raw heroicon(
                    "x-mark",
                    variant: :solid,
                    options: {
                      class: "w-3 h-3 me-auto hover:bg-panel"
                    }
                  )
            end
          end
        end
      end
      div(class: "m-2", data: { table_target: "recordTabsContent" }) do
        plain "Double click on a record to update to open update form"
      end
    end
  end
end