diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 31851b1..cb9d7db 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -236,7 +236,7 @@ cursor: pointer;
.scrapbox {
- height: 443px;
+ height: 643px;
width: 600px;
border: 5px double white;
overflow: scroll;
diff --git a/app/controllers/scraps_controller.rb b/app/controllers/scraps_controller.rb
index 24d3ed2..b36b9af 100644
--- a/app/controllers/scraps_controller.rb
+++ b/app/controllers/scraps_controller.rb
@@ -1,7 +1,7 @@
class ScrapsController < ApplicationController
allow_unauthenticated_access(only: %i[index show])
def index
- @scraps = Scrap.all
+ @scraps = Scrap.order(created_at: :desc)
end
def edit
@scrap = Scrap.find(params[:id])
diff --git a/app/views/scraps/edit.html.erb b/app/views/scraps/edit.html.erb
index e69de29..05c7c36 100644
--- a/app/views/scraps/edit.html.erb
+++ b/app/views/scraps/edit.html.erb
@@ -0,0 +1,34 @@
+<% if authenticated? %>
+ <%= link_to 'New Scrap', new_scrap_path %>
+ <% else %>
+ .
+<% end %>
+
+Edit Scrap
+<%= form_with model: [@scrap] do |f| %>
+
+
+ <%= f.label :text %>
+ <%= f.rich_text_area :text %>
+
+
+
+ <%= f.label :image %>
+ <%= f.file_field :image %>
+
+
+ <%= f.label :mood %>
+ <%= f.text_area :mood %>
+
+
+
+ <%= f.label :music %>
+ <%= f.text_area :music %>
+
+
+
+ <%= f.label :notes %>
+ <%= f.rich_text_area :notes %>
+
+ <%= f.submit "Edit Scrap" %>
+<% end %>
diff --git a/app/views/scraps/index.html.erb b/app/views/scraps/index.html.erb
index a890ec6..8b71688 100644
--- a/app/views/scraps/index.html.erb
+++ b/app/views/scraps/index.html.erb
@@ -9,9 +9,9 @@ random thoughts longer than miniblog length will go here :)
<% @scraps.each do |scrap| %>
+(<%= link_to 'Read', scrap_path(scrap) %>)
-
- <%= truncate(scrap.text.to_plain_text, length: 350) %> (<%= link_to 'Read', scrap_path(scrap) %>) | <%= time_ago_in_words(scrap.created_at) %> ago
+ <%= truncate(scrap.text.to_plain_text, length: 350) %> | <%= time_ago_in_words(scrap.created_at) %> ago
<% if authenticated? %>
|
diff --git a/app/views/scraps/show.html.erb b/app/views/scraps/show.html.erb
index 5d99866..1d61fbd 100644
--- a/app/views/scraps/show.html.erb
+++ b/app/views/scraps/show.html.erb
@@ -2,7 +2,9 @@
<%= link_to '[ b a c k . . ? ]', scraps_path %>
SCRAPBOOK ENTRY #<%= @scrap.id %>
- <%= @scrap.text %>
+ <% if @scrap.image.attached? %>
+ <%= image_tag @scrap.image %> <% end %>
+ <%= @scrap.text %>
@@ -17,4 +19,9 @@
Current Mood:
<%= @scrap.mood %>
<% end %>
+
+<% if @scrap.notes.present? %>
+ Notes:
+ <%= @scrap.notes %>
+ <% end %>