changed some stuff around on scraps page

This commit is contained in:
root 2026-05-17 08:14:21 +00:00
parent f5dcf4d107
commit f94269954c
5 changed files with 46 additions and 5 deletions

View file

@ -236,7 +236,7 @@ cursor: pointer;
.scrapbox { .scrapbox {
height: 443px; height: 643px;
width: 600px; width: 600px;
border: 5px double white; border: 5px double white;
overflow: scroll; overflow: scroll;

View file

@ -1,7 +1,7 @@
class ScrapsController < ApplicationController class ScrapsController < ApplicationController
allow_unauthenticated_access(only: %i[index show]) allow_unauthenticated_access(only: %i[index show])
def index def index
@scraps = Scrap.all @scraps = Scrap.order(created_at: :desc)
end end
def edit def edit
@scrap = Scrap.find(params[:id]) @scrap = Scrap.find(params[:id])

View file

@ -0,0 +1,34 @@
<% if authenticated? %>
<%= link_to 'New Scrap', new_scrap_path %>
<% else %>
.
<% end %>
<div class="maininfo">
Edit Scrap<br><br>
<%= form_with model: [@scrap] do |f| %>
<div>
<%= f.label :text %>
<%= f.rich_text_area :text %>
</div>
<div>
<%= f.label :image %>
<%= f.file_field :image %>
</div>
<div>
<%= f.label :mood %>
<%= f.text_area :mood %>
</div>
<div>
<%= f.label :music %>
<%= f.text_area :music %>
</div>
<div>
<%= f.label :notes %>
<%= f.rich_text_area :notes %>
</div>
<%= f.submit "Edit Scrap" %>
<% end %>

View file

@ -9,9 +9,9 @@ random thoughts longer than miniblog length will go here :)<br><br>
<hr> <hr>
<% @scraps.each do |scrap| %> <% @scraps.each do |scrap| %>
(<%= link_to 'Read', scrap_path(scrap) %>) <br>
<%= truncate(scrap.text.to_plain_text, length: 350) %> | <%= time_ago_in_words(scrap.created_at) %> ago
<%= truncate(scrap.text.to_plain_text, length: 350) %> (<%= link_to 'Read', scrap_path(scrap) %>) | <%= time_ago_in_words(scrap.created_at) %> ago
<br> <br>
<% if authenticated? %> <% if authenticated? %>
| |

View file

@ -2,7 +2,9 @@
<div class="scrapbox"> <div class="scrapbox">
<%= link_to '[ b a c k . . ? ]', scraps_path %> <%= link_to '[ b a c k . . ? ]', scraps_path %>
<h2>SCRAPBOOK ENTRY #<%= @scrap.id %></h2> <h2>SCRAPBOOK ENTRY #<%= @scrap.id %></h2>
<%= @scrap.text %> <% if @scrap.image.attached? %>
<%= image_tag @scrap.image %> <% end %>
<%= @scrap.text %>
</p> </p>
<p> <p>
@ -17,4 +19,9 @@
<strong>Current Mood:</strong> <strong>Current Mood:</strong>
<%= @scrap.mood %></p> <%= @scrap.mood %></p>
<% end %> <% end %>
<p>
<% if @scrap.notes.present? %>
<strong>Notes:</strong>
<%= @scrap.notes %></p>
<% end %>
</div></ddiv> </div></ddiv>