first commit

This commit is contained in:
Sabic
2024-08-07 16:43:33 +02:00
commit f3b67b0800
111 changed files with 1993 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<%= form_with model: article do |form| %>
<div>
<%= form.label :title %><br>
<%= form.text_field :title %>
<% article.errors.full_messages_for(:title).each do |message| %>
<div><%= message %></div>
<% end %>
</div>
<div>
<%= form.label :body %><br>
<%= form.text_area :body %>
<% article.errors.full_messages_for(:body).each do |message| %>
<div><%= message %></div>
<% end %>
</div>
<div>
<%= form.label :status %><br>
<%= form.select :status, Visible::VALID_STATUSES, selected: article.status || 'public' %><br>
</div>
<div>
<%= form.submit %>
</div>
<% end %>

View File

@@ -0,0 +1,3 @@
<h1>Edit Article</h1>
<%= render "form", article: @article %>

View File

@@ -0,0 +1,15 @@
<h1>Articles!</h1>
Our blog has <%= Article.public_count %> articles and counting!
<ul>
<% @articles.each do |article| %>
<% unless article.archived? %>
<li>
<%= link_to article.title, article %>
</li>
<%end%>
<% end %>
</ul>
<%= link_to "New Article", new_article_path %>

View File

@@ -0,0 +1,3 @@
<h1>New Article</h1>
<%= render "form", article: @article %>

View File

@@ -0,0 +1,17 @@
<h1><%= @article.title %></h1>
<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>
<h2>Comments</h2>
<%= render @article.comments %>
<h2>Add a comment</h2>
<%= render "comments/form" %>