Class: Monolith::EmailsController::Show

Inherits:
View
  • Object
show all
Defined in:
app/controllers/monolith/emails_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#email=(value) ⇒ Object (writeonly)

Sets the attribute email

Parameters:

  • value

    the value to set the attribute email to.



34
35
36
# File 'app/controllers/monolith/emails_controller.rb', line 34

def email=(value)
  @email = value
end

Instance Method Details

#previewObject



56
57
58
# File 'app/controllers/monolith/emails_controller.rb', line 56

def preview
  @email.preview
end

#view_templateObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/monolith/emails_controller.rb', line 36

def view_template
  div(class: "p-6 space-y-4") do
    h1(class: "text-2xl font-bold") { @email.to_s }
    dl(class: "grid grid-cols-1 gap-y-2") {
      dt(class: "font-semibold") { "To:" }
      dd(class: "mb-3") { preview.to }

      dt(class: "font-semibold") { "From:" }
      dd(class: "mb-3") { preview.from }

      dt(class: "font-semibold") { "Subject:" }
      dd(class: "mb-3") { preview.subject }

      dt(class: "font-semibold") { "Body:" }
      dd(class: "whitespace-pre-wrap") { preview.body }
    }
    div(class: "pt-4") { nav_link "← All emails", controller: "/monolith/emails", action: :index }
  end
end