changed some stuff around on scraps page
This commit is contained in:
parent
f5dcf4d107
commit
f94269954c
5 changed files with 46 additions and 5 deletions
|
|
@ -236,7 +236,7 @@ cursor: pointer;
|
|||
|
||||
.scrapbox {
|
||||
|
||||
height: 443px;
|
||||
height: 643px;
|
||||
width: 600px;
|
||||
border: 5px double white;
|
||||
overflow: scroll;
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
@ -9,9 +9,9 @@ random thoughts longer than miniblog length will go here :)<br><br>
|
|||
<hr>
|
||||
<% @scraps.each do |scrap| %>
|
||||
|
||||
(<%= link_to 'Read', scrap_path(scrap) %>) <br>
|
||||
|
||||
|
||||
<%= 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
|
||||
<br>
|
||||
<% if authenticated? %>
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
<div class="scrapbox">
|
||||
<%= link_to '[ b a c k . . ? ]', scraps_path %>
|
||||
<h2>SCRAPBOOK ENTRY #<%= @scrap.id %></h2>
|
||||
<%= @scrap.text %>
|
||||
<% if @scrap.image.attached? %>
|
||||
<%= image_tag @scrap.image %> <% end %>
|
||||
<%= @scrap.text %>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
|
@ -17,4 +19,9 @@
|
|||
<strong>Current Mood:</strong>
|
||||
<%= @scrap.mood %></p>
|
||||
<% end %>
|
||||
<p>
|
||||
<% if @scrap.notes.present? %>
|
||||
<strong>Notes:</strong>
|
||||
<%= @scrap.notes %></p>
|
||||
<% end %>
|
||||
</div></ddiv>
|
||||
|
|
|
|||
Loading…
Reference in a new issue