diff options
author | Matthew Lemon <y@yulqen.org> | 2023-12-17 14:26:17 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-12-17 14:26:17 +0000 |
commit | c84b94a647fb4c068e8be9d0495ff7284f41f168 (patch) | |
tree | d969c75c764436c0478234233597e38e1e29c2d5 /app/views |
Initial
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/events/_event.html.erb | 12 | ||||
-rw-r--r-- | app/views/events/_event.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/events/_form.html.erb | 27 | ||||
-rw-r--r-- | app/views/events/edit.html.erb | 10 | ||||
-rw-r--r-- | app/views/events/index.html.erb | 18 | ||||
-rw-r--r-- | app/views/events/index.json.jbuilder | 1 | ||||
-rw-r--r-- | app/views/events/new.html.erb | 9 | ||||
-rw-r--r-- | app/views/events/show.html.erb | 10 | ||||
-rw-r--r-- | app/views/events/show.json.jbuilder | 1 | ||||
-rw-r--r-- | app/views/layouts/application.html.erb | 18 | ||||
-rw-r--r-- | app/views/layouts/mailer.html.erb | 13 | ||||
-rw-r--r-- | app/views/layouts/mailer.text.erb | 1 | ||||
-rw-r--r-- | app/views/pages/index.html.erb | 9 |
13 files changed, 131 insertions, 0 deletions
diff --git a/app/views/events/_event.html.erb b/app/views/events/_event.html.erb new file mode 100644 index 0000000..ed43a66 --- /dev/null +++ b/app/views/events/_event.html.erb @@ -0,0 +1,12 @@ +<div id="<%= dom_id event %>"> + <p> + <strong>Date:</strong> + <%= event.date %> + </p> + + <p> + <strong>Name:</strong> + <%= event.name %> + </p> + +</div> diff --git a/app/views/events/_event.json.jbuilder b/app/views/events/_event.json.jbuilder new file mode 100644 index 0000000..64eb849 --- /dev/null +++ b/app/views/events/_event.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! event, :id, :date, :name, :created_at, :updated_at +json.url event_url(event, format: :json) diff --git a/app/views/events/_form.html.erb b/app/views/events/_form.html.erb new file mode 100644 index 0000000..db05a72 --- /dev/null +++ b/app/views/events/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_with(model: event) do |form| %> + <% if event.errors.any? %> + <div style="color: red"> + <h2><%= pluralize(event.errors.count, "error") %> prohibited this event from being saved:</h2> + + <ul> + <% event.errors.each do |error| %> + <li><%= error.full_message %></li> + <% end %> + </ul> + </div> + <% end %> + + <div> + <%= form.label :date, style: "display: block" %> + <%= form.date_field :date %> + </div> + + <div> + <%= form.label :name, style: "display: block" %> + <%= form.text_field :name %> + </div> + + <div> + <%= form.submit %> + </div> +<% end %> diff --git a/app/views/events/edit.html.erb b/app/views/events/edit.html.erb new file mode 100644 index 0000000..e398927 --- /dev/null +++ b/app/views/events/edit.html.erb @@ -0,0 +1,10 @@ +<h1>Editing event</h1> + +<%= render "form", event: @event %> + +<br> + +<div> + <%= link_to "Show this event", @event %> | + <%= link_to "Back to events", events_path %> +</div> diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb new file mode 100644 index 0000000..654d317 --- /dev/null +++ b/app/views/events/index.html.erb @@ -0,0 +1,18 @@ +<p style="color: green"><%= notice %></p> + +<h1>Events</h1> + +<%= link_to "New event", new_event_path %> + +<table class="table table-success table-striped table-bordered mt-2"> + <tr> + <th>Date</th> + <th>Name</th> + </tr> + <% @events.each do |e| %> + <tr> + <td><%= e.name %></td> + <td><%= e.date.to_formatted_s(:rfc822) %></td> + </tr> + <% end %> +</table> diff --git a/app/views/events/index.json.jbuilder b/app/views/events/index.json.jbuilder new file mode 100644 index 0000000..034fd83 --- /dev/null +++ b/app/views/events/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @events, partial: "events/event", as: :event diff --git a/app/views/events/new.html.erb b/app/views/events/new.html.erb new file mode 100644 index 0000000..efe61e5 --- /dev/null +++ b/app/views/events/new.html.erb @@ -0,0 +1,9 @@ +<h1>New event</h1> + +<%= render "form", event: @event %> + +<br> + +<div> + <%= link_to "Back to events", events_path %> +</div> diff --git a/app/views/events/show.html.erb b/app/views/events/show.html.erb new file mode 100644 index 0000000..f8276e2 --- /dev/null +++ b/app/views/events/show.html.erb @@ -0,0 +1,10 @@ +<p style="color: green"><%= notice %></p> + +<%= render @event %> + +<div> + <%= link_to "Edit this event", edit_event_path(@event) %> | + <%= link_to "Back to events", events_path %> + + <%= button_to "Destroy this event", @event, method: :delete %> +</div> diff --git a/app/views/events/show.json.jbuilder b/app/views/events/show.json.jbuilder new file mode 100644 index 0000000..1b1c36e --- /dev/null +++ b/app/views/events/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "events/event", event: @event diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..c502f4d --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> + <head> + <title>Ded</title> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> + </head> + + <body> + <div class="container"> + <%= yield %> + </div> + </body> +</html> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 0000000..3aac900 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <style> + /* Email styles need to be inline */ + </style> + </head> + + <body> + <%= yield %> + </body> +</html> diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 0000000..37f0bdd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb new file mode 100644 index 0000000..cf72e40 --- /dev/null +++ b/app/views/pages/index.html.erb @@ -0,0 +1,9 @@ +<div class="row mt-2"> + + <h1 id="header-title">DefNucSyR Engagement Database</h1> + + <p>This is some text about the page.</p> + +</div> + + |