-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1a0523
commit ca1c9c0
Showing
5 changed files
with
87 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class Event | ||
attr_accessor :id | ||
|
||
def self.find(id) | ||
new( | ||
id: id, | ||
name: 'Stubbed Event', | ||
description: 'This is a stubbed event for testing purposes.', | ||
created_at: Time.now.utc, | ||
header: { | ||
'user' => { 'id' => 1, 'name' => 'Alice', 'email' => '[email protected]' }, | ||
'location' => { 'city' => 'New York', 'coordinates' => { 'lat' => 40.7128, 'lon' => -74.0060 } } | ||
}, | ||
body: { | ||
'title' => 'Event Title', | ||
'description' => 'This is a description of the event.', | ||
'attendees' => [{ 'id' => 1, 'name' => 'Bob' }, { 'id' => 2, 'name' => 'Charlie' }] | ||
} | ||
) | ||
end | ||
|
||
def initialize(id:, name:, description:, created_at:, header:, body:) | ||
@id = id | ||
@name = name | ||
@description = description | ||
@created_at = created_at | ||
@header = header | ||
@body = body | ||
end | ||
|
||
def attributes | ||
{ | ||
'id' => @id, | ||
'name' => @name, | ||
'description' => @description, | ||
'created_at' => @created_at, | ||
'header' => @header, | ||
'body' => @body | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
<h1><%= messageable.class.name %> Details</h1> | ||
|
||
<ul> | ||
<% messageable.attributes.each do |key, value| %> | ||
<li><strong><%= key.humanize %>:</strong> | ||
<% if value.is_a?(Hash) || value.is_a?(Array) %> | ||
<pre><%= JSON.pretty_generate(value) %></pre> | ||
<% else %> | ||
<%= value %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
|
||
<a href="/">Back to Home</a> | ||
<div class="container mt-4"<div class="container my-4"> | ||
<div class="card"> | ||
<div class="card-header d-flex justify-content-between align-items-center"> | ||
<h3 class="mb-0"><%= messageable.class.name %> <%= messageable.id %></h3> | ||
</div> | ||
<div class="card-body"> | ||
<table class="table"> | ||
<tbody> | ||
<% messageable.attributes.each do |key, value| %> | ||
<tr> | ||
<th scope="row"><%= key.humanize %></th> | ||
<td> | ||
<% if value.is_a?(Hash) || value.is_a?(Array) %> | ||
<pre class="mb-0"><%= JSON.pretty_generate(value) %></pre> | ||
<% else %> | ||
<%= value %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> |