yooo this is sick
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
<% if logged_in? %>
|
||||
<p>Logged in as <%= current_user.username %></p>
|
||||
<p><%= link_to "Log out", logout_path, data: {
|
||||
turbo_method: :delete
|
||||
} %></p>
|
||||
<% else %>
|
||||
<p><%= link_to "Log in", login_path %> or <%= link_to "Sign up", signup_path %></p>
|
||||
<% end %>
|
||||
|
||||
<h1>Articles!</h1>
|
||||
|
||||
Our blog has <%= Article.public_count %> articles and counting!
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
<p><%= @article.body %></p>
|
||||
|
||||
<ul>
|
||||
<li><%= link_to "Edit", edit_article_path(@article) %></li>
|
||||
<li><%= link_to "Destroy", article_path(@article), data: {
|
||||
turbo_method: :delete,
|
||||
turbo_confirm: "Are you sure?"
|
||||
} %></li>
|
||||
</ul>
|
||||
<% if logged_in? && @article.user_id == current_user.id %>
|
||||
<ul>
|
||||
<li><%= link_to "Edit", edit_article_path(@article) %></li>
|
||||
<li><%= link_to "Destroy", article_path(@article), data: {
|
||||
turbo_method: :delete,
|
||||
turbo_confirm: "Are you sure?"
|
||||
} %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<h2>Comments</h2>
|
||||
<%= render @article.comments %>
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<%= form_with model: [ @article, @article.comments.build ] do |form| %>
|
||||
<p>
|
||||
<%= form.label :commenter %><br>
|
||||
<%= form.text_field :commenter %><br>
|
||||
</p>
|
||||
<p>
|
||||
<%= form.label :body %><br>
|
||||
<%= form.text_area :body %><br>
|
||||
</p>
|
||||
<p>
|
||||
<%= form.label :status %><br>
|
||||
<%= form.select :status, Visible::VALID_STATUSES, selected: 'public' %><br>
|
||||
</p>
|
||||
<p>
|
||||
<%= form.submit %><br>
|
||||
</p>
|
||||
<% if logged_in? %>
|
||||
<%= form_with model: [ @article, @article.comments.build ] do |form| %>
|
||||
<p>
|
||||
<%= form.label :body %><br>
|
||||
<%= form.text_area :body %><br>
|
||||
</p>
|
||||
<p>
|
||||
<%= form.label :status %><br>
|
||||
<%= form.select :status, Visible::VALID_STATUSES, selected: 'public' %><br>
|
||||
</p>
|
||||
<p>
|
||||
<%= form.submit %><br>
|
||||
</p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to "Sign up", signup_path %> or
|
||||
<%= link_to "Log in", login_path %>
|
||||
<% end %>
|
||||
2
app/views/sessions/create.html.erb
Normal file
2
app/views/sessions/create.html.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
<h1>Sessions#create</h1>
|
||||
<p>Find me in app/views/sessions/create.html.erb</p>
|
||||
2
app/views/sessions/destroy.html.erb
Normal file
2
app/views/sessions/destroy.html.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
<h1>Sessions#destroy</h1>
|
||||
<p>Find me in app/views/sessions/destroy.html.erb</p>
|
||||
17
app/views/sessions/new.html.erb
Normal file
17
app/views/sessions/new.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<h1>Log in</h1>
|
||||
|
||||
<%= form_with url: login_path, local: true do |form| %>
|
||||
<div class="field">
|
||||
<%= form.label :email %>
|
||||
<%= form.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :password %>
|
||||
<%= form.password_field :password, autocomplete: "current-password" %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit "Log in" %>
|
||||
</div>
|
||||
<% end %>
|
||||
38
app/views/users/new.html.erb
Normal file
38
app/views/users/new.html.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
<h1>Sign up</h1>
|
||||
|
||||
<%= form_with model: @user, local: true do |form| %>
|
||||
<% if @user.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
||||
<ul>
|
||||
<% @user.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :username %>
|
||||
<%= form.text_field :username, auto_focus: true, autocomplete: "username" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :email %>
|
||||
<%= form.email_field :email, autocomplete: "email" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :password %>
|
||||
<%= form.password_field :password, autocomplete: "new-password" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :password_confirmation %>
|
||||
<%= form.password_field :password_confirmation %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit "Sign up"%>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user