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 {
|
.scrapbox {
|
||||||
|
|
||||||
height: 443px;
|
height: 643px;
|
||||||
width: 600px;
|
width: 600px;
|
||||||
border: 5px double white;
|
border: 5px double white;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
|
|
|
||||||
|
|
@ -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])
|
||||||
|
|
|
||||||
|
|
@ -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>
|
<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? %>
|
||||||
|
|
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
<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>
|
||||||
|
<% if @scrap.image.attached? %>
|
||||||
|
<%= image_tag @scrap.image %> <% end %>
|
||||||
<%= @scrap.text %>
|
<%= @scrap.text %>
|
||||||
|
|
||||||
</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>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue